Move Code out of CfgVehicles

This commit is contained in:
PabstMirror 2015-02-04 13:16:19 -06:00
parent 11cd426b87
commit 435b3b8b86
26 changed files with 265 additions and 111 deletions

View File

@ -5,8 +5,8 @@ class CfgVehicles {
class ACE_SetCaptive { class ACE_SetCaptive {
displayName = "$STR_ACE_Captives_SetCaptive"; displayName = "$STR_ACE_Captives_SetCaptive";
distance = 4; distance = 4;
condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable [ARR_2('ACE_isCaptive', false)])}); condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive));
statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3('SetCaptive', [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive));
showDisabled = 0; showDisabled = 0;
priority = 2.4; priority = 2.4;
icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); icon = QUOTE(PATHTOF(UI\handcuff_ca.paa));
@ -15,8 +15,8 @@ class CfgVehicles {
class ACE_ReleaseCaptive { class ACE_ReleaseCaptive {
displayName = "$STR_ACE_Captives_ReleaseCaptive"; displayName = "$STR_ACE_Captives_ReleaseCaptive";
distance = 4; distance = 4;
condition = QUOTE(_target getVariable [ARR_2('ACE_isCaptive', false)] && {isNull (attachedTo _target)}); condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive));
statement = QUOTE([ARR_3('SetCaptive', [_target], [ARR_2(_target, false)])] call EFUNC(common,targetEvent);); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive));
exceptions[] = {"ACE_Interaction_isNotEscorting"}; exceptions[] = {"ACE_Interaction_isNotEscorting"};
showDisabled = 0; showDisabled = 0;
priority = 2.4; priority = 2.4;
@ -26,8 +26,8 @@ class CfgVehicles {
class ACE_EscortCaptive { class ACE_EscortCaptive {
displayName = "$STR_ACE_Captives_EscortCaptive"; displayName = "$STR_ACE_Captives_EscortCaptive";
distance = 4; distance = 4;
condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [ARR_2('ACE_isUnconscious', false)])}); condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive));
statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive));
exceptions[] = {"ACE_Interaction_isNotEscorting"}; exceptions[] = {"ACE_Interaction_isNotEscorting"};
showDisabled = 0; showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa)); icon = QUOTE(PATHTOF(UI\captive_ca.paa));
@ -37,8 +37,8 @@ class CfgVehicles {
class ACE_StopEscorting { class ACE_StopEscorting {
displayName = "$STR_ACE_Captives_StopEscorting"; displayName = "$STR_ACE_Captives_StopEscorting";
distance = 4; distance = 4;
condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {_target in (attachedObjects _player)}); condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting));
statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive));
exceptions[] = {"ACE_Interaction_isNotEscorting"}; exceptions[] = {"ACE_Interaction_isNotEscorting"};
showDisabled = 0; showDisabled = 0;
icon = QUOTE(PATHTOF(UI\captive_ca.paa)); icon = QUOTE(PATHTOF(UI\captive_ca.paa));
@ -71,8 +71,8 @@ class CfgVehicles {
class ACE_SelfActions { class ACE_SelfActions {
class ACE_StopEscortingSelf { class ACE_StopEscortingSelf {
displayName = "$STR_ACE_Captives_StopEscorting"; 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}); condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting));
statement = QUOTE([ARR_2((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]), false)] call FUNC(_escortCaptive);); statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive));
exceptions[] = {"ACE_Interaction_isNotEscorting"}; exceptions[] = {"ACE_Interaction_isNotEscorting"};
showDisabled = 0; showDisabled = 0;
priority = 2.3; priority = 2.3;

View File

@ -2,22 +2,28 @@
ADDON = false; ADDON = false;
PREP(canEscortCaptive);
PREP(canFriskPerson); PREP(canFriskPerson);
PREP(canLoadCaptive); PREP(canLoadCaptive);
PREP(canReleaseCaptive);
PREP(canStopEscorting);
PREP(canTakeCaptive);
PREP(canUnloadCaptive); PREP(canUnloadCaptive);
PREP(escortCaptive); PREP(doEscortCaptive);
PREP(doFriskPerson);
PREP(doLoadCaptive);
PREP(doReleaseCaptive);
PREP(doTakeCaptive);
PREP(doUnloadCaptive);
PREP(handleGetIn); PREP(handleGetIn);
PREP(handleGetOut); PREP(handleGetOut);
PREP(handleKilled); PREP(handleKilled);
PREP(handleKnockedOut); PREP(handleKnockedOut);
PREP(handlePlayerChanged); PREP(handlePlayerChanged);
PREP(handleWokeUp);
PREP(handleUnitInitPost); PREP(handleUnitInitPost);
PREP(loadCaptive); PREP(handleWokeUp);
PREP(openFriskMenu);
PREP(setCaptive); PREP(setCaptive);
PREP(surrender); PREP(surrender);
PREP(unloadCaptive);
PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveIn);
PREP(vehicleCaptiveMoveOut); PREP(vehicleCaptiveMoveOut);

View File

@ -17,15 +17,17 @@ class CfgPatches {
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "CfgWeapons.hpp" #include "CfgWeapons.hpp"
#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)]
class ACE_canInteractConditions { class ACE_canInteractConditions {
class GVAR(isNotEscorting) { class GVAR(isNotEscorting) {
condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])"; condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false)));
}; };
class GVAR(isNotCaptive) { class GVAR(isNotCaptive) {
condition = "!(_player getVariable ['ACE_isCaptive', false])"; condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false)));
}; };
class GVAR(isNotSurrendering) { class GVAR(isNotSurrendering) {
condition = "!(_player getVariable ['ACE_isSurrender', false])"; condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false)));
}; };
}; };

View File

@ -0,0 +1,24 @@
/*
* Author: PabstMirror
* Tests if can escort target (attach)
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT><OPTIONAL>
*
* Return Value:
* The return value <BOOL>
*
* 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])}

View File

@ -18,6 +18,6 @@
PARAMS_2(_unit,_target); PARAMS_2(_unit,_target);
_target getVariable ["ACE_isCaptive", false] _target getVariable [QGVAR(isCaptive), false]
|| {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isSearchable", false]}
|| {_target getVariable ["ACE_isUnconscious", false]} || {_target getVariable ["ACE_isUnconscious", false]}

View File

@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle);
if (isNull _target) then { if (isNull _target) then {
_objects = attachedObjects _unit; _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; _target = _objects select 0;
}; };
@ -32,7 +32,7 @@ if (isNull _vehicle) then {
_vehicle = _objects select 0; _vehicle = _objects select 0;
}; };
_unit getVariable ["ACE_isEscorting", false] _unit getVariable [QGVAR(isEscorting), false]
&& {!isNil "_target"} && {!isNil "_target"}
&& {!isNil "_vehicle"} && {!isNil "_vehicle"}
&& {_vehicle emptyPositions "cargo" > 0} && {_vehicle emptyPositions "cargo" > 0}

View File

@ -0,0 +1,23 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to release a captive
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* 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)}

View File

@ -0,0 +1,41 @@
/*
* Author: PabstMirror
* Tests if player can stop escorting
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT><OPTIONAL>
*
* Return Value:
* The return value <BOOL>
*
* 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

View File

@ -0,0 +1,23 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to take a unit captive
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* -
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
("ACE_CableTie" in (items _unit)) &&
{alive _target} &&
{!(_target getVariable [QGVAR(isCaptive), false])}

View File

@ -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 = 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 count _cargo > 0

View File

@ -0,0 +1,56 @@
/*
* Author: Nic547
* Attaches a Captive to the _unit
*
* Arguments:
* 0: _unit-Player <OBJECT>
* 1: target <OBJECT>
* 2: _state <BOOL>
*
* Return Value:
* The return value <BOOL>
*
* 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 ["<t color='#FF0000'>%1</t>", 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];
};

View File

@ -21,7 +21,7 @@ PARAMS_3(_unit,_target,_vehicle);
if (isNull _target) then { if (isNull _target) then {
_objects = attachedObjects _unit; _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; _target = _objects select 0;
}; };
@ -31,6 +31,6 @@ if (isNull _vehicle) then {
}; };
if ((!isNil "_target") && {!isNil "_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); ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent);
}; };

View File

@ -0,0 +1,21 @@
/*
* Author: PabstMirror
* Release a captive
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* -
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent);

View File

@ -0,0 +1,22 @@
/*
* Author: PabstMirror
* Checks the conditions for being able to take a unit captive
*
* Arguments:
* 0: caller (player) <OBJECT>
* 1: target <OBJECT>
*
* Return Value:
* The return value <BOOL>
*
* Example:
* -
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_unit,_target);
_unit removeItem 'ACE_CableTie';
["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent);

View File

@ -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 = 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 { if ((count _cargo) > 0) then {
_target = _cargo select 0; _target = _cargo select 0;

View File

@ -1,55 +0,0 @@
/*
* Author: Nic547
* Attaches a Captive to the player
*
* Arguments:
* 0: _unit <OBJECT>
* 1: _state <BOOL>
*
* Return Value:
* The return value <BOOL>
*
* 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 ["<t color='#FF0000'>%1</t>", 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];
};

View File

@ -19,6 +19,6 @@
PARAMS_3(_vehicle,_dontcare,_unit); PARAMS_3(_vehicle,_dontcare,_unit);
if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then { if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then {
_unit setVariable ["ACE_isEscorting", false, true]; _unit setVariable [QGVAR(isEscorting), false, true];
}; };

View File

@ -19,7 +19,7 @@
PARAMS_3(_vehicle,_dontcare,_unit); 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"]; private ["_cargoIndex"];

View File

@ -17,10 +17,10 @@
PARAMS_1(_oldUnit); PARAMS_1(_oldUnit);
if (_oldUnit getVariable ["ACE_isCaptive", false]) then { if (_oldUnit getVariable [QGVAR(isCaptive), false]) then {
_oldUnit setVariable ["ACE_isCaptive", false, true]; _oldUnit setVariable [QGVAR(isCaptive), false, true];
}; };
if (_oldUnit getVariable ["ACE_isEscorting", false]) then { if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
_oldUnit setVariable ["ACE_isEscorting", false, true] _oldUnit setVariable [QGVAR(isEscorting), false, true]
}; };

View File

@ -18,7 +18,7 @@
PARAMS_2(_unit,_oldUnit); PARAMS_2(_unit,_oldUnit);
if (_unit getVariable ["ACE_isCaptive", false]) then { if (_unit getVariable [QGVAR(isCaptive), false]) then {
showHUD false; showHUD false;
} else { } else {
showHUD true; showHUD true;

View File

@ -18,12 +18,12 @@
PARAMS_1(_unit); PARAMS_1(_unit);
// prevent players from throwing grenades // 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 { if (local _unit) then {
// reset status on mission start // reset status on mission start
if (_unit getVariable ["ACE_isCaptive", false]) then { if (_unit getVariable [QGVAR(isCaptive), false]) then {
_unit setVariable ["ACE_isCaptive", false]; _unit setVariable [QGVAR(isCaptive), false];
[_unit, true] call FUNC(setCaptive); [_unit, true] call FUNC(setCaptive);
}; };
}; };

View File

@ -17,7 +17,7 @@
PARAMS_1(_unit); 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] call EFUNC(common,fixLoweredRifleAnimation);
[_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation);
}; };

View File

@ -21,15 +21,15 @@ PARAMS_2(_unit,_state);
if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
if (_state) then { 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) // fix anim on mission start (should work on dedicated servers)
_unit spawn { _unit spawn {
[_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; [_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] call EFUNC(common,fixLoweredRifleAnimation);
[_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation);
}; };
@ -41,9 +41,9 @@ if (_state) then {
showHUD false; showHUD false;
}; };
} else { } 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; [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus;
if (vehicle _unit == _unit) then { if (vehicle _unit == _unit) then {
[_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);

View File

@ -21,9 +21,9 @@ PARAMS_2(_unit,_state);
if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc};
if (_state) then { 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, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus;
_unit spawn { _unit spawn {
@ -32,13 +32,13 @@ if (_state) then {
_this playMove "amovpercmstpsraswrfldnon"; _this playMove "amovpercmstpsraswrfldnon";
}; };
while {_this getVariable ["ACE_isSurrender", false]} do { while {_this getVariable [QGVAR(isSurrender), false]} do {
sleep 0.001; //sleep in UI sleep 0.001; //sleep in UI
if (isPlayer _this) then {showHUD false}; if (isPlayer _this) then {showHUD false};
if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then {
_this setVariable ["ACE_isSurrender", false, true]; _this setVariable [QGVAR(isSurrender), false, true];
} else { } else {
_this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon";
}; };
@ -54,7 +54,7 @@ if (_state) then {
if (isPlayer _this) then {showHUD true}; if (isPlayer _this) then {showHUD true};
}; };
} else { } else {
_unit setVariable ["ACE_isSurrender", false, true]; _unit setVariable [QGVAR(isSurrender), false, true];
}; };
/* /*

View File

@ -38,15 +38,6 @@ class ACE_Parameters_Boolean {
}; };
class ACE_canInteractConditions { 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) { class GVAR(isNotSwimming) {
condition = QUOTE( !underwater ACE_player ); condition = QUOTE( !underwater ACE_player );
}; };