Fix incompatible default mods being used in required slots (!299)
This prevents weapons from getting the default mods for their base preset when they won't fit other required mods. This was observed on the AK-74M, where the weapon generator would choose the VDM CS gas tube, which is incompatible with the default AK-74 polymer handguard (6P20 Sb.9). When this occurs, the generator will bypass the default mod selection and instead choose from the loot pool assigned to the handguard in the bot configs. https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/596 Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/299 Co-authored-by: Brent <wiggyvidyadev@gmail.com> Co-committed-by: Brent <wiggyvidyadev@gmail.com>
This commit is contained in:
parent
b305ffdc24
commit
df93245e9d
@ -957,17 +957,25 @@ export class BotEquipmentModGenerator
|
||||
// You'd have a mod being picked without any sub-mods in its chain, possibly resulting in missing required mods not being added
|
||||
if (matchingMod)
|
||||
{
|
||||
// Mod isnt in existing mod pool
|
||||
// Mod is in existing mod pool
|
||||
if (itemModPool[modSlot].includes(matchingMod._tpl))
|
||||
{
|
||||
// Found mod on preset + it already exists in mod pool
|
||||
return [matchingMod._tpl];
|
||||
}
|
||||
|
||||
// Mod isnt in existing pool, only add if its got no children
|
||||
if (this.itemHelper.getItem(matchingMod._tpl)[1]._props.Slots.length === 0)
|
||||
// Check the filter of the slot to ensure a chosen mod fits
|
||||
const parentSlotCompatibleItems = parentTemplate._props.Slots?.find((slot) =>
|
||||
slot._name.toLowerCase() === modSlot.toLowerCase()
|
||||
)._props.filters[0].Filter;
|
||||
|
||||
// Mod isnt in existing pool, only add if it has no children and matches parent filter
|
||||
if (
|
||||
this.itemHelper.getItem(matchingMod._tpl)[1]._props.Slots.length === 0
|
||||
&& parentSlotCompatibleItems.includes(matchingMod._tpl)
|
||||
)
|
||||
{
|
||||
// Mod has no children
|
||||
// Mod has no children and matches parent filters, can be used
|
||||
return [matchingMod._tpl];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user