Merge branch '3.8.0' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.8.0
This commit is contained in:
commit
805190abb4
@ -1047,11 +1047,10 @@ export class ItemHelper
|
|||||||
|
|
||||||
// Add new stack-size-correct items to ammo box
|
// Add new stack-size-correct items to ammo box
|
||||||
let currentStoredCartridgeCount = 0;
|
let currentStoredCartridgeCount = 0;
|
||||||
// Location in ammoBox cartridges will be placed
|
|
||||||
let location = 0;
|
|
||||||
const maxPerStack = Math.min(ammoBoxMaxCartridgeCount, cartridgeMaxStackSize);
|
const maxPerStack = Math.min(ammoBoxMaxCartridgeCount, cartridgeMaxStackSize);
|
||||||
|
// Find location based on Max ammo box size
|
||||||
|
let location = Math.ceil(ammoBoxMaxCartridgeCount / maxPerStack) - 1;
|
||||||
|
|
||||||
const ammoStacksToAdd: Item[] = [];
|
|
||||||
while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount)
|
while (currentStoredCartridgeCount < ammoBoxMaxCartridgeCount)
|
||||||
{
|
{
|
||||||
const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount;
|
const remainingSpace = ammoBoxMaxCartridgeCount - currentStoredCartridgeCount;
|
||||||
@ -1072,15 +1071,11 @@ export class ItemHelper
|
|||||||
delete cartridgeItemToAdd.location;
|
delete cartridgeItemToAdd.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
ammoStacksToAdd.push(cartridgeItemToAdd);
|
ammoBox.push(cartridgeItemToAdd);
|
||||||
|
|
||||||
currentStoredCartridgeCount += cartridgeCountToAdd;
|
currentStoredCartridgeCount += cartridgeCountToAdd;
|
||||||
location++;
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user