From 7342849f615b9d7c5b5a39e8d1c0f3dce0927480 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 24 Nov 2023 15:24:46 +0000 Subject: [PATCH] Resolve `getRandomizedBulletCount` returning extremely large ammo values for rotating grenade launchers --- project/src/helpers/BotWeaponGeneratorHelper.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/project/src/helpers/BotWeaponGeneratorHelper.ts b/project/src/helpers/BotWeaponGeneratorHelper.ts index fe9afb69..738cfebe 100644 --- a/project/src/helpers/BotWeaponGeneratorHelper.ts +++ b/project/src/helpers/BotWeaponGeneratorHelper.ts @@ -46,12 +46,15 @@ export class BotWeaponGeneratorHelper let chamberBulletCount = 0; if (this.magazineIsCylinderRelated(parentItem._name)) { - // if we have a CylinderMagazine/SpringDrivenCylinder we count the number of camoras as the _max_count of the magazine is 0 - chamberBulletCount = magTemplate._props.Slots.length; + const firstSlotAmmoTpl = magTemplate._props.Cartridges[0]._props.filters[0].Filter[0]; + const ammoMaxStackSize = this.itemHelper.getItem(firstSlotAmmoTpl)[1]?._props?.StackMaxSize ?? 1; + chamberBulletCount = (ammoMaxStackSize === 1) + ? 1 // Rotating grenade launcher + : magTemplate._props.Slots.length; // Shotguns/revolvers. We count the number of camoras as the _max_count of the magazine is 0 } else if (parentItem._id === BaseClasses.UBGL) { - // underbarrel launchers can only have 1 chambered grenade + // Underbarrel launchers can only have 1 chambered grenade chamberBulletCount = 1; } else