From 34155473a939c25fe72f950a91df1f511762acde Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 4 Jul 2018 22:04:55 +0200 Subject: [PATCH] Fix controls not working when going uphill --- functions.lua | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/functions.lua b/functions.lua index cf5fafd..b77deea 100644 --- a/functions.lua +++ b/functions.lua @@ -107,7 +107,17 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) right.z = -dir.x end - if ctrl and dir.y == 0 then + local straight_priority = ctrl and dir.y ~= 0 + + -- Normal, to disallow rail switching up- & downhill + if straight_priority then + cur = self:check_front_up_down(pos, dir, true, railtype) + if cur then + return cur + end + end + + if ctrl then if old_switch == 1 then left_check = false elseif old_switch == 2 then @@ -130,9 +140,11 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) end -- Normal - cur = self:check_front_up_down(pos, dir, true, railtype) - if cur then - return cur + if not straight_priority then + cur = self:check_front_up_down(pos, dir, true, railtype) + if cur then + return cur + end end -- Left, if not already checked