Despawn animals, too

This commit is contained in:
Wuzzy 2019-01-31 22:00:43 +01:00
parent 0a803400fe
commit 8ff69dda0c

View file

@ -2558,6 +2558,7 @@ local mob_staticdata = function(self)
and ((not self.nametag) or (self.nametag == "")) and ((not self.nametag) or (self.nametag == ""))
and self.lifetimer <= 20 then and self.lifetimer <= 20 then
minetest.log("action", "Mob "..name.." despawns in mob_staticdata at "..minetest.pos_to_string(self.object.get_pos()))
self.object:remove() self.object:remove()
return ""-- nil return ""-- nil
@ -2776,6 +2777,7 @@ local mob_step = function(self, dtime)
end end
end end
minetest.log("action", "Mob "..name.." despawns in mob_step at "..minetest.pos_to_string(pos))
self.object:remove() self.object:remove()
return return
@ -2960,11 +2962,7 @@ local can_despawn
if def.can_despawn ~= nil then if def.can_despawn ~= nil then
can_despawn = def.can_despawn can_despawn = def.can_despawn
else else
if def.type == "monster" then can_despawn = true
can_despawn = true
else
can_despawn = false
end
end end
minetest.register_entity(name, { minetest.register_entity(name, {
@ -3223,6 +3221,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
if objs[n]:is_player() then if objs[n]:is_player() then
-- player too close -- player too close
minetest.log("info", "Mob spawn of ".. name .. " failed, player too close")
return return
end end
end end