forked from mtcontrib/mobs_redo
added die animation (thx npxcoot)
This commit is contained in:
parent
f9737e1f4f
commit
dd04be9749
34
api.lua
34
api.lua
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
-- Mobs Api (1st December 2016)
|
-- Mobs Api (2nd December 2016)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
|
@ -195,6 +195,19 @@ set_animation = function(self, type)
|
||||||
|
|
||||||
self.animation.current = "shoot"
|
self.animation.current = "shoot"
|
||||||
end
|
end
|
||||||
|
elseif type == "die"
|
||||||
|
and self.animation.current ~= "die" then
|
||||||
|
|
||||||
|
if self.animation.die_start
|
||||||
|
and self.animation.die_end then
|
||||||
|
|
||||||
|
self.object:set_animation({
|
||||||
|
x = self.animation.die_start,
|
||||||
|
y = self.animation.die_end},
|
||||||
|
(self.animation.speed_die or self.animation.speed_normal), 0)
|
||||||
|
|
||||||
|
self.animation.current = "die"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -370,8 +383,25 @@ function check_for_death(self)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- default death function
|
-- default death function and die animation (if defined)
|
||||||
|
if self.animation.die_start
|
||||||
|
and self.animation.die_end then
|
||||||
|
|
||||||
|
self.attack = nil
|
||||||
|
self.v_start = false
|
||||||
|
self.timer = 0
|
||||||
|
self.blinktimer = 0
|
||||||
|
self.passive = true
|
||||||
|
self.state = "die"
|
||||||
|
set_velocity(self, 0)
|
||||||
|
set_animation(self, "die")
|
||||||
|
|
||||||
|
minetest.after(1, function(self)
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
end, self)
|
||||||
|
else
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
|
||||||
effect(pos, 20, "tnt_smoke.png")
|
effect(pos, 20, "tnt_smoke.png")
|
||||||
|
|
||||||
|
|
3
api.txt
3
api.txt
|
@ -115,11 +115,14 @@ This functions registers a new mob as a Minetest entity.
|
||||||
'punch2_end' end frame of alt.punch animation
|
'punch2_end' end frame of alt.punch animation
|
||||||
'shoot_start' start frame of shoot animation
|
'shoot_start' start frame of shoot animation
|
||||||
'shoot_end' end frame of shoot animation
|
'shoot_end' end frame of shoot animation
|
||||||
|
'die_start' start frame of die animation
|
||||||
|
'die_end' end frame of die animation
|
||||||
'speed_normal' normal animation speed
|
'speed_normal' normal animation speed
|
||||||
'speed_run' running animation speed
|
'speed_run' running animation speed
|
||||||
'speed_punch' punching animation speed
|
'speed_punch' punching animation speed
|
||||||
'speed_punch2' alternative punching animation speed
|
'speed_punch2' alternative punching animation speed
|
||||||
'speed_shoot' shooting animation speed
|
'speed_shoot' shooting animation speed
|
||||||
|
'speed_die' die animation speed
|
||||||
'replace_what' group if items to replace e.g. {"farming:wheat_8", "farming:carrot_8"}
|
'replace_what' group if items to replace e.g. {"farming:wheat_8", "farming:carrot_8"}
|
||||||
'replace_with' replace with what e.g. "air" or in chickens case "mobs:egg"
|
'replace_with' replace with what e.g. "air" or in chickens case "mobs:egg"
|
||||||
'replace_rate' how random should the replace rate be (typically 10)
|
'replace_rate' how random should the replace rate be (typically 10)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user