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),
|
["ACE3 Vehicles", QGVAR(speedLimiter), localize LSTRING(SpeedLimiter),
|
||||||
{
|
{
|
||||||
private _connectedUAV = getConnectedUAV ACE_player;
|
private _connectedUAV = getConnectedUAV ACE_player;
|
||||||
private _uavControll = UAVControl _connectedUAV;
|
private _uavControl = UAVControl _connectedUAV;
|
||||||
if ((_uavControll select 1) == "DRIVER") then {
|
if ((_uavControl select 1) == "DRIVER") then {
|
||||||
if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false};
|
if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false};
|
||||||
GVAR(isUAV) = true;
|
GVAR(isUAV) = true;
|
||||||
[_uavControll select 0, _connectedUAV] call FUNC(speedLimiter);
|
[_uavControl select 0, _connectedUAV] call FUNC(speedLimiter);
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !(ACE_player == driver vehicle ACE_player &&
|
private _vehicle = vehicle ACE_player;
|
||||||
{vehicle ACE_player isKindOf 'Car' ||
|
if (
|
||||||
{vehicle ACE_player isKindOf 'Tank'}}) exitWith {false};
|
ACE_player != driver _vehicle
|
||||||
|
|| {-1 == ["Car", "Tank", "Ship"] findIf {_vehicle isKindOf _x}}
|
||||||
|
) exitWith {false};
|
||||||
|
|
||||||
GVAR(isUAV) = false;
|
GVAR(isUAV) = false;
|
||||||
// Statement
|
// Statement
|
||||||
[ACE_player, vehicle ACE_player] call FUNC(speedLimiter);
|
[ACE_player, _vehicle] call FUNC(speedLimiter);
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -32,27 +34,28 @@ GVAR(isSpeedLimiter) = false;
|
|||||||
|
|
||||||
["ACE3 Vehicles", QGVAR(cruiseControl), localize LSTRING(CruiseControl), {
|
["ACE3 Vehicles", QGVAR(cruiseControl), localize LSTRING(CruiseControl), {
|
||||||
private _connectedUAV = getConnectedUAV ACE_player;
|
private _connectedUAV = getConnectedUAV ACE_player;
|
||||||
private _uavControll = UAVControl _connectedUAV;
|
private _uavControl = UAVControl _connectedUAV;
|
||||||
if ((_uavControll select 1) == "DRIVER") then {
|
if ((_uavControl select 1) == "DRIVER") then {
|
||||||
if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false};
|
if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false};
|
||||||
GVAR(isUAV) = true;
|
GVAR(isUAV) = true;
|
||||||
[_uavControll select 0, _connectedUAV, true] call FUNC(speedLimiter);
|
[_uavControl select 0, _connectedUAV, true] call FUNC(speedLimiter);
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
// Conditions: canInteract
|
// Conditions: canInteract
|
||||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
// Conditions: specific
|
// Conditions: specific
|
||||||
if !(ACE_player == driver vehicle ACE_player &&
|
private _vehicle = vehicle ACE_player;
|
||||||
{vehicle ACE_player isKindOf 'Car' ||
|
if (
|
||||||
{vehicle ACE_player isKindOf 'Tank'} ||
|
ACE_player != driver _vehicle
|
||||||
{vehicle ACE_player isKindOf 'Plane'}}) exitWith {false};
|
|| {-1 == ["Car", "Tank", "Ship", "Plane"] findIf {_vehicle isKindOf _x}}
|
||||||
|
) exitWith {false};
|
||||||
|
|
||||||
GVAR(isUAV) = false;
|
GVAR(isUAV) = false;
|
||||||
// Statement
|
// Statement
|
||||||
if (vehicle ACE_player isKindOf 'Plane') then {
|
if (_vehicle isKindOf "Plane") then {
|
||||||
[ACE_player, vehicle ACE_player] call FUNC(autoThrottle);
|
[ACE_player, _vehicle] call FUNC(autoThrottle);
|
||||||
} else {
|
} else {
|
||||||
[ACE_player, vehicle ACE_player, true] call FUNC(speedLimiter);
|
[ACE_player, _vehicle, true] call FUNC(speedLimiter);
|
||||||
};
|
};
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
@ -67,8 +67,8 @@ GVAR(speedLimitInit) = true;
|
|||||||
_args params ["_driver", "_vehicle"];
|
_args params ["_driver", "_vehicle"];
|
||||||
|
|
||||||
if (GVAR(isUAV)) then {
|
if (GVAR(isUAV)) then {
|
||||||
private _uavControll = UAVControl _vehicle;
|
private _uavControl = UAVControl _vehicle;
|
||||||
if ((_uavControll select 0) != _driver || _uavControll select 1 != "DRIVER") then {
|
if ((_uavControl select 0) != _driver || _uavControl select 1 != "DRIVER") then {
|
||||||
GVAR(isSpeedLimiter) = false;
|
GVAR(isSpeedLimiter) = false;
|
||||||
TRACE_1("UAV driver changed, disabling speedlimit",_vehicle);
|
TRACE_1("UAV driver changed, disabling speedlimit",_vehicle);
|
||||||
_vehicle setCruiseControl [0, false];
|
_vehicle setCruiseControl [0, false];
|
||||||
|
Loading…
Reference in New Issue
Block a user