From f04ffea579b6a85ed784ad566b8b7e9abb28ad6c Mon Sep 17 00:00:00 2001 From: Dystopian Date: Tue, 30 Jan 2018 00:42:22 +0300 Subject: [PATCH 1/2] Add lock check --- addons/aircraft/functions/fnc_canShowEject.sqf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/aircraft/functions/fnc_canShowEject.sqf b/addons/aircraft/functions/fnc_canShowEject.sqf index 095a787cb74..f1d014206d1 100644 --- a/addons/aircraft/functions/fnc_canShowEject.sqf +++ b/addons/aircraft/functions/fnc_canShowEject.sqf @@ -16,18 +16,22 @@ */ #include "script_component.hpp" -#define FULLCREW_UNIT 0 -#define FULLCREW_ROLE 1 -#define FULLCREW_TURRETPATH 3 - params ["_unit", "_vehicle"]; _vehicle == vehicle _unit +&& {2 > locked _vehicle} && { private _ejectVarName = ""; { - if (_unit == _x select FULLCREW_UNIT) exitWith { - _ejectVarName = format [QGVAR(ejectAction_%1_%2), _x select FULLCREW_ROLE, _x select FULLCREW_TURRETPATH]; + if (_unit == _x select 0) exitWith { + _x params ["", "_role", "_cargoIndex", "_turretPath"]; + if (switch (toLower _role) do { + case "driver": {!lockedDriver _vehicle}; + case "cargo": {!(_vehicle lockedCargo _cargoIndex)}; + default {!(_vehicle lockedTurret _turretPath)}; + }) then { + _ejectVarName = format [QGVAR(ejectAction_%1_%2), _role, _turretPath]; + }; }; } count fullCrew _vehicle; _vehicle getVariable [_ejectVarName, false] From 5ea2f235496066c385e07ae00a18a763ac240edc Mon Sep 17 00:00:00 2001 From: Dystopian Date: Tue, 30 Jan 2018 00:48:44 +0300 Subject: [PATCH 2/2] Delete seat lock check --- addons/aircraft/functions/fnc_canShowEject.sqf | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/addons/aircraft/functions/fnc_canShowEject.sqf b/addons/aircraft/functions/fnc_canShowEject.sqf index f1d014206d1..b0803a49df9 100644 --- a/addons/aircraft/functions/fnc_canShowEject.sqf +++ b/addons/aircraft/functions/fnc_canShowEject.sqf @@ -16,6 +16,10 @@ */ #include "script_component.hpp" +#define FULLCREW_UNIT 0 +#define FULLCREW_ROLE 1 +#define FULLCREW_TURRETPATH 3 + params ["_unit", "_vehicle"]; _vehicle == vehicle _unit @@ -23,15 +27,8 @@ _vehicle == vehicle _unit && { private _ejectVarName = ""; { - if (_unit == _x select 0) exitWith { - _x params ["", "_role", "_cargoIndex", "_turretPath"]; - if (switch (toLower _role) do { - case "driver": {!lockedDriver _vehicle}; - case "cargo": {!(_vehicle lockedCargo _cargoIndex)}; - default {!(_vehicle lockedTurret _turretPath)}; - }) then { - _ejectVarName = format [QGVAR(ejectAction_%1_%2), _role, _turretPath]; - }; + if (_unit == _x select FULLCREW_UNIT) exitWith { + _ejectVarName = format [QGVAR(ejectAction_%1_%2), _x select FULLCREW_ROLE, _x select FULLCREW_TURRETPATH]; }; } count fullCrew _vehicle; _vehicle getVariable [_ejectVarName, false]