2015-08-19 15:33:32 +00:00
|
|
|
/*
|
|
|
|
* Author: GitHawk, Jonpas
|
|
|
|
* Returns all magazines a turret can hold according to config.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Target <OBJECT>
|
|
|
|
* 1: Turret Path <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Magazine classes in TurretPath <ARRAY>
|
|
|
|
*
|
|
|
|
* Example:
|
2015-08-20 17:51:22 +00:00
|
|
|
* [vehicle, [0]] call ace_rearm_fnc_getConfigMagazines
|
2015-08-19 15:33:32 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-02-01 19:05:53 +00:00
|
|
|
params [["_target", objNull, [objNull]], ["_turretPath", [], [[]]]];
|
2015-08-19 15:33:32 +00:00
|
|
|
|
|
|
|
if (isNull _target) exitWith {[]};
|
|
|
|
|
|
|
|
_cfg = configFile >> "CfgVehicles" >> (typeOf _target) >> "Turrets";
|
|
|
|
|
|
|
|
if (count _turretPath == 1) then {
|
|
|
|
_turretPath params ["_subPath"];
|
|
|
|
|
|
|
|
if (_subPath == -1) exitWith {
|
|
|
|
_cfg = configFile >> "CfgVehicles" >> (typeOf _target);
|
|
|
|
};
|
|
|
|
|
|
|
|
if (count _cfg > _subPath) then {
|
|
|
|
_cfg = _cfg select _subPath;
|
|
|
|
} else {
|
|
|
|
_cfg = nil;
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
_turretPath params ["", "_subPath"];
|
|
|
|
if (count _cfg > 0) then {
|
|
|
|
_cfg = (_cfg select 0) >> "Turrets";
|
|
|
|
if (count _cfg > _subPath) then {
|
|
|
|
_cfg = _cfg select _subPath;
|
|
|
|
} else {
|
|
|
|
_cfg = nil;
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
_cfg = nil;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
if !(isClass _cfg) exitWith {[]};
|
|
|
|
|
|
|
|
getArray (_cfg >> "magazines")
|