From 68d4c9bbd80ed2e6528244569c79676b87295bd1 Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:54:45 +0300 Subject: init --- Common/Functions/Common_SetTurretsMags.sqf | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Common/Functions/Common_SetTurretsMags.sqf (limited to 'Common/Functions/Common_SetTurretsMags.sqf') diff --git a/Common/Functions/Common_SetTurretsMags.sqf b/Common/Functions/Common_SetTurretsMags.sqf new file mode 100644 index 0000000..7881ed9 --- /dev/null +++ b/Common/Functions/Common_SetTurretsMags.sqf @@ -0,0 +1,30 @@ +private ["_content","_cpt","_data","_dataRow","_tConstruct","_turretPath","_vehicle"]; +_vehicle = _this select 0; +_data = _this select 1; +_turretPath = if (count _this > 2) then {_this select 2} else {[]}; +_cpt = count _turretPath; + +for "_i" from 0 to ((count _data) - 1) do { + _dataRow = _data select _i; + + if (count _dataRow > 0) then { + if (typeName _dataRow == 'ARRAY') then { + _content = _dataRow select 0; + //--- root. + if (typeName _content == 'SCALAR') then { + _turretPath set [_cpt,[_content]]; + _tConstruct = []; + {_tConstruct = _tConstruct + _x} forEach _turretPath; + { + _vehicle addMagazineTurret [_x, _tConstruct]; + } forEach (_data select (_i+1)); + }; + //--- go deeper. + if (typeName _content == 'ARRAY') then { + [_vehicle,_dataRow,_turretPath] Call SetTurretsMags; + _turretPath = []; + _cpt = 0; + }; + }; + }; +}; \ No newline at end of file -- cgit v1.3.1