Skip to content

Commit

Permalink
Fix lost magazines when restoring gunbag mags (#4942)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored Feb 25, 2017
1 parent 1590948 commit e41fbcb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addons/gunbag/functions/fnc_offGunbagCallback.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ if (_state isEqualTo []) exitWith {
_state params ["_weapon", "_items", "_magazines"];

_unit addWeapon _weapon;

// Game will auto add magazines from player's inventory, put these back in player inventory as they will be overwritten
([_unit, _weapon] call EFUNC(common,getWeaponState)) params ["", "", "_addedMags", "_addedAmmo"];
{
if (((_x select 0) != "") && {(_addedMags select _forEachIndex) != ""}) then {
TRACE_2("Re-adding mag",_x,_addedMags select _forEachIndex);
_unit addMagazine [_addedMags select _forEachIndex, _addedAmmo select _forEachIndex];
};
} forEach _magazines;

removeAllPrimaryWeaponItems _unit;

{
Expand Down

0 comments on commit e41fbcb

Please sign in to comment.