mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Vehicles - Add cruise control/speed limiter to boats (#8905)
* Add cruise control to boats * fix other use of `Controll` Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
c66304daf9
commit
3a7f034e25
@ -7,23 +7,25 @@ GVAR(isSpeedLimiter) = false;
|
||||
["ACE3 Vehicles", QGVAR(speedLimiter), localize LSTRING(SpeedLimiter),
|
||||
{
|
||||
private _connectedUAV = getConnectedUAV ACE_player;
|
||||
private _uavControll = UAVControl _connectedUAV;
|
||||
if ((_uavControll select 1) == "DRIVER") then {
|
||||
private _uavControl = UAVControl _connectedUAV;
|
||||
if ((_uavControl select 1) == "DRIVER") then {
|
||||
if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false};
|
||||
GVAR(isUAV) = true;
|
||||
[_uavControll select 0, _connectedUAV] call FUNC(speedLimiter);
|
||||
[_uavControl select 0, _connectedUAV] call FUNC(speedLimiter);
|
||||
true
|
||||
} else {
|
||||
// Conditions: canInteract
|
||||
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 'Tank'}}) exitWith {false};
|
||||
private _vehicle = vehicle ACE_player;
|
||||
if (
|
||||
ACE_player != driver _vehicle
|
||||
|| {-1 == ["Car", "Tank", "Ship"] findIf {_vehicle isKindOf _x}}
|
||||
) exitWith {false};
|
||||
|
||||
GVAR(isUAV) = false;
|
||||
// Statement
|
||||
[ACE_player, vehicle ACE_player] call FUNC(speedLimiter);
|
||||
[ACE_player, _vehicle] call FUNC(speedLimiter);
|
||||
true
|
||||
};
|
||||
},
|
||||
@ -32,27 +34,28 @@ GVAR(isSpeedLimiter) = false;
|
||||
|
||||
["ACE3 Vehicles", QGVAR(cruiseControl), localize LSTRING(CruiseControl), {
|
||||
private _connectedUAV = getConnectedUAV ACE_player;
|
||||
private _uavControll = UAVControl _connectedUAV;
|
||||
if ((_uavControll select 1) == "DRIVER") then {
|
||||
private _uavControl = UAVControl _connectedUAV;
|
||||
if ((_uavControl select 1) == "DRIVER") then {
|
||||
if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false};
|
||||
GVAR(isUAV) = true;
|
||||
[_uavControll select 0, _connectedUAV, true] call FUNC(speedLimiter);
|
||||
[_uavControl select 0, _connectedUAV, true] call FUNC(speedLimiter);
|
||||
true
|
||||
} else {
|
||||
// Conditions: canInteract
|
||||
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 'Tank'} ||
|
||||
{vehicle ACE_player isKindOf 'Plane'}}) exitWith {false};
|
||||
private _vehicle = vehicle ACE_player;
|
||||
if (
|
||||
ACE_player != driver _vehicle
|
||||
|| {-1 == ["Car", "Tank", "Ship", "Plane"] findIf {_vehicle isKindOf _x}}
|
||||
) exitWith {false};
|
||||
|
||||
GVAR(isUAV) = false;
|
||||
// Statement
|
||||
if (vehicle ACE_player isKindOf 'Plane') then {
|
||||
[ACE_player, vehicle ACE_player] call FUNC(autoThrottle);
|
||||
if (_vehicle isKindOf "Plane") then {
|
||||
[ACE_player, _vehicle] call FUNC(autoThrottle);
|
||||
} else {
|
||||
[ACE_player, vehicle ACE_player, true] call FUNC(speedLimiter);
|
||||
[ACE_player, _vehicle, true] call FUNC(speedLimiter);
|
||||
};
|
||||
true
|
||||
};
|
||||
|
@ -67,8 +67,8 @@ GVAR(speedLimitInit) = true;
|
||||
_args params ["_driver", "_vehicle"];
|
||||
|
||||
if (GVAR(isUAV)) then {
|
||||
private _uavControll = UAVControl _vehicle;
|
||||
if ((_uavControll select 0) != _driver || _uavControll select 1 != "DRIVER") then {
|
||||
private _uavControl = UAVControl _vehicle;
|
||||
if ((_uavControl select 0) != _driver || _uavControl select 1 != "DRIVER") then {
|
||||
GVAR(isSpeedLimiter) = false;
|
||||
TRACE_1("UAV driver changed, disabling speedlimit",_vehicle);
|
||||
_vehicle setCruiseControl [0, false];
|
||||
|
Loading…
Reference in New Issue
Block a user