mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-29 22:11:10 +01:00
Add in mobs api swimming animation
This commit is contained in:
parent
f2e909ab8d
commit
8783912938
1 changed files with 7 additions and 10 deletions
|
@ -213,12 +213,6 @@ local swim_turn_check = function(self,dtime)
|
||||||
return(green_flag_1)
|
return(green_flag_1)
|
||||||
end
|
end
|
||||||
|
|
||||||
--this is going to need some more logic gates because birds can flop around
|
|
||||||
--REMOVE THIS - just dump mobs.flop into where this was
|
|
||||||
local flop = function(self,dtime)
|
|
||||||
mobs.flop(self)
|
|
||||||
end
|
|
||||||
|
|
||||||
--this is to swap the built in engine acceleration modifier
|
--this is to swap the built in engine acceleration modifier
|
||||||
local swim_physics_swapper = function(self,inside_swim_node)
|
local swim_physics_swapper = function(self,inside_swim_node)
|
||||||
|
|
||||||
|
@ -260,7 +254,7 @@ local swim_state_execution = function(self,dtime)
|
||||||
if self.state == "stand" then
|
if self.state == "stand" then
|
||||||
|
|
||||||
--do animation
|
--do animation
|
||||||
--mobs.set_mob_animation(self, "stand")
|
mobs.set_mob_animation(self, "stand")
|
||||||
|
|
||||||
mobs.set_swim_velocity(self,0)
|
mobs.set_swim_velocity(self,0)
|
||||||
|
|
||||||
|
@ -281,6 +275,8 @@ local swim_state_execution = function(self,dtime)
|
||||||
self.pitch = math_random() * random_pitch_multiplier[math_random(1,2)]
|
self.pitch = math_random() * random_pitch_multiplier[math_random(1,2)]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--do animation
|
||||||
|
mobs.set_mob_animation(self, "walk")
|
||||||
|
|
||||||
--do a quick turn to make mob continuously move
|
--do a quick turn to make mob continuously move
|
||||||
--if in a fish tank or something
|
--if in a fish tank or something
|
||||||
|
@ -288,13 +284,14 @@ local swim_state_execution = function(self,dtime)
|
||||||
quick_rotate(self,dtime)
|
quick_rotate(self,dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
mobs.set_swim_velocity(self,self.walk_velocity)
|
mobs.set_swim_velocity(self,self.walk_velocity)
|
||||||
end
|
end
|
||||||
--flop around if not inside swim node
|
--flop around if not inside swim node
|
||||||
else
|
else
|
||||||
--print("flopping")
|
--do animation
|
||||||
flop(self,dtime)
|
mobs.set_mob_animation(self, "stand")
|
||||||
|
|
||||||
|
mobs.flop(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue