Replaced various instances of dictionaries and hashsets with their frozen counterparts

This commit is contained in:
Chomp
2025-03-09 17:12:07 +00:00
parent 3c83018513
commit df8ffa2b16
12 changed files with 37 additions and 25 deletions
@@ -1,3 +1,4 @@
using System.Collections.Frozen;
using SPTarkov.Server.Core.Helpers;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
@@ -40,10 +41,10 @@ public class BotEquipmentModGenerator(
)
{
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected static readonly HashSet<string> _modSightIds = ["mod_sight_front", "mod_sight_rear"];
protected static readonly FrozenSet<string> _modSightIds = ["mod_sight_front", "mod_sight_rear"];
// Slots that hold scopes
protected static readonly HashSet<string> _scopeIds =
protected static readonly FrozenSet<string> _scopeIds =
[
"mod_scope",
"mod_mount",
@@ -55,13 +56,13 @@ public class BotEquipmentModGenerator(
];
// Slots that hold muzzles
protected static readonly HashSet<string> _muzzleIds = ["mod_muzzle", "mod_muzzle_000", "mod_muzzle_001"];
protected static readonly FrozenSet<string> _muzzleIds = ["mod_muzzle", "mod_muzzle_000", "mod_muzzle_001"];
// Slots a weapon can store its stock in
protected static readonly HashSet<string> _stockSlots = ["mod_stock", "mod_stock_000", "mod_stock_001", "mod_stock_akms"];
protected static readonly FrozenSet<string> _stockSlots = ["mod_stock", "mod_stock_000", "mod_stock_001", "mod_stock_akms"];
// Slots that hold cartridges
protected static readonly HashSet<string> _cartridgeHolderSlots =
protected static readonly FrozenSet<string> _cartridgeHolderSlots =
[
"mod_magazine",
"patron_in_weapon",
@@ -1487,7 +1488,7 @@ public class BotEquipmentModGenerator(
/// e.g. mod_magazine / patron_in_weapon_000
/// </summary>
/// <returns>string array</returns>
public HashSet<string> GetAmmoContainers()
public FrozenSet<string> GetAmmoContainers()
{
return _cartridgeHolderSlots;
}