2015-07-24 16:13:03 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
|
|
|
* Caches the units information for quick retrevial in spectator interface PFHs
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit to have info cached for <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None <NIL>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [vehicle player] call ace_spectator_fnc_cacheUnitInfo
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
|
|
|
params ["_unit"];
|
|
|
|
private ["_color","_icon","_name"];
|
|
|
|
|
2015-08-06 12:42:31 +00:00
|
|
|
// Group info only needs to be cached once (groups can't change)
|
|
|
|
if (isNil { GETVAR((group _unit),GVAR(gColor),nil) }) then {
|
|
|
|
_color = [side group _unit] call BIS_fnc_sideColor;
|
|
|
|
SETVAR((group _unit),GVAR(gColor),_color);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Unit info should be updated each time
|
2015-07-24 16:13:03 +00:00
|
|
|
_icon = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "Icon");
|
|
|
|
_name = [_unit,false] call EFUNC(common,getName);
|
|
|
|
|
|
|
|
// Handle CfgVehicleIcons
|
2015-08-06 12:42:31 +00:00
|
|
|
if (isText (configFile >> "CfgVehicleIcons" >> _icon)) then {
|
2015-07-24 16:13:03 +00:00
|
|
|
_icon = getText (configFile >> "CfgVehicleIcons" >> _icon);
|
|
|
|
};
|
|
|
|
|
|
|
|
SETVAR(_unit,GVAR(uIcon),_icon);
|
|
|
|
SETVAR(_unit,GVAR(uName),_name);
|