From 276c2fc0ceb73fdaddcb4f936d6f436aa9ac841a Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sat, 29 Jul 2017 15:45:19 +0100 Subject: [PATCH] update death animation timers --- api.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api.lua b/api.lua index cb3d779..2846ec6 100644 --- a/api.lua +++ b/api.lua @@ -1,9 +1,9 @@ --- Mobs Api (26th July 2017) +-- Mobs Api (30th July 2017) mobs = {} mobs.mod = "redo" -mobs.version = "20170726" +mobs.version = "20170730" -- Intllib @@ -439,6 +439,10 @@ local check_for_death = function(self, cause, cmi_cause) and self.animation.die_start and self.animation.die_end then + local frames = self.animation.die_end - self.animation.die_start + local speed = self.animation.die_speed or 15 + local length = max(frames / speed, 0) + self.attack = nil self.v_start = false self.timer = 0 @@ -448,7 +452,7 @@ local check_for_death = function(self, cause, cmi_cause) set_velocity(self, 0) set_animation(self, "die") - minetest.after(2, function(self) + minetest.after(length, function(self) if use_cmi then cmi.notify_die(self.object, cmi_cause)