Group damage logic. Remove physics falling logic out of suspend with duplicate falling call
This commit is contained in:
parent
952a90bfde
commit
5a059379b2
|
@ -387,25 +387,14 @@ local function on_step_work (self, dtime)
|
|||
end
|
||||
|
||||
if self:falling(pos) then return end
|
||||
|
||||
local player_in_active_range = self:player_in_active_range()
|
||||
|
||||
self:check_suspend(player_in_active_range)
|
||||
|
||||
if not self.fire_resistant then
|
||||
mcl_burning.tick(self.object, dtime, self)
|
||||
if not self.object:get_pos() then return end -- mcl_burning.tick may remove object immediately
|
||||
|
||||
if self:check_for_death("fire", {type = "fire"}) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
if self:env_damage (dtime, pos) then return end
|
||||
if self:step_damage (dtime, pos) then return end
|
||||
|
||||
if self.state == "die" then return end
|
||||
-- End: Death/damage processing
|
||||
|
||||
local player_in_active_range = self:player_in_active_range()
|
||||
self:check_suspend(player_in_active_range)
|
||||
|
||||
self:check_water_flow()
|
||||
|
||||
if not self._jumping_cliff then
|
||||
|
|
|
@ -820,11 +820,19 @@ function mob_class:do_env_damage()
|
|||
return self:check_for_death("unknown", {type = "unknown"})
|
||||
end
|
||||
|
||||
function mob_class:env_damage (dtime, pos)
|
||||
function mob_class:step_damage (dtime, pos)
|
||||
if not self.fire_resistant then
|
||||
mcl_burning.tick(self.object, dtime, self)
|
||||
if not self.object:get_pos() then return end -- mcl_burning.tick may remove object immediately
|
||||
|
||||
if self:check_for_death("fire", {type = "fire"}) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- environmental damage timer (every 1 second)
|
||||
self.env_damage_timer = self.env_damage_timer + dtime
|
||||
|
||||
|
||||
if self.env_damage_timer > 1 then
|
||||
self.env_damage_timer = 0
|
||||
|
||||
|
@ -1019,9 +1027,6 @@ function mob_class:check_suspend(player_in_active_range)
|
|||
self.object:set_acceleration(vector.zero())
|
||||
self.object:set_velocity(vector.zero())
|
||||
end
|
||||
if acc.y == 0 and node_under == "air" then
|
||||
self:falling(pos)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue