From 290e2e9753b5fbf3bae432324b54797978690dd7 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Mon, 30 Dec 2024 18:42:29 -0600 Subject: [PATCH] Fix cart placement so that furnace minecarts will always try to start moving in the direction the player was facing when the cart was placed --- mods/ENTITIES/mcl_minecarts/carts.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/carts.lua b/mods/ENTITIES/mcl_minecarts/carts.lua index afd23924b..ecf9eca7e 100644 --- a/mods/ENTITIES/mcl_minecarts/carts.lua +++ b/mods/ENTITIES/mcl_minecarts/carts.lua @@ -389,8 +389,12 @@ function mod.place_minecart(itemstack, pointed_thing, placer) return end + local look_4dir = math.round(placer:get_look_horizontal() * TWO_OVER_PI) % 4 + local look_dir = core.fourdir_to_dir(look_4dir) + look_dir.x = -look_dir.x + local spawn_pos = pointed_thing.above - local cart_dir = vector.new(1,0,0) + local cart_dir = look_dir local railpos, node if mcl_minecarts.is_rail(pointed_thing.under) then @@ -403,8 +407,8 @@ function mod.place_minecart(itemstack, pointed_thing, placer) node = minetest.get_node(railpos) -- Try two orientations, and select the second if the first is at an angle - cart_dir1 = mcl_minecarts.get_rail_direction(railpos, vector.new( 1,0,0)) - cart_dir2 = mcl_minecarts.get_rail_direction(railpos, vector.new(-1,0,0)) + cart_dir1 = mcl_minecarts.get_rail_direction(railpos, look_dir) + cart_dir2 = mcl_minecarts.get_rail_direction(railpos, -look_dir) if vector.length(cart_dir1) <= 1 then cart_dir = cart_dir1 else