mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
Limit y range to the same hemisphere (top/bottom)
This commit is contained in:
parent
74cf14ef0f
commit
3850fc1a9f
1 changed files with 12 additions and 2 deletions
|
@ -618,10 +618,20 @@ local function get_next_mob_spawn_pos(pos)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local y_min
|
||||||
|
local y_max
|
||||||
|
if goal_pos.y > pos.y then
|
||||||
|
y_min = math_round(pos.y)
|
||||||
|
y_max = math_round(pos.y) + MOB_SPAWN_ZONE_MIDDLE
|
||||||
|
else
|
||||||
|
y_min = math_round(pos.y) - MOB_SPAWN_ZONE_MIDDLE
|
||||||
|
y_max = math_round(pos.y)
|
||||||
|
end
|
||||||
|
|
||||||
-- Ask engine for valid spawn locations
|
-- Ask engine for valid spawn locations
|
||||||
local spawning_position_list = find_nodes_in_area_under_air(
|
local spawning_position_list = find_nodes_in_area_under_air(
|
||||||
{x = goal_pos.x, y = math_round(pos.y) - MOB_SPAWN_ZONE_MIDDLE, z = goal_pos.z},
|
{x = goal_pos.x, y = y_min, z = goal_pos.z},
|
||||||
{x = goal_pos.x, y = math_round(pos.y) + MOB_SPAWN_ZONE_MIDDLE, z = goal_pos.z},
|
{x = goal_pos.x, y = y_max, z = goal_pos.z},
|
||||||
{"group:solid", "group:water", "group:lava"}
|
{"group:solid", "group:water", "group:lava"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue