2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
2015-09-20 21:40:51 +00:00
|
|
|
* Get all turret indicies of a vehicle type.
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle type <STRING>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Return Value:
|
|
|
|
* Turret Indecies <ARRAY>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Public: Yes
|
|
|
|
*
|
|
|
|
* Note: It's advised to use allTurrets [_vehicle, true] instead whenever possible
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-09-20 21:40:51 +00:00
|
|
|
params ["_type"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _varName = format [QGVAR(CachedTurrets_%1), _type];
|
|
|
|
private _turrets = + (uiNamespace getVariable _varName);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (!isNil "_turrets") exitWith {_turrets};
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _config = configFile >> "CfgVehicles" >> _type;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_turrets = [];
|
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _fnc_addTurret = {
|
2015-09-20 21:40:51 +00:00
|
|
|
params ["_config", "_path"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
_config = _config >> "Turrets";
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _offset = 0;
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
for "_index" from 0 to (count _config - 1) do {
|
|
|
|
private _path2 = _path + [_index - _offset];
|
|
|
|
private _config2 = _config select _index;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
if (isClass _config2) then {
|
|
|
|
_turrets pushBack _path2;
|
|
|
|
[_config2, _path2] call _fnc_addTurret;
|
|
|
|
} else {
|
|
|
|
_offset = _offset + 1;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
[_config, []] call _fnc_addTurret;
|
|
|
|
|
|
|
|
uiNamespace setVariable [_varName, _turrets];
|
|
|
|
|
|
|
|
_turrets
|