diff --git a/addons/vehicles/XEH_postInit.sqf b/addons/vehicles/XEH_postInit.sqf index 2e54b2ea84..3afea03187 100644 --- a/addons/vehicles/XEH_postInit.sqf +++ b/addons/vehicles/XEH_postInit.sqf @@ -18,7 +18,7 @@ GVAR(isSpeedLimiter) = false; if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific if !(ACE_player == driver vehicle ACE_player && - {vehicle ACE_player isKindOf 'Car' || + {vehicle ACE_player isKindOf 'Car' || {vehicle ACE_player isKindOf 'Tank'}}) exitWith {false}; GVAR(isUAV) = false; @@ -30,3 +30,19 @@ GVAR(isSpeedLimiter) = false; }, {false}, [211, [false, false, false]], false] call CBA_fnc_addKeybind; //DELETE Key + +["ACE3 Vehicles", QGVAR(scrollUp), localize LSTRING(IncreaseSpeedLimit), { + if (GVAR(isSpeedLimiter)) then { + GVAR(speedLimit) = round (GVAR(speedLimit) + 1) max 5; + [["%1: %2", LSTRING(SpeedLimit), GVAR(speedLimit)]] call EFUNC(common,displayTextStructured); + true + }; +}, {false}, [MOUSE_SCROLL_UP, [false, true, false]], false] call CBA_fnc_addKeybind; // Ctrl + Mouse Wheel Scroll Up + +["ACE3 Vehicles", QGVAR(scrollDown), localize LSTRING(DecreaseSpeedLimit), { + if (GVAR(isSpeedLimiter)) then { + GVAR(speedLimit) = round (GVAR(speedLimit) - 1) max 5; + [["%1: %2", LSTRING(SpeedLimit), GVAR(speedLimit)]] call EFUNC(common,displayTextStructured); + true + }; +}, {false}, [MOUSE_SCROLL_DOWN, [false, true, false]], false] call CBA_fnc_addKeybind; // Ctrl + Mouse Wheel Scroll Down diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index d84bdfff9f..07af1dd4c3 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -28,11 +28,11 @@ if (GVAR(isSpeedLimiter)) exitWith { playSound "ACE_Sound_Click"; GVAR(isSpeedLimiter) = true; -private _maxSpeed = speed _vehicle max 5; +GVAR(speedLimit) = speed _vehicle max 5; [{ params ["_args", "_idPFH"]; - _args params ["_driver", "_vehicle", "_maxSpeed"]; + _args params ["_driver", "_vehicle"]; if (GVAR(isUAV)) then { private _uavControll = UAVControl _vehicle; @@ -51,8 +51,8 @@ private _maxSpeed = speed _vehicle max 5; private _speed = speed _vehicle; - if (_speed > _maxSpeed) then { - _vehicle setVelocity ((velocity _vehicle) vectorMultiply ((_maxSpeed / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning + if (_speed > GVAR(speedLimit)) then { + _vehicle setVelocity ((velocity _vehicle) vectorMultiply ((GVAR(speedLimit) / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning }; -} , 0, [_driver, _vehicle, _maxSpeed]] call CBA_fnc_addPerFrameHandler; +}, 0, [_driver, _vehicle]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/vehicles/script_component.hpp b/addons/vehicles/script_component.hpp index 49de85f0ba..b985da6632 100644 --- a/addons/vehicles/script_component.hpp +++ b/addons/vehicles/script_component.hpp @@ -16,5 +16,8 @@ #include "\z\ace\addons\main\script_macros.hpp" +#define MOUSE_SCROLL_UP 0xF8 +#define MOUSE_SCROLL_DOWN 0xF9 + #define FUEL_FACTOR 0.165 // fuel capacity = range in km * FUEL_FACTOR #define STARTUP_DELAY 1.3 diff --git a/addons/vehicles/stringtable.xml b/addons/vehicles/stringtable.xml index 36ff7f99e6..d7f141c66a 100644 --- a/addons/vehicles/stringtable.xml +++ b/addons/vehicles/stringtable.xml @@ -33,6 +33,9 @@ 停用速度限制 停用速度限制 + + Speed Limit + Speed Limiter Begrenzer @@ -49,5 +52,11 @@ 速度限制器 速度限制器 + + Increase Speed Limit + + + Decrease Speed Limit +