mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-08-19 21:44:12 +02:00
Limit y range to the same hemisphere (top/bottom)
This commit is contained in:
parent
74cf14ef0f
commit
3850fc1a9f
@ -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 New Issue
Block a user