From 163089c8fe7447f955c71ec5c6aa3ef4bb8737ea Mon Sep 17 00:00:00 2001 From: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Date: Sun, 3 May 2026 22:01:50 -0700 Subject: [PATCH] Fix bot item gen - Scavs now spawn with loot - PMCs now spawn with pockets and weapons - Nuke logger that spams console because bot.json has bad configs --- .../Services/BotEquipmentFilterService.cs | 36 ++++++++++--------- .../Services/BotInventoryContainerService.cs | 2 +- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs b/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs index 140d3140a..bf1ad0ad0 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotEquipmentFilterService.cs @@ -241,7 +241,7 @@ protected void FilterEquipment(BotType baseBotNode, EquipmentFilterDetails? blac var botEquipment = baseBotNode.BotInventory.Equipment[equipmentSlotKvP.Key]; // Skip equipment slot if blacklist doesn't exist / is empty - if (blacklist.Equipment?.TryGetValue(equipmentSlotKvP.Key.ToString(), out var equipmentSlotBlacklist) is null) + if (blacklist.Equipment?.TryGetValue(equipmentSlotKvP.Key.ToString(), out var equipmentSlotBlacklist) is null or false) { continue; } @@ -302,7 +302,7 @@ protected void FilterCartridges(BotType baseBotNode, EquipmentFilterDetails? bla { // Skip cartridge slot if blacklist doesn't exist / is empty if ( - blacklist.Cartridge?.TryGetValue(caliber, out var cartridgeCaliberBlacklist) is null + blacklist.Cartridge?.TryGetValue(caliber, out var cartridgeCaliberBlacklist) is null or false || cartridgeCaliberBlacklist is null || cartridgeCaliberBlacklist.Count == 0 ) @@ -366,13 +366,14 @@ protected void AdjustWeighting( } else { - if (showEditWarnings) - { - if (logger.IsLogEnabled(LogLevel.Debug)) - { - logger.Debug($"Tried to edit a non-existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); - } - } + // Note: Logging disabled for now, because our configs are all kinds of wrong + //if (showEditWarnings) + //{ + // if (logger.IsLogEnabled(LogLevel.Debug)) + // { + // logger.Debug($"Tried to edit a non-existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); + // } + //} } } } @@ -417,19 +418,20 @@ protected void AdjustWeighting( foreach (var itemToEditKvP in poolAdjustmentKvP.Value) // Only make change if item exists as we're editing, not adding { - if (locationToUpdate.ContainsKey(itemToEditKvP.Key) || locationToUpdate[itemToEditKvP.Key] == 0) + if (locationToUpdate.ContainsKey(itemToEditKvP.Key)) { locationToUpdate[itemToEditKvP.Key] = itemToEditKvP.Value; } else { - if (showEditWarnings) - { - if (logger.IsLogEnabled(LogLevel.Debug)) - { - logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); - } - } + // Note: Logging disabled for now, because our configs are all kinds of wrong + //if (showEditWarnings) + //{ + // if (logger.IsLogEnabled(LogLevel.Debug)) + // { + // logger.Debug($"Tried to edit a non - existent item for slot: {poolAdjustmentKvP} {itemToEditKvP}"); + // } + //} } } } diff --git a/Libraries/SPTarkov.Server.Core/Services/BotInventoryContainerService.cs b/Libraries/SPTarkov.Server.Core/Services/BotInventoryContainerService.cs index a824742cf..5a621e22e 100644 --- a/Libraries/SPTarkov.Server.Core/Services/BotInventoryContainerService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/BotInventoryContainerService.cs @@ -12,7 +12,7 @@ namespace SPTarkov.Server.Core.Services; /// /// Service for keeping track of items and their exact position inside a bots container /// -[Injectable] +[Injectable(InjectionType.Singleton)] public class BotInventoryContainerService(ISptLogger logger, ItemHelper itemHelper) { // botId/containerName