Added disableLootOnBotTypes property to bot.json config to allow disabling loot on bots by their type

This commit is contained in:
Dev 2024-05-26 16:32:39 +01:00
parent 88242238f9
commit 673256e5fa
3 changed files with 18 additions and 6 deletions

View File

@ -2680,5 +2680,6 @@
} }
} }
}, },
"lowProfileGasBlockTpls": ["61702f1b67085e45ef140b26", "5dfa3d45dfc58d14537c20b0", "5bb20dcad4351e3bac1212da", "56eabcd4d2720b66698b4574", "6065dc8a132d4d12c81fd8e3", "55d4af3a4bdc2d972f8b456f"] "lowProfileGasBlockTpls": ["61702f1b67085e45ef140b26", "5dfa3d45dfc58d14537c20b0", "5bb20dcad4351e3bac1212da", "56eabcd4d2720b66698b4574", "6065dc8a132d4d12c81fd8e3", "55d4af3a4bdc2d972f8b456f"],
"disableLootOnBots": ["assault"]
} }

View File

@ -104,13 +104,13 @@ export class BotLootGenerator
return; return;
} }
const backpackLootCount = Number( let backpackLootCount = Number(
this.weightedRandomHelper.getWeightedValue<number>(itemCounts.backpackLoot.weights), this.weightedRandomHelper.getWeightedValue<number>(itemCounts.backpackLoot.weights),
); );
const pocketLootCount = Number( let pocketLootCount = Number(
this.weightedRandomHelper.getWeightedValue<number>(itemCounts.pocketLoot.weights), this.weightedRandomHelper.getWeightedValue<number>(itemCounts.pocketLoot.weights),
); );
const vestLootCount = this.weightedRandomHelper.getWeightedValue<number>(itemCounts.vestLoot.weights); let vestLootCount = this.weightedRandomHelper.getWeightedValue<number>(itemCounts.vestLoot.weights);
const specialLootItemCount = Number( const specialLootItemCount = Number(
this.weightedRandomHelper.getWeightedValue<number>(itemCounts.specialItems.weights), this.weightedRandomHelper.getWeightedValue<number>(itemCounts.specialItems.weights),
); );
@ -120,14 +120,23 @@ export class BotLootGenerator
const foodItemCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.food.weights)); const foodItemCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.food.weights));
const drinkItemCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.drink.weights)); const drinkItemCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.drink.weights));
const currencyItemCount = Number( let currencyItemCount = Number(
this.weightedRandomHelper.getWeightedValue<number>(itemCounts.currency.weights), this.weightedRandomHelper.getWeightedValue<number>(itemCounts.currency.weights),
); );
const stimItemCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.stims.weights)); const stimItemCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.stims.weights));
const grenadeCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.grenades.weights)); const grenadeCount = Number(this.weightedRandomHelper.getWeightedValue<number>(itemCounts.grenades.weights));
// Forced pmc healing loot // If bot has been flagged as not having loot, set below counts to 0
if (this.botConfig.disableLootOnBotTypes?.includes(botRole.toLowerCase()))
{
backpackLootCount = 0;
pocketLootCount = 0;
vestLootCount = 0;
currencyItemCount = 0;
}
// Forced pmc healing loot into secure container
if (isPmc && this.pmcConfig.forceHealingItemsIntoSecure) if (isPmc && this.pmcConfig.forceHealingItemsIntoSecure)
{ {
this.addForcedMedicalItemsToPmcSecure(botInventory, botRole); this.addForcedMedicalItemsToPmcSecure(botInventory, botRole);

View File

@ -43,6 +43,8 @@ export interface IBotConfig extends IBaseConfig
currencyStackSize: Record<string, Record<string, Record<string, number>>> currencyStackSize: Record<string, Record<string, Record<string, number>>>
/** Tpls for low profile gas blocks */ /** Tpls for low profile gas blocks */
lowProfileGasBlockTpls: string[] lowProfileGasBlockTpls: string[]
/** What bottypes should be excluded from having loot generated on them (backpack/pocket/vest) */
disableLootOnBotTypes: string[]
} }
/** Number of bots to generate and store in cache on raid start per bot type */ /** Number of bots to generate and store in cache on raid start per bot type */