Fix: Move pp-9 ammo typo check into fillMagazineWithRandomCartridge() so it can be used by more than just static container weapon ammo code (!27)
Co-authored-by: Dev <dev@noreply.dev.sp-tarkov.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/27
This commit is contained in:
parent
bf061774d0
commit
ef584d88d3
@ -483,14 +483,9 @@ export class LocationGenerator
|
|||||||
const magTemplate = this.itemHelper.getItem(magazine._tpl)[1];
|
const magTemplate = this.itemHelper.getItem(magazine._tpl)[1];
|
||||||
const weaponTemplate = this.itemHelper.getItem(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, ammoCaliber);
|
this.itemHelper.fillMagazineWithRandomCartridge(magazineWithCartridges, magTemplate, staticAmmoDist, weaponTemplate._props.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);
|
||||||
|
@ -838,6 +838,12 @@ class ItemHelper
|
|||||||
caliber = this.getRandomValidCaliber(magTemplate);
|
caliber = this.getRandomValidCaliber(magTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Edge case for the Klin pp-9, it has a typo in its ammo caliber
|
||||||
|
if (caliber === "Caliber9x18PMM")
|
||||||
|
{
|
||||||
|
caliber = "Caliber9x18PM";
|
||||||
|
}
|
||||||
|
|
||||||
// Chose a randomly weighted cartridge that fits
|
// Chose a randomly weighted cartridge that fits
|
||||||
const cartridgeTpl = this.drawAmmoTpl(caliber, staticAmmoDist);
|
const cartridgeTpl = this.drawAmmoTpl(caliber, staticAmmoDist);
|
||||||
this.fillMagazineWithCartridge(magazine, magTemplate, cartridgeTpl, minSizePercent);
|
this.fillMagazineWithCartridge(magazine, magTemplate, cartridgeTpl, minSizePercent);
|
||||||
|
Loading…
Reference in New Issue
Block a user