From 1c0811aa31707e0928d4521f9ad861d9570e5fdc Mon Sep 17 00:00:00 2001 From: ViperMaul Date: Fri, 12 Jun 2015 16:56:13 -0700 Subject: [PATCH] Change from globalEvent to targetEvent #1575 and #1577 --- .../functions/fnc_unloadPersonLocal.sqf | 46 ++++++++++--------- .../functions/fnc_actionUnloadUnit.sqf | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index ec6229dab8..5ebe35a439 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -15,22 +15,39 @@ #define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) -private ["_vehicle", "_loaded", "_emptyPos"]; -PARAMS_1(_unit); -_vehicle = vehicle _unit; -TRACE_1("Unloading Unit Variable", _unit); +private ["_loaded", "_emptyPos"]; +PARAMS_2(_unit,_vehicle); -if (_vehicle == _unit) exitwith {false;}; +if (driver _vehicle == _unit) exitwith {false;}; +TRACE_1("Vehicle Check", driver _vehicle == _unit); if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;}; _emptyPos = ((getPos _vehicle) findEmptyPosition [0, 10, typeof _unit]); if (count _emptyPos == 0) exitwith {false}; -_unit setPos _emptyPos; unassignVehicle _unit; [_unit] orderGetIn false; TRACE_1("Ejecting", alive _unit); _unit action ["Eject", vehicle _unit]; +[ { + private "_anim"; + PARAMS_2(_unit,_emptyPos); + _unit setPos _emptyPos; + if (!([_unit] call FUNC(isAwake))) then { + TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake)); + if (driver _unit == _unit) then { + _anim = [_unit] call EFUNC(common,getDeathAnim); + [_unit, _anim, 1, true] call EFUNC(common,doAnimation); + [{ + _unit = _this select 0; + _anim = _this select 1; + if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { + [_unit, _anim, 2, true] call EFUNC(common,doAnimation); + }; + }, [_unit, _anim], 0.5, 0] call EFUNC(common,waitAndExecute); + }; + }; +},[_unit,_emptyPos], 0.5, 0] call EFUNC(common,waitAndExecute); [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); @@ -39,19 +56,4 @@ _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded = _loaded - [_unit]; _vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; -if (!([_unit] call FUNC(isAwake))) then { - TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake)); - if (driver _unit == _unit) then { - _anim = [_unit] call EFUNC(common,getDeathAnim); - [_unit, _anim, 1, true] call EFUNC(common,doAnimation); - [{ - _unit = _this select 0; - _anim = _this select 1; - if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { - [_unit, _anim, 2, true] call EFUNC(common,doAnimation); - }; - }, [_unit, _anim], 0.5, 0] call EFUNC(common,waitAndExecute); - }; -}; - -true; +true \ No newline at end of file diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index c5057d52a6..a73f32265a 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -24,4 +24,4 @@ _drag = if (count _this > 2) then {_this select 2} else {false}; if (vehicle _target == _target) exitwith {}; if (([_target] call EFUNC(common,isAwake))) exitwith {}; -["unloadPersonEvent",[_target]] call EFUNC(common,globalEvent) \ No newline at end of file +["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) \ No newline at end of file