Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PortalRecall v1.0.1
PortalRecall.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("PortalRecall")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("PortalRecall")] [assembly: AssemblyTitle("PortalRecall")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PortalRecall { [BepInPlugin("justinrampage.portalrecall", "Portal Recall", "1.0.1")] public sealed class PortalRecallPlugin : BaseUnityPlugin { public const string PluginGuid = "justinrampage.portalrecall"; public const string PluginName = "Portal Recall"; public const string PluginVersion = "1.0.1"; internal static ConfigEntry<bool> RequireWorkbench; private Harmony _harmony; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown RequireWorkbench = ((BaseUnityPlugin)this).Config.Bind<bool>("Building", "RequireWorkbench", false, "If true, buildings retain their normal workbench requirements. If false, remove workbench proximity requirements for all building pieces that specifically use a workbench. Other crafting stations are unchanged. Restart Valheim after changing this setting."); _harmony = new Harmony("justinrampage.portalrecall"); _harmony.PatchAll(typeof(PortalRecallPlugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Portal Recall loaded. GET YOUR ASS TO MEADOWS!"); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(PieceTable), "UpdateAvailable")] internal static class PortalCostPatch { [HarmonyPostfix] private static void AfterUpdateAvailable(PieceTable __instance) { if ((Object)(object)__instance == (Object)null || __instance.m_pieces == null) { return; } foreach (GameObject piece in __instance.m_pieces) { if ((Object)(object)piece == (Object)null) { continue; } Piece component = piece.GetComponent<Piece>(); if ((Object)(object)component == (Object)null) { continue; } if (((Object)piece).name == "portal_wood" && component.m_resources != null) { Requirement[] resources = component.m_resources; foreach (Requirement val in resources) { if (val != null) { val.m_amount = 0; } } } if (PortalRecallPlugin.RequireWorkbench != null && !PortalRecallPlugin.RequireWorkbench.Value && (Object)(object)component.m_craftingStation != (Object)null && component.m_craftingStation.m_name == "$piece_workbench") { component.m_craftingStation = null; } } } } }