Skip to content

Commit

Permalink
fix deceleration if vehicle gets stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCraymer committed Jan 22, 2022
1 parent 5699a68 commit beb1911
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DrivingStickCruiseControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function DrivingStickCruiseControl:onUpdate(dt, isActiveForInput, isActiveForInp
spec.decelerationEnabled = false
elseif spec.decelerateInputValue > 0 and spec.decelerationEnabled then
spec.targetSpeed = spec.targetSpeed - spec.speedChangeStep
if spec.targetSpeed > lastSpeed then
if lastSpeed > 1 and spec.targetSpeed > lastSpeed then
spec.targetSpeed = math.floor(lastSpeed)
end
elseif spec.accelerateInputValue > spec.accelerateAxisThreshold then -- full forward
Expand Down

0 comments on commit beb1911

Please sign in to comment.