make die animation more smooth for all mobs

This commit is contained in:
epCode 2022-10-14 13:31:18 -07:00 committed by cora
parent ba127ecb12
commit 44ba08cb8b
1 changed files with 6 additions and 3 deletions

View File

@ -1014,9 +1014,6 @@ local check_for_death = function(self, cause, cmi_cause)
length = max(frames / speed, 0) + DEATH_DELAY
set_animation(self, "die")
else
local rot = self.object:get_rotation()
rot.z = pi/2
self.object:set_rotation(rot)
length = 1 + DEATH_DELAY
set_animation(self, "stand", true)
end
@ -3850,6 +3847,12 @@ local mob_step = function(self, dtime)
end
end
if self.state and self.state=="die" or check_for_death(self) then
local rot = self.object:get_rotation()
rot.z = ((pi/2-rot.z)*.2)+rot.z
self.object:set_rotation(rot)
end
if not player_in_active_range(self) then
set_animation(self, "stand", true)
self.object:set_velocity(vector.new(0,0,0))