using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NotSoNeedyCraftingStation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NotSoNeedyCraftingStation")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("21f833cf-ad24-4298-b7dc-3b101d76a7fc")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace NotSoNeedyCraftingStation; [BepInPlugin("uk.co.oliapps.valheim.notsoneedycraftingstation", "Not So Needy Crafting Station", "1.2.0")] public class NotSoNeedyCraftingStation : BaseUnityPlugin { private static ConfigEntry modEnabled; private static ConfigEntry disableWeatherDamageForCraftingStation; public void Awake() { modEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Mod enabled", true, "Sets whether this mod is enabled"); disableWeatherDamageForCraftingStation = ((BaseUnityPlugin)this).Config.Bind("General", "Disable Rain Damage", false, "Disables rain damage for the crafting station"); ((BaseUnityPlugin)this).Config.Save(); if (modEnabled.Value) { Harmony.CreateAndPatchAll(typeof(NotSoNeedyCraftingStation), (string)null); } } [HarmonyPatch(typeof(CraftingStation), "Start")] [HarmonyPostfix] public static void CraftingStation_Start(ref CraftingStation __instance) { if (disableWeatherDamageForCraftingStation.Value) { WearNTear component = ((Component)__instance).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_noRoofWear = true; } } } [HarmonyPatch(typeof(CraftingStation), "CheckUsable")] [HarmonyPrefix] [HarmonyPriority(0)] public static bool CheckUsable(ref CraftingStation __instance, Player player, bool showMessage, ref bool __result) { __instance.m_craftRequireRoof = false; return true; } }