mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
don't do flying animation while perching,fix anims
This commit is contained in:
parent
14ec1aa014
commit
86bc398a79
2 changed files with 35 additions and 35 deletions
|
@ -363,6 +363,35 @@ local remove_texture_mod = function(self, mod)
|
||||||
self.object:set_texture_mod(full_mod)
|
self.object:set_texture_mod(full_mod)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- are we flying in what we are suppose to? (taikedz)
|
||||||
|
local flight_check = function(self)
|
||||||
|
|
||||||
|
local nod = self.standing_in
|
||||||
|
local def = minetest.registered_nodes[nod]
|
||||||
|
|
||||||
|
if not def then return false end -- nil check
|
||||||
|
|
||||||
|
local fly_in
|
||||||
|
if type(self.fly_in) == "string" then
|
||||||
|
fly_in = { self.fly_in }
|
||||||
|
elseif type(self.fly_in) == "table" then
|
||||||
|
fly_in = self.fly_in
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
for _,checknode in pairs(fly_in) do
|
||||||
|
if nod == checknode then
|
||||||
|
return true
|
||||||
|
elseif checknode == "__airlike" or def.walkable == false and
|
||||||
|
(def.liquidtype == "none" or minetest.get_item_group(nod, "fake_liquid") == 1) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
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 or not anim then
|
||||||
|
@ -372,6 +401,8 @@ local set_animation = function(self, anim, fixed_frame)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if flight_check(self) and self.fly and anim == "walk" then anim = "fly" 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
|
||||||
|
@ -513,37 +544,6 @@ local line_of_sight = function(self, pos1, pos2, stepsize)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- are we flying in what we are suppose to? (taikedz)
|
|
||||||
local flight_check = function(self)
|
|
||||||
|
|
||||||
local nod = self.standing_in
|
|
||||||
local def = minetest.registered_nodes[nod]
|
|
||||||
|
|
||||||
if not def then return false end -- nil check
|
|
||||||
|
|
||||||
local fly_in
|
|
||||||
if type(self.fly_in) == "string" then
|
|
||||||
fly_in = { self.fly_in }
|
|
||||||
elseif type(self.fly_in) == "table" then
|
|
||||||
fly_in = self.fly_in
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
for _,checknode in pairs(fly_in) do
|
|
||||||
if nod == checknode then
|
|
||||||
return true
|
|
||||||
elseif checknode == "__airlike" and def.walkable == false and
|
|
||||||
(def.liquidtype == "none" or minetest.get_item_group(nod, "fake_liquid") == 1) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- custom particle effects
|
-- custom particle effects
|
||||||
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down)
|
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow, go_down)
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,12 @@ mcl_mobs:register_mob("mobs_mc:parrot", {
|
||||||
stand_speed = 50,
|
stand_speed = 50,
|
||||||
walk_speed = 50,
|
walk_speed = 50,
|
||||||
fly_speed = 50,
|
fly_speed = 50,
|
||||||
stand_start = 30,
|
stand_start = 0,
|
||||||
stand_end = 45,
|
stand_end = 0,
|
||||||
fly_start = 30,
|
fly_start = 30,
|
||||||
fly_end = 45,
|
fly_end = 45,
|
||||||
walk_start = 30,
|
walk_start = 0,
|
||||||
walk_end = 45,
|
walk_end = 20,
|
||||||
-- TODO: actual walk animation
|
-- TODO: actual walk animation
|
||||||
--walk_start = 0,
|
--walk_start = 0,
|
||||||
--walk_end = 20,
|
--walk_end = 20,
|
||||||
|
|
Loading…
Reference in a new issue