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 NoStuckCrit v1.0.2
NoStuckCrit.dll
Decompiled 2 weeks agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace NoStuckCrit; [BepInPlugin("local.nostuckcrit", "NoStuckCrit", "1.0.2")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static ConfigEntry<bool> On; private void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; On = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Clear a critical injury that the game has failed to clear."); new Harmony("local.nostuckcrit").PatchAll(typeof(Plugin).Assembly); Log.LogInfo((object)"NoStuckCrit loaded"); } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] internal static class CritPatch { private static void Postfix(PlayerControllerB __instance) { if (!__instance.criticallyInjured || __instance.health < 20 || !Plugin.On.Value) { return; } GameNetworkManager instance = GameNetworkManager.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)__instance != (Object)(object)instance.localPlayerController) && !__instance.isPlayerDead && __instance.isPlayerControlled) { __instance.MakeCriticallyInjured(false); if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.UpdateHealthUI(__instance.health, false); } Plugin.Log.LogInfo((object)("Cleared a stuck critical injury at " + __instance.health + " health")); } } }