Minor captive cleanup

This commit is contained in:
PabstMirror 2015-04-25 16:03:21 -05:00
parent 898d6c74a8
commit ca980379c8
2 changed files with 6 additions and 13 deletions

View File

@ -101,25 +101,20 @@ class CfgVehicles {
#define MACRO_LOADUNLOADCAPTIVE \
class ACE_Actions { \
class ACE_MainActions { \
selection = ""; \
class ACE_LoadCaptive { \
class GVAR(LoadCaptive) { \
displayName = "$STR_ACE_Captives_LoadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \
statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \
exceptions[] = {"isNotEscorting"}; \
showDisabled = 0; \
priority = 1.2; \
hotkey = "L"; \
}; \
class ACE_UnloadCaptive { \
class GVAR(UnloadCaptive) { \
displayName = "$STR_ACE_Captives_UnloadCaptive"; \
distance = 4; \
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \
showDisabled = 0; \
priority = 1.2; \
hotkey = "C"; \
}; \
}; \
};

View File

@ -22,7 +22,7 @@ PARAMS_3(_unit,_target,_state);
if (_state) then {
if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {};
[_unit, _target] call EFUNC(common,claim);
[_unit, _target, false] call EFUNC(common,claim);
_unit setVariable [QGVAR(isEscorting), true, true];
_target attachTo [_unit, [0, 1, 0]];
@ -34,8 +34,7 @@ if (_state) then {
{[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);},
nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))];
private "_escortFnc";
_escortFnc = {
[{
EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID);
if (_unit getVariable [QGVAR(isEscorting), false]) then {
if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then {
@ -45,13 +44,12 @@ if (_state) then {
if (!(_unit getVariable [QGVAR(isEscorting), false])) then {
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[objNull, _target] call EFUNC(common,claim);
[objNull, _target, false] call EFUNC(common,claim);
detach _target;
_unit removeAction _actionID;
_unit setVariable [QGVAR(escortedUnit), objNull, true];
};
};
[_escortFnc, 0, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
}, 0, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler;
} else {
_unit setVariable [QGVAR(isEscorting), false, true];