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 FastRested v0.1.0
BepInEx\plugins\FastRested\FastRested.dll
Decompiled 2 weeks agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Jotunn; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("FastRested")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FastRested")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] namespace FastRested; [BepInPlugin("com.valheimmods100.fastrested", "FastRested", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class FastRested : BaseUnityPlugin { public const string PluginGUID = "com.valheimmods100.fastrested"; public const string PluginName = "FastRested"; public const string PluginVersion = "0.1.0"; private static readonly int RestedHash = StringExtensionMethods.GetStableHashCode("Rested"); private static ConfigEntry<bool> Enable; private static ConfigEntry<float> GrantDelay; private static ConfigEntry<int> MinComfort; private float timer; private static float LastTtl; private void Awake() { Enable = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable", true, "Grant Rested early when sheltered with comfort."); GrantDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "GrantDelay", 2f, "Seconds between grant checks."); MinComfort = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MinComfort", 1, "Minimum comfort level that triggers the grant."); Logger.LogInfo((object)"FastRested has landed"); } private void Update() { if (!Enable.Value) { return; } timer += Time.deltaTime; if (timer < GrantDelay.Value) { return; } timer = 0f; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !localPlayer.InShelter() || localPlayer.GetComfortLevel() < MinComfort.Value) { return; } SEMan sEMan = ((Character)localPlayer).GetSEMan(); if (sEMan == null) { return; } StatusEffect statusEffect = sEMan.GetStatusEffect(RestedHash); if ((Object)(object)statusEffect == (Object)null) { sEMan.AddStatusEffect(RestedHash, true, 1, 0f, (short)0); statusEffect = sEMan.GetStatusEffect(RestedHash); if ((Object)(object)statusEffect != (Object)null) { LastTtl = statusEffect.m_ttl; } Logger.LogInfo((object)"[FastRested] Rested granted early."); } else if (LastTtl > 0f && statusEffect.m_ttl < LastTtl) { statusEffect.m_ttl = LastTtl; } } }