From c003c2e72b2c70595476cbd5fd63da1539776f50 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Fri, 21 Oct 2022 11:56:54 +0100 Subject: [PATCH] fix smooth rotation jitters --- api.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/api.lua b/api.lua index f87221c..08524bb 100644 --- a/api.lua +++ b/api.lua @@ -27,7 +27,7 @@ local use_cmi = minetest.global_exists("cmi") mobs = { mod = "redo", - version = "20221015", + version = "20221021", intllib = S, invis = minetest.global_exists("invisibility") and invisibility or {} } @@ -359,6 +359,16 @@ function mob_class:set_yaw(yaw, delay) yaw = 0 end + -- clamp our yaw to a 360 range + if math.deg(self.object:get_yaw()) > 360 then + + yaw = rad(10) ; delay = 0 + + elseif math.deg(self.object:get_yaw()) < 0 then + + yaw = rad(350) ; delay = 0 + end + delay = mob_smooth_rotate and (delay or 0) or 0 if delay == 0 then