fix animation and consistently unload units from vehicle

#1575 and #1577
This commit is contained in:
ViperMaul 2015-06-11 15:56:11 -07:00
parent eb7a38e137
commit 072f2cc3a7
3 changed files with 20 additions and 5 deletions

View File

@ -20,6 +20,8 @@
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
["unloadPersonEvent", DFUNC(unloadPersonLocal)] call FUNC(addEventhandler);
["lockVehicle", {
_this setVariable [QGVAR(lockStatus), locked _this];
_this lock 2;

View File

@ -18,6 +18,7 @@
private ["_vehicle", "_loaded", "_emptyPos"];
PARAMS_1(_unit);
_vehicle = vehicle _unit;
TRACE_1("Unloading Unit Variable", _unit);
if (_vehicle == _unit) exitwith {false;};
if !(speed _vehicle <1 && (((getpos _vehicle) select 2) < 2)) exitwith {false;};
@ -27,9 +28,10 @@ if (count _emptyPos == 0) exitwith {false};
_unit setPos _emptyPos;
unassignVehicle _unit;
if (!alive _unit) then {
[_unit] orderGetIn false;
TRACE_1("Ejecting", alive _unit);
_unit action ["Eject", vehicle _unit];
};
[_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide);
@ -38,7 +40,18 @@ _loaded = _loaded - [_unit];
_vehicle setvariable [QGVAR(loaded_persons),_loaded,true];
if (!([_unit] call FUNC(isAwake))) then {
[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call FUNC(doAnimation);
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;

View File

@ -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 {};
[_target] call EFUNC(common,unloadPerson)
["unloadPersonEvent",[_target]] call EFUNC(common,globalEvent)