From 524fe37f4a316838c9e0ac029b0d1b5338e38633 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sat, 9 Nov 2024 09:41:08 -0600 Subject: [PATCH] Use correct vectors for look directions east/west --- mods/ENTITIES/mcl_minecarts/movement.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/movement.lua b/mods/ENTITIES/mcl_minecarts/movement.lua index bebdb778f..2cbfe4ec9 100644 --- a/mods/ENTITIES/mcl_minecarts/movement.lua +++ b/mods/ENTITIES/mcl_minecarts/movement.lua @@ -250,6 +250,12 @@ local function direction_away_from_players(staticdata) return 0 end +local look_directions = { + mod.north, + mod.west, + mod.south, + mod.east, +} local function calculate_acceleration(staticdata) local acceleration = 0 @@ -270,7 +276,7 @@ local function calculate_acceleration(staticdata) if (ctrl.forward or 0) > time_active then if staticdata.velocity == 0 then - local look_dir = minetest.facedir_to_dir(ctrl.look or 0) + local look_dir = look_directions[ctrl.look or 0] local dot = vector.dot(staticdata.dir, look_dir) if dot < 0 then reverse_direction(staticdata)