From 9489ff6965f0d1432e4fe61259cf6ed4319d2583 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sun, 6 Dec 2020 08:55:17 +0000 Subject: [PATCH] add option to spin mob when playing death animation --- api.lua | 4 +++- api.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index 3dbc0ea..530a852 100644 --- a/api.lua +++ b/api.lua @@ -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") diff --git a/api.txt b/api.txt index 6c09a1f..e8014ed 100644 --- a/api.txt +++ b/api.txt @@ -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.