From 9e70b1135c7fa407c1fd5410ccec979f4e0e7bda Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 11 Feb 2024 15:15:21 +0000 Subject: [PATCH] Reverse ammo stacks in ammo boxes to fix issue with opening ammo boxes in raid - Thanks to Kaeno for investigation + fix --- project/src/helpers/ItemHelper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index ecb936b2..5e9f9995 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -1050,6 +1050,8 @@ export class ItemHelper // Location in ammoBox cartridges will be placed let location = 0; const maxPerStack = Math.min(ammoBoxMaxCartridgeCount, cartridgeMaxStackSize); + + const ammoStacksToAdd: Item[] = []; while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount) { const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount; @@ -1070,11 +1072,15 @@ export class ItemHelper delete cartridgeItemToAdd.location; } - ammoBox.push(cartridgeItemToAdd); + ammoStacksToAdd.push(cartridgeItemToAdd); currentStoredCartridgeCount += cartridgeCountToAdd; location++; } + + // Ammo must be reversed so location 2 goes first, then location 1 etc, prevents being unable to open ammo boxes in live in one click + ammoStacksToAdd.reverse(); + ammoBox.push(...ammoStacksToAdd); } /**