2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Get the config path of a vehicles turret.
|
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: Vehicle Config <CONFIG>
|
|
|
|
* 1: Turret indecies <ARRAY>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Turret config <CONFIG>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [CfgVehicle, [Array]] call ace_common_fnc_getTurretConfigPath
|
|
|
|
*
|
2015-09-20 21:40:51 +00:00
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
|
|
|
|
2015-09-20 21:40:51 +00:00
|
|
|
params ["_config", "_turretIndex"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
for "_index" from 0 to (count _turretIndex - 1) do {
|
2015-05-14 18:06:06 +00:00
|
|
|
_config = _config >> "Turrets";
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-12-12 15:48:54 +00:00
|
|
|
private _offset = 0;
|
|
|
|
private _config2 = _config select 0;
|
|
|
|
private _foundClasses = 0;
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
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-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
if (_foundClasses == _turretIndex select _index) exitWith {};
|
|
|
|
};
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
_config = _config2;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-09-20 21:40:51 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
_config
|