Fix more death animation bugs
This commit is contained in:
parent
57e24fc705
commit
21310aad59
|
@ -10,6 +10,7 @@ local HORNY_TIME = 30
|
||||||
local HORNY_AGAIN_TIME = 300
|
local HORNY_AGAIN_TIME = 300
|
||||||
local CHILD_GROW_TIME = 60*20
|
local CHILD_GROW_TIME = 60*20
|
||||||
local DEATH_DELAY = 0.5
|
local DEATH_DELAY = 0.5
|
||||||
|
local DEFAULT_FALL_SPEED = -10
|
||||||
|
|
||||||
local MOB_CAP = {}
|
local MOB_CAP = {}
|
||||||
MOB_CAP.hostile = 70
|
MOB_CAP.hostile = 70
|
||||||
|
@ -336,15 +337,18 @@ end
|
||||||
|
|
||||||
-- set defined animation
|
-- set defined animation
|
||||||
local set_animation = function(self, anim, fixed_frame)
|
local set_animation = function(self, anim, fixed_frame)
|
||||||
|
if not self.animation or not anim then
|
||||||
if not self.animation
|
return
|
||||||
or not anim then return end
|
end
|
||||||
|
if self.state == "die" and anim ~= "die" and anim ~= "stand" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
self.animation.current = self.animation.current or ""
|
self.animation.current = self.animation.current or ""
|
||||||
|
|
||||||
if anim == self.animation.current
|
if (anim == self.animation.current
|
||||||
or not self.animation[anim .. "_start"]
|
or not self.animation[anim .. "_start"]
|
||||||
or not self.animation[anim .. "_end"] then
|
or not self.animation[anim .. "_end"]) and self.state ~= "die" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -770,6 +774,7 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
end
|
end
|
||||||
|
|
||||||
if on_die_exit == true then
|
if on_die_exit == true then
|
||||||
|
self.state = "die"
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -780,6 +785,21 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
collisionbox = table.copy(self.collisionbox)
|
collisionbox = table.copy(self.collisionbox)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
self.state = "die"
|
||||||
|
self.attack = nil
|
||||||
|
self.v_start = false
|
||||||
|
self.fall_speed = DEFAULT_FALL_SPEED
|
||||||
|
self.timer = 0
|
||||||
|
self.blinktimer = 0
|
||||||
|
remove_texture_mod(self, "^[colorize:#FF000040")
|
||||||
|
remove_texture_mod(self, "^[brighten")
|
||||||
|
self.passive = true
|
||||||
|
self.object:set_properties({
|
||||||
|
pointable = false,
|
||||||
|
collide_with_objects = false,
|
||||||
|
})
|
||||||
|
set_velocity(self, 0)
|
||||||
|
|
||||||
local length = 0
|
local length = 0
|
||||||
-- default death function and die animation (if defined)
|
-- default death function and die animation (if defined)
|
||||||
if self.animation
|
if self.animation
|
||||||
|
@ -798,17 +818,7 @@ local check_for_death = function(self, cause, cmi_cause)
|
||||||
set_animation(self, "stand", true)
|
set_animation(self, "stand", true)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.attack = nil
|
|
||||||
self.v_start = false
|
|
||||||
self.timer = 0
|
|
||||||
self.blinktimer = 0
|
|
||||||
self.passive = true
|
|
||||||
self.state = "die"
|
|
||||||
self.object:set_properties({
|
|
||||||
pointable = false,
|
|
||||||
collide_with_objects = false,
|
|
||||||
})
|
|
||||||
set_velocity(self, 0)
|
|
||||||
|
|
||||||
minetest.after(length, function(self)
|
minetest.after(length, function(self)
|
||||||
if not self.object:get_luaentity() then
|
if not self.object:get_luaentity() then
|
||||||
|
@ -3626,7 +3636,7 @@ minetest.register_entity(name, {
|
||||||
fire_damage = def.fire_damage or 1,
|
fire_damage = def.fire_damage or 1,
|
||||||
suffocation = def.suffocation or true,
|
suffocation = def.suffocation or true,
|
||||||
fall_damage = def.fall_damage or 1,
|
fall_damage = def.fall_damage or 1,
|
||||||
fall_speed = def.fall_speed or -10, -- must be lower than -2 (default: -10)
|
fall_speed = def.fall_speed or DEFAULT_FALL_SPEED, -- must be lower than -2
|
||||||
drops = def.drops or {},
|
drops = def.drops or {},
|
||||||
armor = def.armor or 100,
|
armor = def.armor or 100,
|
||||||
on_rightclick = create_mob_on_rightclick(def.on_rightclick),
|
on_rightclick = create_mob_on_rightclick(def.on_rightclick),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user