Auto Speed: Fix the bug that prevents it to cut off when applying feet brake

This commit is contained in:
Sidi Liang 2020-07-29 13:29:40 +08:00
parent c860865912
commit 9e212661f2
No known key found for this signature in database
GPG Key ID: 79F0A6B20B72F42F
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ var throttleNode = props.getNode("/controls/engines/engine/throttle",1);
var lastDeltaSpeed = 0;
var autoSpeedMainLoop = func(){
if(leftBrakes.getValue() == 1 or rightBrakes.getValue() == 1 or throttleNode.getValue() == 1){ #//Stop if full brakes or full throttle are manually applied
if(leftBrakes.getValue() >= 0.8 or rightBrakes.getValue() >= 0.8 or throttleNode.getValue() == 1){ #//Stop if full brakes or full throttle are manually applied
throttleNode.setValue(0);
stopAutoSpeed();
}
@ -23,7 +23,7 @@ var autoSpeedMainLoop = func(){
throttle = calculateThrottle(deltaSpeed / targetSpeed); #// Max throttle 0.9
}else if(deltaSpeed <= -1.852){
throttle = 0;
brakes = ((0 - deltaSpeed) / targetSpeed) - 0.2; #// Max brake 0.8
brakes = ((0 - deltaSpeed) / targetSpeed) - 0.21; #// Max brake 0.79
}else{
throttle = 0;
}