add option to spin mob when playing death animation

This commit is contained in:
TenPlus1 2020-12-06 08:55:17 +00:00
parent 1dfd7e1af1
commit 9489ff6965
2 changed files with 4 additions and 1 deletions

View File

@ -904,6 +904,7 @@ function mob_class:check_for_death(cmi_cause)
local frames = self.animation.die_end - self.animation.die_start
local speed = self.animation.die_speed or 15
local length = max((frames / speed), 0)
local rot = self.animation.die_rotate and 5
self.attack = nil
self.v_start = false
@ -912,7 +913,8 @@ function mob_class:check_for_death(cmi_cause)
self.passive = true
self.state = "die"
self.object:set_properties({
pointable = false, collide_with_objects = false
pointable = false, collide_with_objects = false,
automatic_rotate = rot,
})
self:set_velocity(0)
self:set_animation("die")

View File

@ -226,6 +226,7 @@ functions needed for the mob to work properly which contains the following:
'die_end'
'die_speed'
'die_loop' when set to false stops the animation looping.
'die_rotate' if true mob spins during death animation.
Using '_loop = false' setting will stop any of the above animations from
looping.