ACE3/addons/common/functions/fnc_getDeathAnim.sqf
2015-05-01 03:13:26 -05:00

46 lines
1.5 KiB
Plaintext

/*
* Author: Glowbal, PabstMirror
* Get the death animation for the unit at current time
*
* Arguments:
* 0: unit <OBJECT>
*
* Return Value:
* animation <STRING>
*
* Example:
* [bob] call ace_common_fnc_getDeathAnim;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_unit);
private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation", "_index"];
_returnAnimation = "";
_animationState = (animationState _unit);
_unitAnimationCfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
_unitActionsCfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimationCfg >> "actions")));
TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg);
if ((vehicle _unit) != _unit) then {
_interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo");
for "_index" from 0 to (count _interpolateArray - 1) step 2 do {
_indexAnimation = _interpolateArray select _index;
//No guarentee that first animation will be right so scan for the first scan for the first "terminal" animation
//E.G.: interpolateTo[] = {"passenger_apc_generic04still",1,"KIA_passenger_apc_generic04",1};
if ((getNumber ((configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation) >> "terminal")) == 1) exitWith {
_returnAnimation = _indexAnimation;
};
};
} else {
_returnAnimation = getText (_unitActionsCfg >> "die");
};
_returnAnimation