Made various methods static + updated private methods to be protected

This commit is contained in:
Chomp
2025-03-14 19:16:26 +00:00
parent 56957147aa
commit 8c0470df36
3 changed files with 9 additions and 8 deletions
@@ -1488,7 +1488,7 @@ public class BotEquipmentModGenerator(
/// e.g. mod_magazine / patron_in_weapon_000
/// </summary>
/// <returns>string array</returns>
public FrozenSet<string> GetAmmoContainers()
public static FrozenSet<string> GetAmmoContainers()
{
return _cartridgeHolderSlots;
}
@@ -452,7 +452,7 @@ public class ItemHelper(
// Get all soft insert slot ids
// @returns A List of soft insert ids (e.g. soft_armor_back, helmet_top)
public FrozenSet<string> GetSoftInsertSlotIds()
public static FrozenSet<string> GetSoftInsertSlotIds()
{
return _softInsertIds;
}
@@ -1981,7 +1981,7 @@ public class ItemHelper(
// Get a list of slot names that hold removable plates
// Returns Array of slot ids (e.g. front_plate)
public FrozenSet<string> GetRemovablePlateSlotIds()
public static FrozenSet<string> GetRemovablePlateSlotIds()
{
return _removablePlateSlotIds;
}
@@ -55,7 +55,7 @@ public class JsonUtil
}
};
private static JsonSerializerOptions jsonSerializerOptionsIndented = new(jsonSerializerOptionsNoIndent)
protected static JsonSerializerOptions jsonSerializerOptionsIndented = new(jsonSerializerOptionsNoIndent)
{
WriteIndented = true
};
@@ -147,18 +147,19 @@ public class JsonUtil
/// Convert an object into JSON
/// </summary>
/// <param name="obj">Object to serialise</param>
/// <param name="type">Type of object being serialsied</param>
/// <param name="type">Type of object being serialized</param>
/// <param name="indented">Should JSON be indented</param>
/// <returns></returns>
/// <returns>Serialized text</returns>
public string? Serialize(object? obj, Type type, bool indented = false)
{
return obj == null ? null : JsonSerializer.Serialize(obj, type, indented ? jsonSerializerOptionsIndented : jsonSerializerOptionsNoIndent);
}
private void AddConverter(JsonSerializerOptions options, JsonConverter newConverter)
protected static void AddConverter(JsonSerializerOptions options, JsonConverter newConverter)
{
if (!options.Converters.Any(c => c.GetType() == newConverter.GetType()))
if (options.Converters.All(c => c.GetType() != newConverter.GetType()))
{
// Doesn't exist, add
options.Converters.Add(newConverter);
}
}