mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-25 02:00:21 +01:00
add check for 'injured' animation
This commit is contained in:
parent
0c2ddab172
commit
7e585b0bdc
4
api.lua
4
api.lua
@ -3036,8 +3036,8 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir, damage)
|
|||||||
-- turn mob on knockback and play run/walk animation
|
-- turn mob on knockback and play run/walk animation
|
||||||
self:set_yaw((random(0, 360) - 180) / 180 * pi, 12)
|
self:set_yaw((random(0, 360) - 180) / 180 * pi, 12)
|
||||||
|
|
||||||
if self.animation and self.animation.run_end then
|
if self.animation and self.animation.injured_end and damage >= 1 then
|
||||||
self:set_animation("run")
|
self:set_animation("injured")
|
||||||
else
|
else
|
||||||
self:set_animation("walk")
|
self:set_animation("walk")
|
||||||
end
|
end
|
||||||
|
3
api.txt
3
api.txt
@ -249,6 +249,9 @@ functions needed for the mob to work properly which contains the following:
|
|||||||
'shoot_start' shooting animation.
|
'shoot_start' shooting animation.
|
||||||
'shoot_end'
|
'shoot_end'
|
||||||
'shoot_speed'
|
'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_start' death animation
|
||||||
'die_end'
|
'die_end'
|
||||||
'die_speed'
|
'die_speed'
|
||||||
|
Loading…
Reference in New Issue
Block a user