Fix weapon mod generation choosing a default mod only to keep it flagged as incompatible

This commit is contained in:
Dev 2024-01-29 21:27:36 +00:00
parent 1995fbfef0
commit 58d620d424
2 changed files with 2 additions and 3 deletions

View File

@ -784,7 +784,7 @@ export class BotEquipmentModGenerator
if (chosenModResult.incompatible && parentSlot._required) if (chosenModResult.incompatible && parentSlot._required)
{ {
this.logger.debug(chosenModResult.reason); this.logger.debug(chosenModResult.reason);
this.logger.debug(`Weapon: ${weapon.map(x => `${x._tpl} ${x.slotId ?? ""}`).join(",")}`) //this.logger.debug(`Weapon: ${weapon.map(x => `${x._tpl} ${x.slotId ?? ""}`).join(",")}`)
} }
// Get random mod to attach from items db for required slots if none found above // Get random mod to attach from items db for required slots if none found above
@ -840,6 +840,7 @@ export class BotEquipmentModGenerator
{ {
// Default mod wanted and only one choice in pool // Default mod wanted and only one choice in pool
chosenModResult.found = true; chosenModResult.found = true;
chosenModResult.incompatible = false;
chosenModResult.chosenTpl = chosenTpl; chosenModResult.chosenTpl = chosenTpl;
break; break;

View File

@ -372,9 +372,7 @@ export class BotWeaponGenerator
continue; continue;
} }
const allowedTplsOnSlot = modSlotTemplate._props.filters[0].Filter;
const slotName = modSlotTemplate._name; const slotName = modSlotTemplate._name;
const weaponSlotItem = weaponItemArray.find((weaponItem) => weaponItem.parentId === mod._id && weaponItem.slotId === slotName); const weaponSlotItem = weaponItemArray.find((weaponItem) => weaponItem.parentId === mod._id && weaponItem.slotId === slotName);
if (!weaponSlotItem) if (!weaponSlotItem)
{ {