Skip to content

Commit

Permalink
Misc - Fix IFAK unpacking causing crash (#556)
Browse files Browse the repository at this point in the history
**When merged this pull request will:**
-Fix the issue with people crashing when an FAK is unpacked when there
is not enough inventory space

### IMPORTANT

- [Development Guidelines](https://ace3.acemod.org/wiki/development/)
are read, understood and applied.
- Title of this PR uses our standard template `Component -
Add|Fix|Improve|Change|Make|Remove {changes}`.
  • Loading branch information
Cplhardcore authored Jul 20, 2024
1 parent 6f70411 commit ee92156
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions addons/misc/functions/fnc_FAK_unpack.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,10 @@ params ["_unit", "_item", "_type", "_slot"];
private _fnc_arrayToInvItem = {
params ["_unit", "_array", "_container"];

private _groundContainer = nearestObjects [_unit, ["GroundWeaponHolder", "WeaponHolder", "Library_WeaponHolder", "WeaponHolderSimulated"], 2] param [0];

{
for "_i" from 1 to (_x select 1) do
{
private _inventory = [_unit, _x select 0, _container] call ACEFUNC(common,addToInventory);

if !(_inventory select 0) then {
if (isNil "_groundContainer") exitWith {
_groundContainer = _inventory select 1;
};

{
_groundContainer addItemCargoGlobal [_x, 1];
} forEach itemCargo (_inventory select 1);

deleteVehicle (_inventory select 1);
};
[_unit, _x select 0, _container] call ACEFUNC(common,addToInventory);
}
} foreach _array;
};
Expand Down Expand Up @@ -161,4 +147,4 @@ if (_slot > 0) then {
[_unit, (_itemList select _forEachIndex), _container] call _fnc_arrayToInvItem;
};
} forEach _slotArray;
};
};

0 comments on commit ee92156

Please sign in to comment.