From d570a2dda6233f8d0fe61c9c5556d23d5f2dbe4f Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 6 Oct 2022 18:55:58 +0200 Subject: [PATCH] Fix double despawn in staticdata/activate --- mods/ENTITIES/mcl_mobs/api.lua | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index bfdd71355..eedb038fb 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -1459,7 +1459,7 @@ local breed = function(self) z = 0 }) end - + self.animation = nil local anim = self._current_animation self._current_animation = nil -- Mobs Redo does nothing otherwise @@ -3408,10 +3408,8 @@ local mob_staticdata = function(self) and ((not self.nametag) or (self.nametag == "")) and self.lifetimer <= 20 then if spawn_logging then - minetest.log("action", "[mcl_mobs] Mob "..tostring(self.name).." despawns in mob_staticdata at "..minetest.pos_to_string(self.object:get_pos())) + minetest.log("action", "[mcl_mobs] Mob "..tostring(self.name).." despawns in mob_staticdata at "..minetest.pos_to_string(vector.round(self.object:get_pos()))) end - mcl_burning.extinguish(self.object) - self.object:remove() return "remove"-- nil end @@ -3441,21 +3439,19 @@ end -- activate mob and reload settings local mob_activate = function(self, staticdata, def, dtime) - + if not self.object:get_pos() or staticdata == "remove" then + mcl_burning.extinguish(self.object) + self.object:remove() + return + end -- remove monsters in peaceful mode if self.type == "monster" and minetest.settings:get_bool("only_peaceful_mobs", false) then mcl_burning.extinguish(self.object) self.object:remove() - return end - if staticdata == "remove" then - mcl_burning.extinguish(self.object) - self.object:remove() - return - end -- load entity variables local tmp = minetest.deserialize(staticdata) @@ -4519,7 +4515,7 @@ function mcl_mobs:spawn_child(pos, mob_type) ent.base_selbox[6] * .5, }, }) - + ent.animation = ent._child_animations ent._current_animation = nil set_animation(ent, "stand")