Decompiled source of Insomnia v1.0.1

Insomnia.dll

Decompiled 7 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Insomnia")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Insomnia")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("94940d08-1f6f-44dc-ad18-7dbfa8c342ca")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Insomnia;

[BepInPlugin("TTR_Freon.Insomnia", "Insomnia", "1.0.1")]
[BepInProcess("valheim.exe")]
public class Insomnia : BaseUnityPlugin
{
	[HarmonyPatch(typeof(EnvMan), "CanSleep")]
	private class Sleep_Patch
	{
		[HarmonyPrefix]
		private static bool SetCanSleep(ref bool __result)
		{
			__result = false;
			return false;
		}
	}

	private readonly Harmony harmony = new Harmony("TTR_Freon.Insomnia");

	private void Awake()
	{
		harmony.PatchAll();
	}
}