From a3a91d4f45b22fd487ecbc954ad979be5d03efdd Mon Sep 17 00:00:00 2001 From: hybrid Date: Thu, 11 Jun 2026 19:38:09 +0300 Subject: init --- Client/Module/EASA/EASA_Equip.sqf | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Client/Module/EASA/EASA_Equip.sqf (limited to 'Client/Module/EASA/EASA_Equip.sqf') diff --git a/Client/Module/EASA/EASA_Equip.sqf b/Client/Module/EASA/EASA_Equip.sqf new file mode 100644 index 0000000..8bed693 --- /dev/null +++ b/Client/Module/EASA/EASA_Equip.sqf @@ -0,0 +1,45 @@ +Private ['_data','_get','_i','_index','_j','_old','_override','_tar','_tindex','_type','_vehicle','_z']; +_vehicle = _this select 0; +_index = _this select 1; +_tindex = _index; +_override = if (count _this > 2) then {_this select 2} else {false}; + +if (typeName _vehicle != 'OBJECT') exitWith {diag_log Format['[WFBE (ERROR)][frameno:%2 | ticktime:%3] EASA_Equip: Invalid Parameter (_vehicle), expected object instead of %1',_vehicle,diag_frameno,diag_tickTime]}; + +_type = ('WFBE_EASA_Vehicles' Call GetNamespace) find (typeOf _vehicle); +if (_type != -1) then { + _get = _vehicle getVariable 'WFBE_EASA_Setup'; + //--- Vehicle Loadout check. + if (isNil '_get') then { + [_vehicle,('WFBE_EASA_Default' Call GetNamespace) select _type] Call EASA_RemoveLoadout; + } else { + //--- Override the index?. + _tindex = if (_override) then {_index} else {(_get select 1)}; + + //--- Grab the old loadout. + _old = (('WFBE_EASA_Loadouts' Call GetNamespace) select (_get select 0)) select (_get select 1); + _tar = []; + for [{_i = 2},{_i < count(_old)},{_i = _i + 1}] do { + _tar = _tar + [_old select _i]; + }; + _old = _tar; + + [_vehicle,('WFBE_EASA_Default' Call GetNamespace) select _type] Call EASA_RemoveLoadout; + [_vehicle,_old] Call EASA_RemoveLoadout; + }; + + _data = (('WFBE_EASA_Loadouts' Call GetNamespace) select _type) select _tindex; + + for [{_j = 2},{_j < count(_data)},{_j = _j + 1}] do { + _z = _data select _j; + for [{_i = count(_z)-1},{_i >= 0},{_i = _i - 1}] do { + if (_i > 0) then { + _vehicle addMagazine (_z select _i); + } else { + _vehicle addWeapon (_z select _i); + }; + }; + }; + + _vehicle setVariable ['WFBE_EASA_Setup',[_type,_tindex],true]; +}; \ No newline at end of file -- cgit v1.3.1