Fixed bug that crashes zombie siege in context where z cannot spawn

This commit is contained in:
ancientmarinerdev 2022-12-11 20:22:06 +00:00
parent f7f0a2be8b
commit 9b94a752bd
1 changed files with 8 additions and 4 deletions

View File

@ -10,10 +10,14 @@ local function spawn_zombies(self)
local p = vector.offset(nn[i%#nn],0,1,0) local p = vector.offset(nn[i%#nn],0,1,0)
if check_spawn_pos(p) then if check_spawn_pos(p) then
local m = mcl_mobs.spawn(p,"mobs_mc:zombie") local m = mcl_mobs.spawn(p,"mobs_mc:zombie")
if m then
local l = m:get_luaentity() local l = m:get_luaentity()
mcl_mobs:gopath(m:get_luaentity(), self.pos) mcl_mobs:gopath(m:get_luaentity(), self.pos)
table.insert(self.mobs, m) table.insert(self.mobs, m)
self.health_max = self.health_max + l.health self.health_max = self.health_max + l.health
else
--minetest.log("Failed to spawn zombie at location: " .. minetest.pos_to_string(p))
end
end end
end end
end end