fix env timer issue
This commit is contained in:
parent
f4aae8894f
commit
0c2ddab172
29
api.lua
29
api.lua
@ -3479,6 +3479,20 @@ function mob_class:on_step(dtime, moveresult)
|
|||||||
self.object:set_yaw(yaw)
|
self.object:set_yaw(yaw)
|
||||||
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
|
||||||
|
|
||||||
|
-- check for environmental damage (water, fire, lava etc.)
|
||||||
|
if self:do_env_damage() then return end
|
||||||
|
|
||||||
|
-- node replace check (cow eats grass etc.)
|
||||||
|
self:replace(pos)
|
||||||
|
end
|
||||||
|
|
||||||
-- knockback timer
|
-- knockback timer
|
||||||
if self.pause_timer > 0 then
|
if self.pause_timer > 0 then
|
||||||
|
|
||||||
@ -3518,21 +3532,6 @@ function mob_class:on_step(dtime, moveresult)
|
|||||||
self:mob_sound(self.sounds.random)
|
self:mob_sound(self.sounds.random)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- environmental damage timer (every 1 second)
|
|
||||||
self.env_damage_timer = self.env_damage_timer + dtime
|
|
||||||
|
|
||||||
if (self.state == "attack" and self.env_damage_timer > 1)
|
|
||||||
or self.state ~= "attack" then
|
|
||||||
|
|
||||||
self.env_damage_timer = 0
|
|
||||||
|
|
||||||
-- check for environmental damage (water, fire, lava etc.)
|
|
||||||
if self:do_env_damage() then return end
|
|
||||||
|
|
||||||
-- node replace check (cow eats grass etc.)
|
|
||||||
self:replace(pos)
|
|
||||||
end
|
|
||||||
|
|
||||||
self:general_attack()
|
self:general_attack()
|
||||||
|
|
||||||
self:breed()
|
self:breed()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user