Reverse ammo stacks in ammo boxes to fix issue with opening ammo boxes in raid - Thanks to Kaeno for investigation + fix

This commit is contained in:
Dev 2024-02-11 15:15:21 +00:00
parent 71f308c288
commit 9e70b1135c

View File

@ -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);
}
/**