Make death check less frequent. Load passenger in minecart at shutdown.

This commit is contained in:
ancientmarinerdev 2023-03-20 13:16:26 +00:00 committed by Gitea
parent f817fe7f72
commit 3eab946889

View File

@ -87,6 +87,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
local data = minetest.deserialize(staticdata) local data = minetest.deserialize(staticdata)
if type(data) == "table" then if type(data) == "table" then
self._railtype = data._railtype self._railtype = data._railtype
self._passenger = data._passenger
end end
self.object:set_armor_groups({immortal=1}) self.object:set_armor_groups({immortal=1})
@ -231,9 +232,11 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
end end
-- Make room in the minecart after the mob dies -- Make room in the minecart after the mob dies
elseif self._passenger then elseif self._passenger then
dead = self._passenger:check_for_death() if math.random(1,20) > 1 then
if dead == true then local dead = self._passenger:check_for_death()
self._passenger = nil if dead == true then
self._passenger = nil
end
end end
end end