entity cramming: check less often

This commit is contained in:
cora 2022-05-21 21:36:38 +02:00
parent 9a02a0e596
commit 991cffbaf7
1 changed files with 2 additions and 4 deletions

View File

@ -3024,10 +3024,9 @@ local function check_entity_cramming(self)
local l = o:get_luaentity() local l = o:get_luaentity()
if l and clear then if l and clear then
l.cram = nil l.cram = nil
ncram = {}
elseif l and l.cram == nil then elseif l and l.cram == nil then
table.insert(ncram,l) table.insert(ncram,l)
elseif l and l.cram then elseif not clear and l and l.cram then
damage_mob(l,"cramming",cramming_damage) damage_mob(l,"cramming",cramming_damage)
end end
end end
@ -3632,7 +3631,6 @@ end
-- main mob function -- main mob function
local mob_step = function(self, dtime) local mob_step = function(self, dtime)
check_item_pickup(self) check_item_pickup(self)
check_entity_cramming(self)
if not self.fire_resistant then if not self.fire_resistant then
mcl_burning.tick(self.object, dtime, self) mcl_burning.tick(self.object, dtime, self)
end end
@ -3750,7 +3748,7 @@ local mob_step = function(self, dtime)
if (self.state == "attack" and self.env_damage_timer > 1) if (self.state == "attack" and self.env_damage_timer > 1)
or self.state ~= "attack" then or self.state ~= "attack" then
check_entity_cramming(self)
self.env_damage_timer = 0 self.env_damage_timer = 0
-- check for environmental damage (water, fire, lava etc.) -- check for environmental damage (water, fire, lava etc.)