mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-23 02:51:06 +01:00
Merge pull request 'Fix double despawn in staticdata/activate (and resulting segfault)' (#2723) from fix_double_despawn into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2723
This commit is contained in:
commit
9107bfa62d
1 changed files with 8 additions and 12 deletions
|
@ -3408,10 +3408,8 @@ 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
|
||||||
if spawn_logging 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
|
end
|
||||||
mcl_burning.extinguish(self.object)
|
|
||||||
self.object:remove()
|
|
||||||
|
|
||||||
return "remove"-- nil
|
return "remove"-- nil
|
||||||
end
|
end
|
||||||
|
@ -3441,21 +3439,19 @@ end
|
||||||
|
|
||||||
-- activate mob and reload settings
|
-- activate mob and reload settings
|
||||||
local mob_activate = function(self, staticdata, def, dtime)
|
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
|
-- remove monsters in peaceful mode
|
||||||
if self.type == "monster"
|
if self.type == "monster"
|
||||||
and minetest.settings:get_bool("only_peaceful_mobs", false) then
|
and minetest.settings:get_bool("only_peaceful_mobs", false) then
|
||||||
mcl_burning.extinguish(self.object)
|
mcl_burning.extinguish(self.object)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if staticdata == "remove" then
|
|
||||||
mcl_burning.extinguish(self.object)
|
|
||||||
self.object:remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- load entity variables
|
-- load entity variables
|
||||||
local tmp = minetest.deserialize(staticdata)
|
local tmp = minetest.deserialize(staticdata)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue