select proper animation for flying mobs
This commit is contained in:
parent
dd16d63e8e
commit
6f8b6fe3f5
15
api.lua
15
api.lua
@ -28,7 +28,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20220430",
|
version = "20220501",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||||
}
|
}
|
||||||
@ -2389,11 +2389,22 @@ function mob_class:do_states(dtime)
|
|||||||
else
|
else
|
||||||
self:set_velocity(self.walk_velocity)
|
self:set_velocity(self.walk_velocity)
|
||||||
|
|
||||||
|
-- figure out which animation to use while in motion
|
||||||
if self:flight_check()
|
if self:flight_check()
|
||||||
and self.animation
|
and self.animation
|
||||||
and self.animation.fly_start
|
and self.animation.fly_start
|
||||||
and self.animation.fly_end then
|
and self.animation.fly_end then
|
||||||
self:set_animation("fly")
|
|
||||||
|
local on_ground = minetest.registered_nodes[self.standing_on].walkable
|
||||||
|
local in_water = minetest.registered_nodes[self.standing_in].groups.water
|
||||||
|
|
||||||
|
if on_ground and in_water then
|
||||||
|
self:set_animation("fly")
|
||||||
|
elseif on_ground then
|
||||||
|
self:set_animation("walk")
|
||||||
|
else
|
||||||
|
self:set_animation("fly")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self:set_animation("walk")
|
self:set_animation("walk")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user