ACE3/addons/common/functions/fnc_getAwakeAnim.sqf
PabstMirror e8693c8db9
Various - Use configOf command for faster lookup (#8100)
* configOf

* replace some use of CBA_fnc_getObjectConfig
2021-02-18 12:58:08 -06:00

50 lines
1.1 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: commy2
* Report awake animation of unit inside vehicle.
*
* Arguments:
* 0: The unit <OBJECT>
*
* ReturnValue:
* The animtaion <STRING>
*
* Example:
* player call ace_common_fnc_getAwakeAnim
*
* Public: no
*/
params ["_unit"];
private _vehicle = vehicle _unit;
// --- on foot
if (_vehicle isEqualTo _unit) exitWith {""};
// --- driver
private _config = configOf _vehicle;
if (_unit == driver _vehicle) exitWith {
getText (configFile >> "CfgMovesBasic" >> "ManActions" >> getText (_config >> "driverAction")) // return
};
// --- turret
private _turret = _unit call CBA_fnc_turretPath;
if !(_turret isEqualTo []) exitWith {
private _turretConfig = [_vehicle, _turret] call CBA_fnc_getTurret;
getText (configFile >> "CfgMovesBasic" >> "ManActions" >> getText (_turretConfig >> "gunnerAction")) // return
};
// --- cargo
private _cargoIndex = _vehicle getCargoIndex _unit;
if (_cargoIndex != -1) exitWith {
getText (configFile >> "CfgMovesBasic" >> "ManActions" >> getArray (_config >> "cargoAction") select _cargoIndex) // return
};
// --- default
""