From a4825a3332e1a231c1437c436fd7dc331b6ccd24 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 28 Oct 2024 21:26:44 -0500 Subject: [PATCH] Fix cart pitch when detached --- mods/ENTITIES/mcl_minecarts/carts.lua | 5 +++-- mods/ENTITIES/mcl_minecarts/movement.lua | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/carts.lua b/mods/ENTITIES/mcl_minecarts/carts.lua index a4c46dba3..c4749153e 100644 --- a/mods/ENTITIES/mcl_minecarts/carts.lua +++ b/mods/ENTITIES/mcl_minecarts/carts.lua @@ -341,11 +341,12 @@ function DEFAULT_CART_DEF:on_step(dtime) end end + if not staticdata.connected_at then do_detached_movement(self, dtime) + else + mod.update_cart_orientation(self) end - - mod.update_cart_orientation(self) end function DEFAULT_CART_DEF:on_death(killer) kill_cart(self._staticdata, killer) diff --git a/mods/ENTITIES/mcl_minecarts/movement.lua b/mods/ENTITIES/mcl_minecarts/movement.lua index 5a8f023ed..49feb8e9e 100644 --- a/mods/ENTITIES/mcl_minecarts/movement.lua +++ b/mods/ENTITIES/mcl_minecarts/movement.lua @@ -572,6 +572,12 @@ local function do_detached_movement(self, dtime) return end end + + -- Reset pitch if still not attached + local rot = self.object:get_rotation() + minetest.log(vector.to_string(rot)) + rot.x = 0 + self.object:set_rotation(rot) end --return do_movement, do_detatched_movement