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 ProperOxygen v1.0.0
BepInEx/plugins/ProperOxygen.dll
Decompiled a year agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ProperOxygen")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ProperOxygen")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1E213CD6-76DB-4785-A157-2C2BEB3F6C49")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Kilograms { [BepInPlugin("Filigrani.ProperOxygen", "ProperOxygen", "1.0.0")] public class ProperOxygenPlugin : BaseUnityPlugin { private const string MyGUID = "Filigrani.ProperOxygen"; private const string PluginName = "ProperOxygen"; private const string VersionString = "1.0.0"; private static readonly Harmony Harmony = new Harmony("Filigrani.ProperOxygen"); public static ManualLogSource Log = new ManualLogSource("ProperOxygen"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ProperOxygen, VersionString: 1.0.0"); } } } namespace ProperOxygen.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatches { public static float s_ExtendedOxygenTimer = 0.3f; public static float s_DrowningDamageTaken = 0f; public static float s_DrowningRegenerationTimer = 0f; public static float s_DrowningRegenerationTimeRate = 0.15f; public static int s_DrowningRegenerationDelta = 1; public static int s_DrowningDamage = 20; [HarmonyPostfix] [HarmonyPatch("SetFaceUnderwaterFilters")] public static void SetFaceUnderwaterFilters(PlayerControllerB __instance) { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (__instance.isPlayerDead) { s_ExtendedOxygenTimer = 0.3f; return; } if (StartOfRound.Instance.drowningTimer >= 0.9f && s_DrowningDamageTaken > 0f && s_DrowningRegenerationTimer < Time.time) { s_DrowningRegenerationTimer = Time.time + s_DrowningRegenerationTimeRate; s_DrowningDamageTaken -= s_DrowningRegenerationDelta; __instance.health += s_DrowningRegenerationDelta; if (__instance.health > 100) { __instance.health = 100; } HUDManager.Instance.UpdateHealthUI(__instance.health, false); Debug.Log((object)("[Oxygen] Regenerating taken damage: " + s_DrowningRegenerationDelta + " current health " + __instance.health)); } if (StartOfRound.Instance.drowningTimer < 1f && StartOfRound.Instance.drowningTimer > 0.3f) { HUDManager.Instance.DisplayStatusEffect("Oxygen: " + Mathf.Round(StartOfRound.Instance.drowningTimer * 100f) + "%"); } else { if (!(StartOfRound.Instance.drowningTimer <= 0.3f)) { return; } StartOfRound.Instance.drowningTimer = 0.3f; s_ExtendedOxygenTimer -= Time.deltaTime / 10f; if (s_ExtendedOxygenTimer < 0f) { s_ExtendedOxygenTimer = 0.15f; __instance.DamagePlayer(s_DrowningDamage, false, false, (CauseOfDeath)9, 0, false, default(Vector3)); s_DrowningDamageTaken += s_DrowningDamage; Debug.Log((object)("[Oxygen] Deal damage: " + s_DrowningDamage + " current health " + __instance.health)); if (__instance.health <= 0) { Debug.Log((object)"[Oxygen] Drowned, removing pending oxygen regeneration."); StartOfRound.Instance.drowningTimer = 1f; s_DrowningDamageTaken = 0f; } } } } } }