From ffc3a28dc84b3f2952495f6b60b7b0bcd61c0b07 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 30 Dec 2023 18:43:17 +0000 Subject: [PATCH] Fix `fillMagazineWithCartridge()` failing to get a cartridge size when weapon is the rotating grenade launcher --- project/src/helpers/ItemHelper.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index 36c99c79..efa8fc5d 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -1032,7 +1032,10 @@ export class ItemHelper const cartridgeMaxStackSize = cartridgeDetails[1]._props.StackMaxSize; // Get max number of cartridges in magazine, choose random value between min/max - const magazineCartridgeMaxCount = magTemplate._props.Cartridges[0]?._max_count; + const magazineCartridgeMaxCount = (this.isOfBaseclass(magTemplate._id, BaseClasses.SPRING_DRIVEN_CYLINDER)) + ? magTemplate._props.Slots.length // Edge case for rotating grenade launcher magazine + : magTemplate._props.Cartridges[0]?._max_count; + if (!magazineCartridgeMaxCount) { this.logger.warning(`Magazine: ${magTemplate._id} ${magTemplate._name} lacks a Cartridges array, unable to fill magazine with ammo`);