diff --git a/addons/gunbag/functions/fnc_toGunbag.sqf b/addons/gunbag/functions/fnc_toGunbag.sqf index 1451903da4..8d89a67899 100644 --- a/addons/gunbag/functions/fnc_toGunbag.sqf +++ b/addons/gunbag/functions/fnc_toGunbag.sqf @@ -16,20 +16,24 @@ params ["_unit", "_target"]; -private ["_weapon", "_magazine", "_items", "_gunbag", "_state", "_mass"]; +private ["_weapon", "_magazine", "_magazine_gl", "_items", "_gunbag", "_state", "_mass"]; _gunbag = backpackContainer _target; _state = [_unit, primaryWeapon _unit] call EFUNC(common,getWeaponState); /* * example returnvalue _state -* ["","","optic_Aco","",["arifle_MX_GL_ACO_F","GL_3GL_F"],["30Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell"],[30,1]] +* [["","","optic_Aco",""],["arifle_MX_GL_ACO_F","GL_3GL_F"],["30Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell"],[30,1]] */ -_weapon = ((_state select 4) select 0); -_magazine = [(_state select 5) select 0, (_state select 6) select 0]; -_items = [_state select 0, _state select 1, _state select 2, _state select 3]; +_weapon = (_state select 1) select 0; +_magazine = [(_state select 2) select 0, (_state select 3) select 0]; +_magazine_gl = [(_state select 2) select 1, (_state select 3) select 1]; +_items = _state select 0; +if ((_magazine_gl select 0) != "") then { + _unit addMagazine _magazine_gl; +}; if ((_magazine select 0) != "") then { _unit addMagazine _magazine; @@ -37,9 +41,11 @@ if ((_magazine select 0) != "") then { _unit removeWeapon _weapon; +// add virtual load [_target, backpackContainer _target, [_weapon, _items] call FUNC(calculateMass)] call EFUNC(movement,addLoadToUnitContainer); _gunbag setVariable [QGVAR(GunbagWeapon), [[_weapon], _items], true]; +// play sound if(["ACE_Backpacks"] call EFUNC(common,isModLoaded)) then { [_unit, _target, backpackContainer _target] call EFUNC(backpacks,backpackOpened); };