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 MWL Camp Build Fix v1.0.0
MWLCampBuildFix.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MWLCampBuildFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MWLCampBuildFix")] [assembly: AssemblyTitle("MWLCampBuildFix")] [assembly: AssemblyVersion("1.0.0.0")] namespace MWLCampBuildFix; [BepInPlugin("dashr.mwlcampbuildfix", "MWL Camp Build Fix", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "dashr.mwlcampbuildfix"; public const string ModName = "MWL Camp Build Fix"; public const string ModVersion = "1.0.0"; private const string MwlGuid = "warpalicious.More_World_Locations_AIO"; private const string PovGuid = "treextr.pathofvalheiman"; private const string AreaObjectName = "MWL_PeacefulArea"; private const string AreaCodeType = "More_World_Locations_AIO.ProtectedLocationPeacefulArea"; internal static ManualLogSource Log; private static int _targetLayer = -1; private static int _fixed; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("dashr.mwlcampbuildfix"); val.PatchAll(typeof(LocationAwakePatch)); Type type = AccessTools.TypeByName("More_World_Locations_AIO.ProtectedLocationPeacefulArea"); MethodInfo methodInfo = ((type != null) ? AccessTools.Method(type, "AddPeacefulArea", (Type[])null, (Type[])null) : null); if (methodInfo != null) { val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "AfterAddPeacefulArea", (Type[])null) { priority = 0 }, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { Log.LogWarning((object)"More World Locations' peaceful-area code was not found (mod missing or changed). Locations are still checked as they load."); } } private static void AfterAddPeacefulArea(GameObject locationRoot) { Fix(locationRoot); } internal static void Fix(GameObject locationRoot) { if ((Object)(object)locationRoot == (Object)null) { return; } Transform val = locationRoot.transform.Find("MWL_PeacefulArea"); if ((Object)(object)val == (Object)null) { return; } int num = TargetLayer(); if (num >= 0 && ((Component)val).gameObject.layer != num) { ((Component)val).gameObject.layer = num; _fixed++; if (_fixed <= 3) { Log.LogInfo((object)("Peaceful area of " + ((Object)locationRoot).name + " moved to the trigger layer: building inside the camp works again.")); } else if (_fixed == 4) { Log.LogInfo((object)"Further peaceful areas are fixed silently."); } } } private static int TargetLayer() { if (_targetLayer < 0) { _targetLayer = LayerMask.NameToLayer("character_trigger"); if (_targetLayer < 0) { _targetLayer = LayerMask.NameToLayer("Ignore Raycast"); } } return _targetLayer; } } [HarmonyPatch(typeof(Location), "Awake")] internal static class LocationAwakePatch { [HarmonyPriority(0)] private static void Postfix(Location __instance) { if ((Object)(object)__instance != (Object)null) { Plugin.Fix(((Component)__instance).gameObject); } } }