Vehicles - Mousewheel will set speed limiter value to even multiples (#8840)

* Vehicles - Mousewheel will set speed limiter value to multiples of 5

* Limit setting to whole numbers only
This commit is contained in:
PabstMirror 2022-03-17 13:03:28 -05:00 committed by GitHub
parent f85ed213c5
commit 70f3f55367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -39,6 +39,7 @@ GVAR(isSpeedLimiter) = false;
["ACE3 Vehicles", QGVAR(scrollUp), localize LSTRING(IncreaseSpeedLimit), { ["ACE3 Vehicles", QGVAR(scrollUp), localize LSTRING(IncreaseSpeedLimit), {
if (GVAR(isSpeedLimiter)) then { if (GVAR(isSpeedLimiter)) then {
GVAR(speedLimit) = round (GVAR(speedLimit) + GVAR(speedLimiterStep)) max (5 max GVAR(speedLimiterStep)); GVAR(speedLimit) = round (GVAR(speedLimit) + GVAR(speedLimiterStep)) max (5 max GVAR(speedLimiterStep));
GVAR(speedLimit) = 5 max GVAR(speedLimiterStep) * floor (GVAR(speedLimit) / GVAR(speedLimiterStep));
[["%1: %2", LSTRING(SpeedLimit), GVAR(speedLimit)]] call EFUNC(common,displayTextStructured); [["%1: %2", LSTRING(SpeedLimit), GVAR(speedLimit)]] call EFUNC(common,displayTextStructured);
true true
}; };
@ -47,6 +48,7 @@ GVAR(isSpeedLimiter) = false;
["ACE3 Vehicles", QGVAR(scrollDown), localize LSTRING(DecreaseSpeedLimit), { ["ACE3 Vehicles", QGVAR(scrollDown), localize LSTRING(DecreaseSpeedLimit), {
if (GVAR(isSpeedLimiter)) then { if (GVAR(isSpeedLimiter)) then {
GVAR(speedLimit) = round (GVAR(speedLimit) - GVAR(speedLimiterStep)) max (5 max GVAR(speedLimiterStep)); GVAR(speedLimit) = round (GVAR(speedLimit) - GVAR(speedLimiterStep)) max (5 max GVAR(speedLimiterStep));
GVAR(speedLimit) = 5 max GVAR(speedLimiterStep) * ceil (GVAR(speedLimit) / GVAR(speedLimiterStep));
[["%1: %2", LSTRING(SpeedLimit), GVAR(speedLimit)]] call EFUNC(common,displayTextStructured); [["%1: %2", LSTRING(SpeedLimit), GVAR(speedLimit)]] call EFUNC(common,displayTextStructured);
true true
}; };

View File

@ -25,5 +25,5 @@
"SLIDER", "SLIDER",
LSTRING(SpeedLimiterStep), LSTRING(SpeedLimiterStep),
ELSTRING(common,ACEKeybindCategoryVehicles), ELSTRING(common,ACEKeybindCategoryVehicles),
[1, 10, 5, 0] [1, 10, 5, -1] // whole numbers only
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;