fix the delay timing when a unit switch to Captive (#5338)

This commit is contained in:
Joko 2017-10-10 18:30:31 +02:00 committed by PabstMirror
parent 842311e836
commit 3a0fd5cae3

View File

@ -56,7 +56,7 @@ if (_unit == ACE_player) then {
// if we have unconsciousness for AI disabled, we will kill the unit instead
private _isDead = false;
if (!([_unit, GVAR(remoteControlledAI)] call EFUNC(common,isPlayer)) && !_force) then {
_enableUncon = _unit getVariable [QGVAR(enableUnconsciousnessAI), GVAR(enableUnconsciousnessAI)];
private _enableUncon = _unit getVariable [QGVAR(enableUnconsciousnessAI), GVAR(enableUnconsciousnessAI)];
if (_enableUncon == 0 or {_enableUncon == 1 and (random 1) < 0.5}) then {
[_unit, true] call FUNC(setDead);
_isDead = true;
@ -99,15 +99,19 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then {
if (GVAR(delayUnconCaptive) == 0) then {
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
} else {
// when the Delay is so high that the unit can wake up and get uncon again we need to check if it is the correct wait that got executed
private _counter = _unit getVariable [QGVAR(unconsciousCounter), 0];
_counter = _counter + 1;
_unit setVariable [QGVAR(unconsciousCounter), _counter];
[{
params ["_unit"];
if (_unit getVariable ["ACE_isUnconscious", false]) then {
params ["_unit", "_counter"];
if (_unit getVariable ["ACE_isUnconscious", false] && (_unit getVariable [QGVAR(unconsciousCounter), 0]) == _counter) then {
[_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set);
};
},[_unit], GVAR(delayUnconCaptive)] call CBA_fnc_waitAndExecute;
},[_unit, _counter], GVAR(delayUnconCaptive)] call CBA_fnc_waitAndExecute;
};
_anim = [_unit] call EFUNC(common,getDeathAnim);
private _anim = [_unit] call EFUNC(common,getDeathAnim);
[_unit, _anim, 1, true] call EFUNC(common,doAnimation);
[{
params ["_unit", "_anim"];