1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-12-24 17:50:21 +01:00

have protection check right before spawning mob

This commit is contained in:
TenPlus1 2018-06-17 10:14:01 +01:00
parent e23f47922b
commit 7b7aa45da8

14
api.lua
View File

@ -3270,13 +3270,6 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
return return
end end
-- mobs cannot spawn in protected areas when enabled
if not spawn_protected
and minetest.is_protected(pos, "") then
--print ("--- inside protected area", name)
return
end
-- only spawn away from player -- only spawn away from player
local objs = minetest.get_objects_inside_radius(pos, 10) local objs = minetest.get_objects_inside_radius(pos, 10)
@ -3302,6 +3295,13 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
end end
end end
-- mobs cannot spawn in protected areas when enabled
if not spawn_protected
and minetest.is_protected(pos, "") then
--print ("--- inside protected area", name)
return
end
-- spawn mob half block higher than ground -- spawn mob half block higher than ground
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5