summaryrefslogtreecommitdiffstats
path: root/Common/Functions/Common_SetTurretsMags.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:53:22 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:53:22 +0300
commitc055d44dcdb87e8db49fb23e632fc086aa44cce6 (patch)
tree7ac98d865915930bebc86b36b512a859c31538e5 /Common/Functions/Common_SetTurretsMags.sqf
downloada2wf_zargabad-c055d44dcdb87e8db49fb23e632fc086aa44cce6.tar.gz
a2wf_zargabad-c055d44dcdb87e8db49fb23e632fc086aa44cce6.tar.bz2
a2wf_zargabad-c055d44dcdb87e8db49fb23e632fc086aa44cce6.zip
init
Diffstat (limited to 'Common/Functions/Common_SetTurretsMags.sqf')
-rw-r--r--Common/Functions/Common_SetTurretsMags.sqf30
1 files changed, 30 insertions, 0 deletions
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