diff --git a/Nautilus/Handlers/EatableHandler.cs b/Nautilus/Handlers/EatableHandler.cs deleted file mode 100644 index a07880535..000000000 --- a/Nautilus/Handlers/EatableHandler.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Nautilus.Patchers; - -namespace Nautilus.Handlers; - -/// -/// A handler class for modyfing the data of edible objects (objects with the component). -/// -public static class EatableHandler -{ -#if SUBNAUTICA - /// - /// Use this to change the values of a specific TechType. - /// - /// The TechType of the item you want to change. - /// The food value you want to change it to. - /// The water value you want to change it to. - /// Whether or not the item decomposes over time - public static void ModifyEatable(TechType item, float food, float water, bool decomposes) - { - EatablePatcher.EditedEatables.Add(item, new EditedEatableValues() - { - food = food, - water = water, - decomposes = decomposes, - }); - } - -#elif BELOWZERO - /// - /// Use this to change the values of a specific TechType - /// - /// the techtype of the item you want to change - /// the food value you want to change it to - /// the water value you want to change it to - /// whether or not the item decomposes over time - /// how much you want to set the health gained from eating this item to - /// How much eating this item changes the current cold meter value.
- /// Negative values heats up the player while positive values makes the player colder. - /// how many times the item can be used before being consumed - public static void ModifyEatable(TechType item, float food, float water, bool decomposes, float health, float coldValue, int maxCharges) - { - EatablePatcher.EditedEatables.Add(item, new EditedEatableValues() - { - food = food, - water = water, - decomposes = decomposes, - health = health, - maxCharges = maxCharges, - coldValue = coldValue - }); - } -#endif - internal class EditedEatableValues - { - public bool decomposes; - public float food; - public float water; -#if BELOWZERO - public float health; - public int maxCharges; - public float coldValue; -#endif - } -} \ No newline at end of file diff --git a/Nautilus/Initializer.cs b/Nautilus/Initializer.cs index 034a593bc..8782ad8a1 100644 --- a/Nautilus/Initializer.cs +++ b/Nautilus/Initializer.cs @@ -54,7 +54,6 @@ public class Initializer : BaseUnityPlugin TooltipPatcher.Patch(_harmony); SurvivalPatcher.Patch(_harmony); CustomSoundPatcher.Patch(_harmony); - EatablePatcher.Patch(_harmony); MaterialUtils.Patch(); FontReferencesPatcher.Patch(_harmony); VehicleUpgradesPatcher.Patch(_harmony); diff --git a/Nautilus/Patchers/EatablePatcher.cs b/Nautilus/Patchers/EatablePatcher.cs deleted file mode 100644 index 624cbd2b7..000000000 --- a/Nautilus/Patchers/EatablePatcher.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using HarmonyLib; -using Nautilus.Handlers; -using Nautilus.Utility; - -namespace Nautilus.Patchers; - -using static EatableHandler; - -internal class EatablePatcher -{ - internal static readonly IDictionary EditedEatables = new SelfCheckingDictionary("EditedEatableValues", TechTypeExtensions.sTechTypeComparer); - - public static void Patch(Harmony harmony) - { - harmony.Patch(AccessTools.Method(typeof(Eatable), nameof(Eatable.Awake)), - new HarmonyMethod(typeof(EatablePatcher), nameof(AwakePrefix))); - - InternalLogger.Debug("EatablePatcher is done."); - } - private static void AwakePrefix(Eatable __instance) - { - TechType tt = CraftData.GetTechType(__instance.gameObject); - if (EditedEatables.TryGetValue(tt, out EditedEatableValues value)) - { - __instance.foodValue = value.food; - __instance.waterValue = value.water; - __instance.decomposes = value.decomposes; -#if BELOWZERO - __instance.healthValue = value.health; - __instance.maxCharges = value.maxCharges; - __instance.coldMeterValue = value.coldValue; -#endif - } - } -} \ No newline at end of file