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")
local l = m:get_luaentity() if m then
mcl_mobs:gopath(m:get_luaentity(),self.pos) local l = m:get_luaentity()
table.insert(self.mobs,m) mcl_mobs:gopath(m:get_luaentity(), self.pos)
self.health_max = self.health_max + l.health table.insert(self.mobs, m)
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