diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:55:24 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:55:24 +0300 |
| commit | 628d33984d9228f1781d13a65fbb80f35facc899 (patch) | |
| tree | cd909141f87e14f22c3511549a9bc067d9ff8b50 /Common/Functions/Common_SetTurretsMags.sqf | |
| download | a2wf_sara-628d33984d9228f1781d13a65fbb80f35facc899.tar.gz a2wf_sara-628d33984d9228f1781d13a65fbb80f35facc899.tar.bz2 a2wf_sara-628d33984d9228f1781d13a65fbb80f35facc899.zip | |
init
Diffstat (limited to '')
| -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 |
