From 435b3b8b867922ddc0c6ac5ee4d3700809e714ca Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 4 Feb 2015 13:16:19 -0600 Subject: [PATCH] Move Code out of CfgVehicles --- addons/captives/CfgVehicles.hpp | 20 +++---- addons/captives/XEH_preInit.sqf | 16 ++++-- addons/captives/config.cpp | 8 ++- .../functions/fnc_canEscortCaptive.sqf | 24 ++++++++ .../captives/functions/fnc_canFriskPerson.sqf | 2 +- .../captives/functions/fnc_canLoadCaptive.sqf | 4 +- .../functions/fnc_canReleaseCaptive.sqf | 23 ++++++++ .../functions/fnc_canStopEscorting.sqf | 41 ++++++++++++++ .../captives/functions/fnc_canTakeCaptive.sqf | 23 ++++++++ .../functions/fnc_canUnloadCaptive.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 56 +++++++++++++++++++ ...penFriskMenu.sqf => fnc_doFriskPerson.sqf} | 0 ..._loadCaptive.sqf => fnc_doLoadCaptive.sqf} | 4 +- .../functions/fnc_doReleaseCaptive.sqf | 21 +++++++ .../captives/functions/fnc_doTakeCaptive.sqf | 22 ++++++++ ...oadCaptive.sqf => fnc_doUnloadCaptive.sqf} | 2 +- .../captives/functions/fnc_escortCaptive.sqf | 55 ------------------ addons/captives/functions/fnc_handleGetIn.sqf | 4 +- .../captives/functions/fnc_handleGetOut.sqf | 2 +- .../captives/functions/fnc_handleKilled.sqf | 8 +-- .../functions/fnc_handlePlayerChanged.sqf | 2 +- .../functions/fnc_handleUnitInitPost.sqf | 6 +- .../captives/functions/fnc_handleWokeUp.sqf | 2 +- addons/captives/functions/fnc_setCaptive.sqf | 10 ++-- addons/captives/functions/fnc_surrender.sqf | 10 ++-- addons/interaction/config.cpp | 9 --- 26 files changed, 265 insertions(+), 111 deletions(-) create mode 100644 addons/captives/functions/fnc_canEscortCaptive.sqf create mode 100644 addons/captives/functions/fnc_canReleaseCaptive.sqf create mode 100644 addons/captives/functions/fnc_canStopEscorting.sqf create mode 100644 addons/captives/functions/fnc_canTakeCaptive.sqf create mode 100644 addons/captives/functions/fnc_doEscortCaptive.sqf rename addons/captives/functions/{fnc_openFriskMenu.sqf => fnc_doFriskPerson.sqf} (100%) rename addons/captives/functions/{fnc_loadCaptive.sqf => fnc_doLoadCaptive.sqf} (84%) create mode 100644 addons/captives/functions/fnc_doReleaseCaptive.sqf create mode 100644 addons/captives/functions/fnc_doTakeCaptive.sqf rename addons/captives/functions/{fnc_unloadCaptive.sqf => fnc_doUnloadCaptive.sqf} (87%) delete mode 100644 addons/captives/functions/fnc_escortCaptive.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 04b8d4569f..059b07cfb8 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable [ARR_2('ACE_isCaptive', false)])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3('SetCaptive', [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive)); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -15,8 +15,8 @@ class CfgVehicles { class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE(_target getVariable [ARR_2('ACE_isCaptive', false)] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_3('SetCaptive', [_target], [ARR_2(_target, false)])] call EFUNC(common,targetEvent);); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -26,8 +26,8 @@ class CfgVehicles { class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [ARR_2('ACE_isUnconscious', false)])}); - statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); + statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -37,8 +37,8 @@ class CfgVehicles { class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {_target in (attachedObjects _player)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]), false)] call FUNC(_escortCaptive);); + condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 5ff2379c0b..b3de41ae69 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -2,22 +2,28 @@ ADDON = false; +PREP(canEscortCaptive); PREP(canFriskPerson); PREP(canLoadCaptive); +PREP(canReleaseCaptive); +PREP(canStopEscorting); +PREP(canTakeCaptive); PREP(canUnloadCaptive); -PREP(escortCaptive); +PREP(doEscortCaptive); +PREP(doFriskPerson); +PREP(doLoadCaptive); +PREP(doReleaseCaptive); +PREP(doTakeCaptive); +PREP(doUnloadCaptive); PREP(handleGetIn); PREP(handleGetOut); PREP(handleKilled); PREP(handleKnockedOut); PREP(handlePlayerChanged); -PREP(handleWokeUp); PREP(handleUnitInitPost); -PREP(loadCaptive); -PREP(openFriskMenu); +PREP(handleWokeUp); PREP(setCaptive); PREP(surrender); -PREP(unloadCaptive); PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7bef039e37..d7cb36371d 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -17,15 +17,17 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)] + class ACE_canInteractConditions { class GVAR(isNotEscorting) { - condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false))); }; class GVAR(isNotCaptive) { - condition = "!(_player getVariable ['ACE_isCaptive', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false))); }; class GVAR(isNotSurrendering) { - condition = "!(_player getVariable ['ACE_isSurrender', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); }; }; diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf new file mode 100644 index 0000000000..40a3e0d560 --- /dev/null +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Tests if can escort target (attach) + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +(_target getVariable [QGVAR(isCaptive), false]) && +{isNull (attachedTo _target)} && +{alive _target} && +{!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 62d5a06742..6ee44b2af5 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -_target getVariable ["ACE_isCaptive", false] +_target getVariable [QGVAR(isCaptive), false] || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index b8021e602f..a05765b195 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -32,7 +32,7 @@ if (isNull _vehicle) then { _vehicle = _objects select 0; }; -_unit getVariable ["ACE_isEscorting", false] +_unit getVariable [QGVAR(isEscorting), false] && {!isNil "_target"} && {!isNil "_vehicle"} && {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canReleaseCaptive.sqf b/addons/captives/functions/fnc_canReleaseCaptive.sqf new file mode 100644 index 0000000000..50b4c55310 --- /dev/null +++ b/addons/captives/functions/fnc_canReleaseCaptive.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to release a captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +//Unit is captive and not being escorted +_target getVariable [QGVAR(isCaptive), false] && +{isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf new file mode 100644 index 0000000000..4f30e7a82a --- /dev/null +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -0,0 +1,41 @@ +/* + * Author: PabstMirror + * Tests if player can stop escorting + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); +DEFAULT_PARAM(1,_target,objNull); + +private ["_isAttached"]; + + +if (isNull _target) then { + _target = _unit getVariable ["ACE_escortedUnit", objNull]; +}; + +if (isNull _target) exitWith { + ERROR("Null Target (no ACE_escortedUnit)"); + false +}; + +_isAttached = _target in (attachedObjects _unit); + +if (_isAttached && (!(_target getVariable [QGVAR(isCaptive), false]))) exitWith { + ERROR("Attached But Not Captive"); + false +}; + +_isAttached diff --git a/addons/captives/functions/fnc_canTakeCaptive.sqf b/addons/captives/functions/fnc_canTakeCaptive.sqf new file mode 100644 index 0000000000..f67f6110bf --- /dev/null +++ b/addons/captives/functions/fnc_canTakeCaptive.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to take a unit captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +("ACE_CableTie" in (items _unit)) && +{alive _target} && +{!(_target getVariable [QGVAR(isCaptive), false])} diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index b714ebc8ae..1aef4602e1 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -23,6 +23,6 @@ PARAMS_2(_unit,_vehicle); _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); count _cargo > 0 diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf new file mode 100644 index 0000000000..05dc912205 --- /dev/null +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -0,0 +1,56 @@ +/* + * Author: Nic547 + * Attaches a Captive to the _unit + * + * Arguments: + * 0: _unit-Player + * 1: target + * 2: _state + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_unit,_target,_state); + +if !("ACE_Handcuffed" in ([_target] call ACE_Core_fnc_getCaptivityStatus)) exitWith { + [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); +}; + +if (_state) then { + if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; + + [_unit, _target] call EFUNC(common,claim); + _unit setVariable [QGVAR(isEscorting), true, true]; + + _target attachTo [_unit, [0, 1, 0]]; + + _unit setVariable ["ACE_escortedUnit", _target, true]; + _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[_unit getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (_unit getVariable ['ACE_escortedUnit', objNull])"]; + + [_target, _actionID] spawn { + _target = _this select 0; + _actionID = _this select 1; + + while {_unit getVariable [QGVAR(isEscorting), false]} do { + sleep 0.2; + + if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + }; + [objNull, _target] call EFUNC(common,claim); + + detach _target; + _unit removeAction _actionID; + }; +} else { + _unit setVariable [QGVAR(isEscorting), false, true]; + _unit setVariable ["ACE_escortedUnit", objNull, true]; +}; diff --git a/addons/captives/functions/fnc_openFriskMenu.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf similarity index 100% rename from addons/captives/functions/fnc_openFriskMenu.sqf rename to addons/captives/functions/fnc_doFriskPerson.sqf diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf similarity index 84% rename from addons/captives/functions/fnc_loadCaptive.sqf rename to addons/captives/functions/fnc_doLoadCaptive.sqf index 680fee343c..1ef650b4ee 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -21,7 +21,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -31,6 +31,6 @@ if (isNull _vehicle) then { }; if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false, true]; + _unit setVariable [QGVAR(isEscorting), false, true]; ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_doReleaseCaptive.sqf b/addons/captives/functions/fnc_doReleaseCaptive.sqf new file mode 100644 index 0000000000..a807959565 --- /dev/null +++ b/addons/captives/functions/fnc_doReleaseCaptive.sqf @@ -0,0 +1,21 @@ +/* + * Author: PabstMirror + * Release a captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doTakeCaptive.sqf b/addons/captives/functions/fnc_doTakeCaptive.sqf new file mode 100644 index 0000000000..8deb712d09 --- /dev/null +++ b/addons/captives/functions/fnc_doTakeCaptive.sqf @@ -0,0 +1,22 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to take a unit captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_unit removeItem 'ACE_CableTie'; +["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf similarity index 87% rename from addons/captives/functions/fnc_unloadCaptive.sqf rename to addons/captives/functions/fnc_doUnloadCaptive.sqf index 057b825d12..1a6b6a2d0c 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -22,7 +22,7 @@ private ["_cargo", "_target"]; _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); if ((count _cargo) > 0) then { _target = _cargo select 0; diff --git a/addons/captives/functions/fnc_escortCaptive.sqf b/addons/captives/functions/fnc_escortCaptive.sqf deleted file mode 100644 index c3030a9d33..0000000000 --- a/addons/captives/functions/fnc_escortCaptive.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Nic547 - * Attaches a Captive to the player - * - * Arguments: - * 0: _unit - * 1: _state - * - * Return Value: - * The return value - * - * Example: - * - - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_unit,_state); - -if !("ACE_Handcuffed" in ([_unit] call ACE_Core_fnc_getCaptivityStatus)) exitWith { - [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); -}; - -if (_state) then { - if (player getVariable ["ACE_isEscorting", false]) exitWith {}; - - [player, _unit] call EFUNC(common,claim); - player setVariable ["ACE_isEscorting", true, true]; - - _unit attachTo [player, [0, 1, 0]]; - - player setVariable ["ACE_escortedUnit", _unit, true]; - _actionID = player addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['ACE_escortedUnit', objNull])"]; - - [_unit, _actionID] spawn { - _unit = _this select 0; - _actionID = _this select 1; - - while {player getVariable ["ACE_isEscorting", false]} do { - sleep 0.2; - - if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["ACE_isUnconscious", false]} || {player getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo player)}) then { - player setVariable ["ACE_isEscorting", false, true]; - }; - }; - [objNull, _unit] call EFUNC(common,claim); - - detach _unit; - player removeAction _actionID; - }; -} else { - player setVariable ["ACE_isEscorting", false, true]; - player setVariable ["ACE_escortedUnit", objNull, true]; -}; diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index dc0b5aa5af..eb3a9ad8b1 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -19,6 +19,6 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then { - _unit setVariable ["ACE_isEscorting", false, true]; +if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then { + _unit setVariable [QGVAR(isEscorting), false, true]; }; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 82e6417eab..84c856ed39 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,7 +19,7 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then { +if ((local _unit)&&(_unit getVariable [QGVAR(isCaptive), false])) then { private ["_cargoIndex"]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 2d476f662c..6e41fa801a 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -17,10 +17,10 @@ PARAMS_1(_oldUnit); -if (_oldUnit getVariable ["ACE_isCaptive", false]) then { - _oldUnit setVariable ["ACE_isCaptive", false, true]; +if (_oldUnit getVariable [QGVAR(isCaptive), false]) then { + _oldUnit setVariable [QGVAR(isCaptive), false, true]; }; -if (_oldUnit getVariable ["ACE_isEscorting", false]) then { - _oldUnit setVariable ["ACE_isEscorting", false, true] +if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { + _oldUnit setVariable [QGVAR(isEscorting), false, true] }; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index f23e380dd3..d7efa70a5f 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_oldUnit); -if (_unit getVariable ["ACE_isCaptive", false]) then { +if (_unit getVariable [QGVAR(isCaptive), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 97362b1b96..a0e76c0a10 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -18,12 +18,12 @@ PARAMS_1(_unit); // prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isCaptive), false]}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start - if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; + if (_unit getVariable [QGVAR(isCaptive), false]) then { + _unit setVariable [QGVAR(isCaptive), false]; [_unit, true] call FUNC(setCaptive); }; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index ea6a1bcb26..2973aa7f83 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { +if (_unit getVariable [QGVAR(isCaptive), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf index b4c047dd1b..eca34b3bac 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -21,15 +21,15 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", true, true]; + _unit setVariable [QGVAR(isCaptive), true, true]; // fix anim on mission start (should work on dedicated servers) _unit spawn { [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; - if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then { [_this] call EFUNC(common,fixLoweredRifleAnimation); [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); }; @@ -41,9 +41,9 @@ if (_state) then { showHUD false; }; } else { - if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", false, true]; + _unit setVariable [QGVAR(isCaptive), false, true]; [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 92f0ea416a..3d3b65ec49 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -21,9 +21,9 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; + if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; - _unit setVariable ["ACE_isSurrender", true, true]; + _unit setVariable [QGVAR(isSurrender), true, true]; [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; _unit spawn { @@ -32,13 +32,13 @@ if (_state) then { _this playMove "amovpercmstpsraswrfldnon"; }; - while {_this getVariable ["ACE_isSurrender", false]} do { + while {_this getVariable [QGVAR(isSurrender), false]} do { sleep 0.001; //sleep in UI if (isPlayer _this) then {showHUD false}; if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable ["ACE_isSurrender", false, true]; + _this setVariable [QGVAR(isSurrender), false, true]; } else { _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; }; @@ -54,7 +54,7 @@ if (_state) then { if (isPlayer _this) then {showHUD true}; }; } else { - _unit setVariable ["ACE_isSurrender", false, true]; + _unit setVariable [QGVAR(isSurrender), false, true]; }; /* diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index acb41d362f..3b53855eef 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -38,15 +38,6 @@ class ACE_Parameters_Boolean { }; class ACE_canInteractConditions { - class GVAR(isNotEscorting) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isEscorting', false)]) ); - }; - class GVAR(isNotCaptive) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isCaptive', false)]) ); - }; - class GVAR(isNotSurrendering) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isSurrender', false)]) ); - }; class GVAR(isNotSwimming) { condition = QUOTE( !underwater ACE_player ); };