Skip to content

Commit

Permalink
Fix CBA_fnc_removeMagazineCargo for ground containers
Browse files Browse the repository at this point in the history
Based on acemod/ACE3#8399

Co-Authored-By: Salluci <69561145+Salluci@users.noreply.github.com>
  • Loading branch information
PabstMirror and LinkIsGrim committed Sep 1, 2021
1 parent 69bd0bf commit 0f8a2a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/common/fnc_removeMagazineCargo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ private _magazinesAmmo = magazinesAmmoCargo _container;
// Clear cargo space and readd the items as long it's not the type in question
clearMagazineCargoGlobal _container;

// Engine will agressively cleanup "empty" ground containers, even if magazines are re-added in same frame, so re-create a new container
private _containerType = typeOf _container;
if (((toLower _containerType) in ["groundweaponholder", "weaponholdersimulated"])
&& {(weaponCargo _container) isEqualTo []} && {(itemCargo _container) isEqualTo []} && {(backpackCargo _container) isEqualTo []}) then {
_container = createVehicle [_containerType, getPosATL _container, [], 0, "CAN_COLLIDE"];
};

{
_x params ["_magazineClass", "_magazineAmmo"];

Expand Down

0 comments on commit 0f8a2a2

Please sign in to comment.