From 44f18c5c107ea0aaa820c9fefbc4ad0e00bc2719 Mon Sep 17 00:00:00 2001 From: CWX Date: Wed, 9 Apr 2025 23:12:16 +0100 Subject: [PATCH] Move List to field so its not created each time --- .../SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs index a1f1d1c4..78baec81 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs @@ -53,6 +53,8 @@ public class BotInventoryGenerator( EquipmentSlots.Earpiece ]; + private readonly HashSet _slotsToCheck = [EquipmentSlots.Pockets.ToString(), EquipmentSlots.SecuredContainer.ToString()]; + /// /// Add equipment/weapons/loot to bot /// @@ -457,8 +459,7 @@ public class BotInventoryGenerator( /// true when item added public bool GenerateEquipment(GenerateEquipmentProperties settings) { - HashSet slotsToCheck = [EquipmentSlots.Pockets.ToString(), EquipmentSlots.SecuredContainer.ToString()]; - double? spawnChance = slotsToCheck.Contains(settings.RootEquipmentSlot.ToString()) + double? spawnChance = _slotsToCheck.Contains(settings.RootEquipmentSlot.ToString()) ? 100 : settings.SpawnChances.EquipmentChances.GetValueOrDefault(settings.RootEquipmentSlot.ToString());