mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Group damage logic. Remove physics falling logic out of suspend with duplicate falling call
This commit is contained in:
parent
952a90bfde
commit
5a059379b2
2 changed files with 14 additions and 20 deletions
|
@ -387,25 +387,14 @@ local function on_step_work (self, dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:falling(pos) then return end
|
if self:falling(pos) then return end
|
||||||
|
if self:step_damage (dtime, 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.state == "die" then return end
|
if self.state == "die" then return end
|
||||||
-- End: Death/damage processing
|
-- 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()
|
self:check_water_flow()
|
||||||
|
|
||||||
if not self._jumping_cliff then
|
if not self._jumping_cliff then
|
||||||
|
|
|
@ -820,11 +820,19 @@ function mob_class:do_env_damage()
|
||||||
return self:check_for_death("unknown", {type = "unknown"})
|
return self:check_for_death("unknown", {type = "unknown"})
|
||||||
end
|
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)
|
-- environmental damage timer (every 1 second)
|
||||||
self.env_damage_timer = self.env_damage_timer + dtime
|
self.env_damage_timer = self.env_damage_timer + dtime
|
||||||
|
|
||||||
|
|
||||||
if self.env_damage_timer > 1 then
|
if self.env_damage_timer > 1 then
|
||||||
self.env_damage_timer = 0
|
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_acceleration(vector.zero())
|
||||||
self.object:set_velocity(vector.zero())
|
self.object:set_velocity(vector.zero())
|
||||||
end
|
end
|
||||||
if acc.y == 0 and node_under == "air" then
|
|
||||||
self:falling(pos)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue