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 AccurateApparatus v3.0.1
AccurateApparatus.dll
Decompiled 10 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using AccurateApparatus.Patches; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AccurateApparatus")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AccurateApparatus")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("9663e39f-ec79-4446-bdf9-11a003a50b32")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace AccurateApparatus { [BepInPlugin("rogan.AccurateApparatus", "Accurate Apparatus", "3.0.1")] public class AccurateApparatusBase : BaseUnityPlugin { private const string modGUID = "rogan.AccurateApparatus"; private const string modName = "Accurate Apparatus"; private const string modVersion = "3.0.1"; private readonly Harmony harmony = new Harmony("rogan.AccurateApparatus"); private static AccurateApparatusBase Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("rogan.AccurateApparatus"); mls.LogInfo((object)"AccurateApparatus Started!"); harmony.PatchAll(typeof(AccurateApparatusBase)); harmony.PatchAll(typeof(PlayerControllerPatch)); } } } namespace AccurateApparatus.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerPatch { public static PlayerControllerB NetworkController; public static int ClientId; public static string PlayerUsername; public static int Health = 0; public static float Timer = 0f; public static int[] PlayerHealth = new int[4]; [HarmonyPatch("Update")] [HarmonyPostfix] public static void HoldDamagePatch(ref PlayerControllerB __instance) { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) || !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)) { return; } NetworkController = GameNetworkManager.Instance.localPlayerController; PlayerUsername = NetworkController.playerUsername; ClientId = (int)NetworkController.playerClientId; if (NetworkController.isPlayerDead) { return; } if (!StartOfRound.Instance.inShipPhase) { if (!(__instance.playerUsername == PlayerUsername) || !((Object)(object)__instance.currentlyHeldObjectServer != (Object)null) || (!(((Object)__instance.currentlyHeldObjectServer).name.ToString() == "LungApparatus(Clone)") && !(((Object)__instance.currentlyHeldObjectServer).name.ToString() == "LungApparatusTurnedOff(Clone)"))) { return; } Timer += Time.fixedDeltaTime / 2.05f; if (!(Timer > 1.7f)) { return; } Health = __instance.health; if (Health == 0) { __instance.DamagePlayer(int.MaxValue, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); return; } if (Health < 100) { __instance.bleedingHeavily = true; } if (Health > 0 && Health <= 20) { PlayerControllerB obj = __instance; obj.health -= 3; } else { PlayerControllerB obj2 = __instance; obj2.health--; } Timer = 0f; HUDManager.Instance.UIAudio.Stop(); HUDManager.Instance.HUDAnimator.ResetTrigger("SmallHit"); HUDManager.Instance.HUDAnimator.ResetTrigger("CriticalHit"); HUDManager.Instance.UpdateHealthUI(__instance.health, false); } else { __instance.bleedingHeavily = false; } } } }