use api functions for riding mob

This commit is contained in:
tenplus1 2023-10-13 08:31:55 +01:00
parent 71e620eb0f
commit 768ef84bd8
3 changed files with 6 additions and 6 deletions

View File

@ -3493,7 +3493,7 @@ function mob_class:on_step(dtime, moveresult)
self.pause_timer = self.pause_timer - dtime
if self.pause_timer <= 0 and self.order == "stand" then
if self.pause_timer < 0 and self.order == "stand" then
self.pause_timer = 0
self:set_velocity(0)

View File

@ -344,7 +344,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
if entity.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
if stand_anim then
mobs:set_animation(entity, stand_anim)
entity:set_animation(stand_anim)
end
return
@ -352,7 +352,7 @@ function mobs.drive(entity, moving_anim, stand_anim, can_fly, dtime)
-- set moving animation
if moving_anim then
mobs:set_animation(entity, moving_anim)
entity:set_animation(moving_anim)
end
-- Stop!
@ -518,9 +518,9 @@ function mobs.fly(entity, _, speed, shoots, arrow, moving_anim, stand_anim)
-- change animation if stopped
if velo.x == 0 and velo.y == 0 and velo.z == 0 then
mobs:set_animation(entity, stand_anim)
entity:set_animation(stand_anim)
else
-- moving animation
mobs:set_animation(entity, moving_anim)
entity:set_animation(moving_anim)
end
end

View File

@ -106,7 +106,7 @@ https://forum.minetest.net/viewtopic.php?f=11&t=9917
### Version 1.48
* Added `mobs:set_velocity(self, velocity)` global function
* Added `mobs:set_velocity(self, velocity)` global function [deprecated]
### Version 1.47