Decompiled source of Insomnia v1.1.0

Insomnia.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
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("301F5306-DF59-4192-947E-0A4FB8E4B131")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Insomnia;

[BepInPlugin("TTR_Freon.Insomnia", "Insomnia", "1.1.0")]
[BepInProcess("valheim.exe")]
public class Insomnia : BaseUnityPlugin
{
	[HarmonyPatch(typeof(EnvMan), "CanSleep")]
	private class SleepPatch
	{
		[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();
	}
}