mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
/*
|
|
* 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);
|
|
|
|
[{
|
|
params ["_unit"];
|
|
|
|
if (animationState _unit == "unconscious" && {lifeState _unit != "INCAPACITATED"}) then {
|
|
[_unit, "AmovPpneMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
|
};
|
|
}, _unit, 0.5] call CBA_fnc_waitAndExecute;
|
|
};
|
|
};
|