diff --git a/Libraries/Core/Generators/BotInventoryGenerator.cs b/Libraries/Core/Generators/BotInventoryGenerator.cs index a8b610c7..5cbfd79b 100644 --- a/Libraries/Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/Core/Generators/BotInventoryGenerator.cs @@ -332,7 +332,7 @@ public class BotInventoryGenerator( /// /// Remove non-armored rigs from parameter data /// - /// Equpiment to filter TacticalVest of + /// Equipment to filter TacticalVest of /// Role of bot vests are being filtered for public void FilterRigsToThoseWithProtection(Dictionary> templateEquipment, string botRole) { @@ -523,15 +523,20 @@ public class BotInventoryGenerator( foreach (var modSlot in modPool) { // Get blacklist - equipmentBlacklist.TryGetValue(modSlot.Key, out var blacklistedMods); + if (!equipmentBlacklist.TryGetValue(modSlot.Key, out var blacklistedMods)) + { + blacklistedMods = []; + }; // Get mods not on blacklist - var filteredMods = modPool[modSlot.Key].Where((slotName) => !(blacklistedMods ?? []).Contains(slotName)); - - if (filteredMods.Any()) + var filteredMods = modPool[modSlot.Key].Where((slotName) => !(blacklistedMods).Contains(slotName)); + if (!filteredMods.Any()) { - modPool[modSlot.Key] = filteredMods.ToHashSet(); + _logger.Warning($"Filtering {modSlot.Key} pool resulting in 0 items, skipping filter"); + continue; } + + modPool[modSlot.Key] = filteredMods.ToHashSet(); } return modPool; @@ -589,16 +594,12 @@ public class BotInventoryGenerator( new() { Slot = EquipmentSlots.SecondPrimaryWeapon, - ShouldSpawn = shouldSpawnPrimary - ? _randomUtil.GetChance100(equipmentChances.EquipmentChances["SecondPrimaryWeapon"]) - : false + ShouldSpawn = shouldSpawnPrimary && _randomUtil.GetChance100(equipmentChances.EquipmentChances["SecondPrimaryWeapon"]) }, new() { Slot = EquipmentSlots.Holster, - ShouldSpawn = shouldSpawnPrimary - ? _randomUtil.GetChance100(equipmentChances.EquipmentChances["Holster"]) // Primary weapon = roll for chance at pistol - : true // No primary = force pistol + ShouldSpawn = !shouldSpawnPrimary || _randomUtil.GetChance100(equipmentChances.EquipmentChances["Holster"]) // No primary = force pistol } ]; } diff --git a/Libraries/Core/Services/BotEquipmentModPoolService.cs b/Libraries/Core/Services/BotEquipmentModPoolService.cs index 5473178d..bef52805 100644 --- a/Libraries/Core/Services/BotEquipmentModPoolService.cs +++ b/Libraries/Core/Services/BotEquipmentModPoolService.cs @@ -143,7 +143,7 @@ public class BotEquipmentModPoolService * @param itemTpl items tpl to look up mods for * @returns Dictionary of mods (keys are mod slot names) with array of compatible mod tpls as value */ - public Dictionary>? GetModsForGearSlot(string itemTpl) + public Dictionary> GetModsForGearSlot(string itemTpl) { if (!_armorPoolGenerated) {