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 SleepAnywhere v1.0.0
SleepAnywhere.dll
Decompiled 2 months 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; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("SleepAnywhere")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SleepAnywhere")] [assembly: AssemblyTitle("SleepAnywhere")] [assembly: AssemblyVersion("1.0.0.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 SleepAnywhere { [BepInPlugin("icebr.sleepanywhere", "Sleep Anywhere", "1.0.0")] public class SleepAnywherePlugin : BaseUnityPlugin { public static ConfigEntry<bool> IgnoreEnemiesNearby; public static ConfigEntry<bool> IgnoreNoRoof; public static ConfigEntry<bool> IgnoreCold; private void Awake() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) IgnoreEnemiesNearby = ((BaseUnityPlugin)this).Config.Bind<bool>("Sleep Restrictions", "IgnoreEnemiesNearby", true, "If true, allows sleeping even if enemies are nearby."); IgnoreNoRoof = ((BaseUnityPlugin)this).Config.Bind<bool>("Sleep Restrictions", "IgnoreNoRoof", false, "If true, allows sleeping without a roof / while exposed."); IgnoreCold = ((BaseUnityPlugin)this).Config.Bind<bool>("Sleep Restrictions", "IgnoreCold", false, "If true, allows sleeping without a nearby fire."); new Harmony("icebr.sleepanywhere").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SleepAnywhere loaded!"); } } [HarmonyPatch(typeof(Bed), "CheckEnemies")] public static class Bed_CheckEnemies_Patch { private static void Postfix(ref bool __result) { if (SleepAnywherePlugin.IgnoreEnemiesNearby.Value) { __result = true; } } } [HarmonyPatch(typeof(Bed), "CheckExposure")] public static class Bed_CheckExposure_Patch { private static void Postfix(ref bool __result) { if (SleepAnywherePlugin.IgnoreNoRoof.Value) { __result = true; } } } [HarmonyPatch(typeof(Bed), "CheckFire")] public static class Bed_CheckFire_Patch { private static void Postfix(ref bool __result) { if (SleepAnywherePlugin.IgnoreCold.Value) { __result = true; } } } }