diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:57:23 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:57:23 +0300 |
| commit | 3533c3aa9393fc6350178b196c813dc636ec9cf6 (patch) | |
| tree | 2f96a879c3935dea18e73410926b03c7eef1a751 /Common/Functions/Common_SetTurretsMags.sqf | |
| download | a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.tar.gz a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.tar.bz2 a2wf_isladuala-3533c3aa9393fc6350178b196c813dc636ec9cf6.zip | |
init
Diffstat (limited to 'Common/Functions/Common_SetTurretsMags.sqf')
| -rw-r--r-- | Common/Functions/Common_SetTurretsMags.sqf | 30 |
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 |
