Fix mobs spawning inside nodes

This commit is contained in:
cora 2022-07-17 02:34:34 +02:00 committed by Gitea
parent 3a32e4e4e9
commit 987ae3c6e8
2 changed files with 7 additions and 1 deletions

View File

@ -4036,6 +4036,7 @@ minetest.register_entity(name, {
fire_damage_resistant = def.fire_damage_resistant or false,
ignited_by_sunlight = def.ignited_by_sunlight or false,
spawn_in_group = def.spawn_in_group,
spawn_in_group_min = def.spawn_in_group_min,
-- End of MCL2 extensions
on_spawn = def.on_spawn,

View File

@ -388,7 +388,12 @@ end
local function spawn_group(p,mob,spawn_on,group_max,group_min)
if not group_min then group_min = 1 end
local nn = minetest.find_nodes_in_area(vector.offset(p,-5,-3,-5),vector.offset(p,5,3,5),spawn_on)
local nn
if mob.spawn_class == "water" then
nn= minetest.find_nodes_in_area(vector.offset(p,-5,-3,-5),vector.offset(p,5,3,5),spawn_on)
else
nn= minetest.find_nodes_in_area_under_air(vector.offset(p,-5,-3,-5),vector.offset(p,5,3,5),spawn_on)
end
local o
if not nn or #nn < 1 then
nn = {}