mirror of
https://github.com/SmallJoker/boost_cart.git
synced 2024-11-27 17:03:44 +01:00
Fix controls not working when going uphill
This commit is contained in:
parent
7e275e1985
commit
34155473a9
@ -107,7 +107,17 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
|
|||||||
right.z = -dir.x
|
right.z = -dir.x
|
||||||
end
|
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
|
if old_switch == 1 then
|
||||||
left_check = false
|
left_check = false
|
||||||
elseif old_switch == 2 then
|
elseif old_switch == 2 then
|
||||||
@ -130,10 +140,12 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Normal
|
-- Normal
|
||||||
|
if not straight_priority then
|
||||||
cur = self:check_front_up_down(pos, dir, true, railtype)
|
cur = self:check_front_up_down(pos, dir, true, railtype)
|
||||||
if cur then
|
if cur then
|
||||||
return cur
|
return cur
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Left, if not already checked
|
-- Left, if not already checked
|
||||||
if left_check then
|
if left_check then
|
||||||
|
Loading…
Reference in New Issue
Block a user