Fix edge case when getModPoolForSlot() gets default handguard for mp5 when the reciever is set to the mp5sd. Now uses correct default template

This commit is contained in:
Dev 2024-02-03 16:59:54 +00:00
parent f17d385d56
commit 34d761a14f

View File

@ -936,7 +936,12 @@ export class BotEquipmentModGenerator
// Mod is flagged as being default only, try and find it in globals
if (modSpawnResult === ModSpawn.DEFAULT_MOD)
{
const defaultWeaponPreset = this.presetHelper.getDefaultPreset(weaponTemplate._id);
// Edge case - using mp5sd reciever means default mp5 handguard doesnt fit
const isMp5sd = parentTemplate._id === "5926f2e086f7745aae644231";
const defaultWeaponPreset = isMp5sd
? this.presetHelper.getPreset("59411abb86f77478f702b5d2")
: this.presetHelper.getDefaultPreset(weaponTemplate._id);
const matchingMod = defaultWeaponPreset._items.find((item) =>
item?.slotId?.toLowerCase() === modSlot.toLowerCase()
);