Fix: ensure static weapon generation chooses a compatible caliber + add edge case handling for pp-9 Klin ammo caliber typo (!26)
Co-authored-by: Dev <dev@noreply.dev.sp-tarkov.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/26
This commit is contained in:
parent
acb49ce0d3
commit
bf061774d0
@ -117,10 +117,10 @@ export class LocationGenerator
|
|||||||
const tpls = tplsForced.concat(tplsDraw);
|
const tpls = tplsForced.concat(tplsDraw);
|
||||||
for (const tpl of tpls)
|
for (const tpl of tpls)
|
||||||
{
|
{
|
||||||
const created = this.createStaticLootItem(tpl, staticAmmoDist, parentId);
|
const chosenItemWithChildren = this.createStaticLootItem(tpl, staticAmmoDist, parentId);
|
||||||
const items = created.items;
|
const items = chosenItemWithChildren.items;
|
||||||
const width = created.width;
|
const width = chosenItemWithChildren.width;
|
||||||
const height = created.height;
|
const height = chosenItemWithChildren.height;
|
||||||
|
|
||||||
// look for open slot to put chosen item into
|
// look for open slot to put chosen item into
|
||||||
const result = this.containerHelper.findSlotForItem(container2D, width, height);
|
const result = this.containerHelper.findSlotForItem(container2D, width, height);
|
||||||
@ -481,10 +481,16 @@ export class LocationGenerator
|
|||||||
if (magazine)
|
if (magazine)
|
||||||
{
|
{
|
||||||
const magTemplate = this.itemHelper.getItem(magazine._tpl)[1];
|
const magTemplate = this.itemHelper.getItem(magazine._tpl)[1];
|
||||||
|
const weaponTemplate = this.itemHelper.getItem(tpl)[1];
|
||||||
|
|
||||||
|
// Edge case for the Klin pp-9, it has a typo in its ammo caliber
|
||||||
|
const ammoCaliber = (weaponTemplate._props.ammoCaliber === "Caliber9x18PMM")
|
||||||
|
? "Caliber9x18PM"
|
||||||
|
: weaponTemplate._props.ammoCaliber;
|
||||||
|
|
||||||
// Create array with just magazine
|
// Create array with just magazine
|
||||||
const magazineWithCartridges = [magazine];
|
const magazineWithCartridges = [magazine];
|
||||||
this.itemHelper.fillMagazineWithRandomCartridge(magazineWithCartridges, magTemplate, staticAmmoDist);
|
this.itemHelper.fillMagazineWithRandomCartridge(magazineWithCartridges, magTemplate, staticAmmoDist, ammoCaliber);
|
||||||
|
|
||||||
// Replace existing magazine with above array
|
// Replace existing magazine with above array
|
||||||
items.splice(items.indexOf(magazine), 1, ...magazineWithCartridges);
|
items.splice(items.indexOf(magazine), 1, ...magazineWithCartridges);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user