Add config property forceOnlyArmoredRigWhenNoArmor + wire it up

This commit is contained in:
Dev 2024-01-27 18:52:36 +00:00
parent 734d821630
commit ccb610dda6
3 changed files with 29 additions and 0 deletions

View File

@ -850,6 +850,7 @@
"lightIsActiveDayChancePercent": 25, "lightIsActiveDayChancePercent": 25,
"lightIsActiveNightChancePercent": 95, "lightIsActiveNightChancePercent": 95,
"laserIsActiveChancePercent": 85, "laserIsActiveChancePercent": 85,
"forceOnlyArmoredRigWhenNoArmor": true,
"filterPlatesByLevel": true, "filterPlatesByLevel": true,
"randomisation": [ "randomisation": [
{ {

View File

@ -238,6 +238,14 @@ export class BotInventoryGenerator
botEquipmentConfig: botEquipConfig, botEquipmentConfig: botEquipConfig,
randomisationDetails: randomistionDetails randomisationDetails: randomistionDetails
}); });
// Bot has no armor vest
if (botEquipConfig.forceOnlyArmoredRigWhenNoArmor && !botInventory.items.find(item => item.slotId === "ArmorVest"))
{
// Filter rigs down to only those with armor
this.filterRigsToOnlyThoseWithProtection(templateInventory);
}
this.generateEquipment({ this.generateEquipment({
rootEquipmentSlot: EquipmentSlots.TACTICAL_VEST, rootEquipmentSlot: EquipmentSlots.TACTICAL_VEST,
rootEquipmentPool: templateInventory.equipment.TacticalVest, rootEquipmentPool: templateInventory.equipment.TacticalVest,
@ -251,6 +259,25 @@ export class BotInventoryGenerator
}); });
} }
/**
* Remove non-armored rigs from parameter data
* @param templateInventory
*/
protected filterRigsToOnlyThoseWithProtection(templateInventory: Inventory): void
{
const tacVestsWithArmor = Object.entries(templateInventory.equipment.TacticalVest)
.reduce((newVestDictionary, [tplKey]) =>
{
if (this.itemHelper.getItem(tplKey)[1]._props.Slots?.length > 0)
{
newVestDictionary[tplKey] = templateInventory.equipment.TacticalVest[tplKey];
}
return newVestDictionary;
}, {});
templateInventory.equipment.TacticalVest = tacVestsWithArmor;
}
/** /**
* Add a piece of equipment with mods to inventory from the provided pools * Add a piece of equipment with mods to inventory from the provided pools
* @param settings Values to adjust how item is chosen and added to bot * @param settings Values to adjust how item is chosen and added to bot

View File

@ -108,6 +108,7 @@ export interface EquipmentFilters
nvgIsActiveChanceDayPercent?: number; nvgIsActiveChanceDayPercent?: number;
/** Chance NODS are down/active during the night */ /** Chance NODS are down/active during the night */
nvgIsActiveChanceNightPercent?: number; nvgIsActiveChanceNightPercent?: number;
forceOnlyArmoredRigWhenNoArmor?: boolean;
/** Adjust weighting/chances of items on bot by level of bot */ /** Adjust weighting/chances of items on bot by level of bot */
randomisation: RandomisationDetails[]; randomisation: RandomisationDetails[];
/** Blacklist equipment by level of bot */ /** Blacklist equipment by level of bot */