From ac23e9f7ddbc9f348e694edea81e1b6ca6e296e7 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 14 May 2022 11:55:10 +0200 Subject: [PATCH] Add 0.4.x support --- init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index e965688..0808ae1 100644 --- a/init.lua +++ b/init.lua @@ -239,7 +239,12 @@ function handle_player_animations(dtime, player) local lag_behind = diff - moving_diff local attach_parent, _, _, attach_rotation = player:get_attach() if attach_parent then - local parent_rotation = attach_parent:get_rotation() + local parent_rotation + if attach_parent.get_rotation then + parent_rotation = attach_parent:get_rotation() + else -- 0.4.x doesn't have get_rotation(), only yaw + parent_rotation = {x = 0, y = attach_parent:get_yaw(), z = 0} + end if attach_rotation and parent_rotation then parent_rotation = vector.apply(parent_rotation, math.deg) local total_rotation = normalize_rotation(vector.subtract(attach_rotation, parent_rotation))