Fixing max spawn radius to also be spherical, like the spawn cap check

This commit is contained in:
Jordan Leppert 2022-02-16 09:51:22 +00:00
parent fe4f065bfc
commit c99837fbde

View file

@ -167,9 +167,11 @@ function execute_spawns(player)
y = pos.y, y = pos.y,
z = pos.z + random(-max_radius, max_radius) z = pos.z + random(-max_radius, max_radius)
} }
if vector.distance(pos, spawn_pos_center) < min_radius then local dist = vector.distance(pos, spawn_pos_center)
if dist < min_radius or dist > max_radius then
return return
end end
local index_func local index_func
if spawn.spawn_in_nodes then if spawn.spawn_in_nodes then
index_func = minetest.find_nodes_in_area index_func = minetest.find_nodes_in_area