ACE3/addons/medical_engine/functions/fnc_setUnconsciousAnim.sqf

60 lines
1.7 KiB
Plaintext
Raw Normal View History

/*
* Author: commy2
* Force local unit into ragdoll / unconsciousness animation.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Is unconscious (optional, default: true) <BOOLEAN>
*
* Return Value:
* None
*
* Example:
* player call ace_medical_engine_fnc_setUnconsciousAnim
*
* Public: No
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]], ["_isUnconscious", true, [false]]];
if (!local _unit) exitWith {
ERROR("Unit not local or null");
};
_unit setUnconscious _isUnconscious;
if (_isUnconscious) then {
// eject from static weapon
if (vehicle _unit isKindOf "StaticWeapon") then {
[_unit] call EFUNC(common,unloadPerson);
};
// set animation inside vehicles
if (vehicle _unit != _unit) then {
private _unconAnim = _unit call EFUNC(common,getDeathAnim);
[_unit, _unconAnim] call EFUNC(common,doAnimation);
};
} else {
// reset animation inside vehicles
if (vehicle _unit != _unit) then {
private _awakeAnim = _unit call EFUNC(common,getAwakeAnim);
[_unit, _awakeAnim, 2] call EFUNC(common,doAnimation);
} else {
// and on foot
[_unit, "AmovPpneMstpSnonWnonDnon"] call EFUNC(common,doAnimation);
if (currentWeapon _unit == secondaryWeapon _unit && {currentWeapon _unit != ""}) then {
[_unit, "AmovPknlMstpSrasWlnrDnon"] call EFUNC(common,doAnimation);
};
[{
params ["_unit"];
if (animationState _unit == "unconscious" && {lifeState _unit != "INCAPACITATED"}) then {
[_unit, "AmovPpneMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
};
2016-10-12 19:59:32 +00:00
}, _unit, 0.5] call CBA_fnc_waitAndExecute;
};
};