add check for 'injured' animation

This commit is contained in:
tenplus1 2023-03-13 11:52:59 +00:00
parent 0c2ddab172
commit 7e585b0bdc
2 changed files with 5 additions and 2 deletions

View File

@ -3036,8 +3036,8 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
-- turn mob on knockback and play run/walk animation
self:set_yaw((random(0, 360) - 180) / 180 * pi, 12)
if self.animation and self.animation.run_end then
self:set_animation("run")
if self.animation and self.animation.injured_end and damage >= 1 then
self:set_animation("injured")
else
self:set_animation("walk")
end

View File

@ -249,6 +249,9 @@ functions needed for the mob to work properly which contains the following:
'shoot_start' shooting animation.
'shoot_end'
'shoot_speed'
'injured_start' when hit or damaged > 1 hp (if not set then 'walk' is used)
'injured_end'
'injured_speed'
'die_start' death animation
'die_end'
'die_speed'