ACE3/addons/common/functions/fnc_getTurretConfigPath.sqf

39 lines
872 B
Plaintext
Raw Normal View History

/*
* Author: commy2
*
* Get the config path of a vehicles turret.
*
* Argument:
* 0: vehicles config (Config)
* 1: Turret index (Array)
*
* Return value:
* Turret config (Config)
*/
2015-01-13 19:56:02 +00:00
#include "script_component.hpp"
2015-05-14 22:12:40 +00:00
private ["_index", "_offset", "_config2", "_foundClasses", "_a"];
2015-05-14 18:06:06 +00:00
PARAMS_2(_config,_turretIndex);
for "_index" from 0 to (count _turretIndex - 1) do {
2015-05-14 18:06:06 +00:00
_config = _config >> "Turrets";
2015-05-14 18:06:06 +00:00
_offset = 0;
_config2 = _config select 0;
2015-05-14 18:06:06 +00:00
_foundClasses = 0;
for "_a" from 0 to (count _config - 1) do {
if (isClass _config2) then {
_foundClasses = _foundClasses + 1;
} else {
_offset = _offset + 1;
};
_config2 = _config select (_turretIndex select _index) + _offset;
2015-05-14 18:06:06 +00:00
if (_foundClasses == _turretIndex select _index) exitWith {};
};
_config = _config2;
};
_config