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 Oxygen v1.8.3
BepInEx/plugins/Oxygen.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CustomHUD; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Oxygen.Configuration; using Oxygen.Extras; using Oxygen.General; using Oxygen.Items; using Oxygen.NetcodePatcher; using Oxygen.Patches; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.UI; using Woecust.ImmersiveVisor; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("EladsHUD")] [assembly: IgnoresAccessChecksTo("ImmersiveVisor")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Oxygen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Don't forget to refill oxygen canisters!")] [assembly: AssemblyFileVersion("1.8.3.0")] [assembly: AssemblyInformationalVersion("1.8.3+4cef01233e956d19adfa24495a6cb7ff32e0ade5")] [assembly: AssemblyProduct("Oxygen")] [assembly: AssemblyTitle("Oxygen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.8.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Oxygen { public class OxygenInputClass : LcInputActions { [InputAction(/*Could not decode attribute arguments.*/)] public InputAction DieEarlyButton { get; set; } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction TransferOxygenButton { get; set; } } [BepInPlugin("consequential.Oxygen", "Oxygen", "1.8.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class OxygenBase : BaseUnityPlugin { private readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen"); public const string modName = "Oxygen"; public const string modGUID = "consequential.Oxygen"; public const string modVersion = "1.8.3"; private readonly Harmony harmony = new Harmony("consequential.Oxygen"); internal static OxygenInputClass InputActionsInstance; private const string immersiveVisorGUID = "ImmersiveVisor"; private const string shyHUDGUID = "ShyHUD"; private const string eladsHUDGUID = "me.eladnlg.customhud"; private const string LCVRGUID = "io.daxcess.lcvr"; internal AudioClip[] inhalesSFX = Array.Empty<AudioClip>(); internal AudioClip[] heavyInhalesSFX = Array.Empty<AudioClip>(); internal GameObject oxyAudioExample; internal GameObject oxyCharger; internal AudioClip[] oxyChargerSFX; internal Item oxyBoost; internal RefillSync Refills => OxygenConfig.Sync.Refills; internal OxygenTransfer Transfers { get; } = new OxygenTransfer(); public static OxygenConfig OxygenConfig { get; private set; } public bool IsShyHUDFound { get; private set; } public bool IsImmersiveVisorFound { get; private set; } public bool IsEladsHUDFound { get; private set; } public bool IsLCVRFound { get; private set; } public static OxygenBase Instance { get; private set; } private void Update() { OxygenConfig?.Sync.Refills.Tick(); if (OxygenConfig != null) { Transfers.Tick(); } } internal static void UpdateCustomItemPrice(Item item, int price) { Items.UpdateShopItemPrice(item, price); } private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)this).gameObject; ((Object)gameObject).hideFlags = (HideFlags)(((Object)gameObject).hideFlags | 0x34); if ((Object)(object)Instance == (Object)null) { Instance = this; } mls.LogInfo((object)"Oxygen is loading..."); NetworkPatcher(); IsShyHUDFound = CheckForDependency("ShyHUD"); IsImmersiveVisorFound = CheckForDependency("ImmersiveVisor"); IsEladsHUDFound = CheckForDependency("me.eladnlg.customhud"); IsLCVRFound = CheckForDependency("io.daxcess.lcvr"); AssetBundle val = Utilities.LoadAssetFromStream("Oxygen.Assets.oxygenaudio"); if ((Object)(object)val == (Object)null) { return; } inhalesSFX = Utilities.LoadAudioClips(val, "Assets/Oxygen/OxygenAudio/Inhale_1.wav", "Assets/Oxygen/OxygenAudio/Inhale_2.wav", "Assets/Oxygen/OxygenAudio/Inhale_3.wav"); heavyInhalesSFX = Utilities.LoadAudioClips(val, "Assets/Oxygen/OxygenAudio/heavy_Inhale_1.wav", "Assets/Oxygen/OxygenAudio/heavy_Inhale_2.wav", "Assets/Oxygen/OxygenAudio/heavy_Inhale_end.wav"); oxyChargerSFX = Utilities.LoadAudioClips(val, "Assets/Oxygen/OxyCharger/Audio/OxyChargeSFX.wav", "Assets/Oxygen/OxyCharger/Audio/OxyChargeSFX2.wav", "Assets/Oxygen/OxyCharger/Audio/OxyChargeSFX3.wav"); AssetBundle val2 = Utilities.LoadAssetFromStream("Oxygen.Assets.oxygenprefabs"); if (!((Object)(object)val2 == (Object)null)) { oxyAudioExample = val2.LoadAsset<GameObject>("Assets/Oxygen/OxygenAudio/OxygenAudio.prefab"); oxyCharger = val2.LoadAsset<GameObject>("Assets/Oxygen/OxyCharger/OxyCharger.prefab"); oxyCharger.AddComponent<ChargerVisuals>(); oxyCharger.AddComponent<ChargerGauge>(); oxyBoost = val2.LoadAsset<Item>("Assets/Oxygen/OxyBoost/OxyBoostItem.asset"); mls.LogInfo((object)"Assets are loaded!"); InputActionsInstance = new OxygenInputClass(); OxygenConfig = new OxygenConfig(((BaseUnityPlugin)this).Config); mls.LogInfo((object)"Config is loaded."); harmony.PatchAll(typeof(HUDPatch)); harmony.PatchAll(typeof(ConfigNetworkManagerPatch)); harmony.PatchAll(typeof(ConfigTerminalPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(GameNetworkManagerParch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); if (IsLCVRFound) { harmony.PatchAll(typeof(VrTransferHoverPatch)); } harmony.PatchAll(typeof(ShipBuildModeManagerPatch)); ChargerUnlockable.Register(oxyCharger); RegisterItems(); mls.LogInfo((object)"Oxygen is loaded. Don't forget to refill oxygen canisters!"); } } private void NetworkPatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } private bool CheckForDependency(string guid) { mls.LogDebug((object)("Checking for " + guid + "...")); if (Chainloader.PluginInfos.ContainsKey(guid)) { Chainloader.PluginInfos.TryGetValue(guid, out var value); if (value != null) { mls.LogDebug((object)$"{guid}:{value.Metadata.Version} is present!"); return true; } mls.LogError((object)("Detected " + guid + ", but could not get plugin info...")); } return false; } private void RegisterItems() { if ((Object)(object)oxyBoost == (Object)null) { mls.LogError((object)"Could not register OxyBoost item because its asset failed to load."); return; } if ((Object)(object)oxyBoost.spawnPrefab == (Object)null) { mls.LogError((object)"Could not register OxyBoost item because its spawn prefab is missing."); return; } NetworkPrefabs.RegisterNetworkPrefab(oxyBoost.spawnPrefab); Utilities.FixMixerGroups(oxyBoost.spawnPrefab); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; val.displayText = "Limited air supply, useful in situations when you cannot quickly refill oxygen canisters!"; Items.RegisterShopItem(oxyBoost, (TerminalNode)null, (TerminalNode)null, val, OxygenConfig.oxyBoost_price.Value); mls.LogInfo((object)"Custom items are loaded!"); } internal void UpdateOxyBoostShop() { OxyBoostShop.Update(oxyBoost, OxygenConfig.enable_OxyBoost.Value, OxygenConfig.oxyBoost_price.Value); } } } namespace Oxygen.Patches { [HarmonyPatch] internal static class ConfigNetworkManagerPatch { private static IEnumerable<MethodBase> TargetMethods() { yield return AccessTools.Method(typeof(NetworkManager), "StartHost", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(NetworkManager), "StartServer", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(NetworkManager), "StartClient", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Started(NetworkManager __instance, bool __result) { if (__result) { OxygenBase.OxygenConfig.Sync.StartSession(__instance); } } } [HarmonyPatch(typeof(Terminal))] internal static class ConfigTerminalPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] private static void BeforeAwake() { OxyBoostShop.Reset(); ChargerUnlockable.Reset(); } [HarmonyPostfix] [HarmonyPatch("Awake")] private static void AfterAwake() { ChargerUnlockable.Prepare(StartOfRound.Instance); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void AfterStart() { OxygenBase.Instance.UpdateOxyBoostShop(); } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerParch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(ref GameNetworkManager __instance) { ((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(OxygenBase.Instance.oxyCharger); } } [HarmonyPatch(typeof(HUDManager))] internal class HUDPatch { public static ManualLogSource mls = Logger.CreateLogSource("Oxygen > HUDPatch"); [HarmonyPostfix] [HarmonyPatch("Start")] public static void BuildHUD() { mls.LogInfo((object)"Initializing HUD"); OxygenInit.Init(); DieEarly.Init(); } [HarmonyPostfix] [HarmonyPatch("Update")] public static void UpdatePatch() { OxygenLogic.RunLogic(); } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch : MonoBehaviour { private static readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > PlayerControllerBPatch"); [HarmonyPostfix] [HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")] private static void TransferHover(PlayerControllerB __instance) { OxygenBase.Instance?.Transfers.Hover(__instance); } [HarmonyPostfix] [HarmonyPatch("ConnectClientToPlayerObject")] [HarmonyPriority(0)] public static void ConnectClientToPlayerObject_Postfix(PlayerControllerB __instance) { AudioController.Init_AudioSource(__instance.playersManager.thisClientPlayerId); GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ThirdPersonEmotesControlTips/DieEarly/"); if ((Object)(object)val != (Object)null) { mls.LogDebug((object)"DieEarly object was copied, destroying it."); Object.Destroy((Object)(object)val); } } [HarmonyPostfix] [HarmonyPatch("KillPlayer")] private static void KillPlayer_Postfix(PlayerControllerB __instance) { if (!((Object)(object)__instance == (Object)null) && __instance.isPlayerDead && ((NetworkBehaviour)__instance).IsOwner) { OxygenInit.Percent = 1f; __instance.drunkness = 0f; mls.LogInfo((object)"Player is dead. Oxygen level was recovered"); OxygenLogic.ResetAllNotifications(); DieEarly.DisplayDieEarlyMeter(value: false); } } [HarmonyPrefix] [HarmonyPatch("LateUpdate")] private static void LateUpdate_Prefix(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) { LowOxygenAlarm.Update(__instance); if (!__instance.isPlayerDead) { OxygenLogic.ShowNotifications(__instance); } } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { private static readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > RoundManagerPatch"); [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix() { MoonsDicts.UpdateMoonsValues(); } [HarmonyPostfix] [HarmonyPriority(0)] [HarmonyPatch("Start")] private static void Start_Postfix(RoundManager __instance) { string text = "\nUse these moons names in the config:\n\n"; SelectableLevel[] levels = __instance.playersManager.levels; foreach (SelectableLevel val in levels) { text = text + Utilities.GetNumberlessPlanetName(val.PlanetName) + "\n"; } mls.LogInfo((object)text); } [HarmonyPostfix] [HarmonyPatch("FinishGeneratingLevel")] private static void FinishGeneratingLevel_Postfix(RoundManager __instance) { WeatherHandler.UpdateWeatherType(__instance.currentLevel); } } [HarmonyPatch(typeof(ShipBuildModeManager))] internal static class ShipBuildModeManagerPatch { private static readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > ShipBuildModeManagerPatch"); private static readonly FieldInfo placingObjectField = AccessTools.Field(typeof(ShipBuildModeManager), "placingObject"); [HarmonyPostfix] [HarmonyPatch("CreateGhostObjectAndHighlight")] private static void AfterCreateGhost(ShipBuildModeManager __instance) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) object? obj = placingObjectField?.GetValue(__instance); PlaceableShipObject val = (PlaceableShipObject)((obj is PlaceableShipObject) ? obj : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.parentObject == (Object)null) && !((Object)(object)((Component)val.parentObject).gameObject != (Object)(object)OxygenInit.oxyCharger)) { ChargerUnlockable.SetPlacementHeight(val, __instance.ghostObject.rotation); } } [HarmonyPrefix] [HarmonyPatch("PlayerMeetsConditionsToBuild")] private static bool PlayerMeetsConditionsToBuild_Prefix(ShipBuildModeManager __instance, ref bool __result, bool log = true) { if (!__instance.InBuildMode) { return true; } object? obj = placingObjectField?.GetValue(__instance); PlaceableShipObject val = (PlaceableShipObject)((obj is PlaceableShipObject) ? obj : null); if ((Object)(object)val == (Object)null) { return true; } int unlockableID = val.unlockableID; int num = StartOfRound.Instance?.unlockablesList?.unlockables?.Count ?? (-1); if (unlockableID < 0 || num < 0 || unlockableID >= num) { mls.LogWarning((object)$"Cancelling build mode for invalid unlockableID. Object='{((Object)val).name}', unlockableID={unlockableID}, unlockablesCount={num}"); __instance.CancelBuildMode(true); __result = false; return false; } return true; } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { public static ManualLogSource mls = Logger.CreateLogSource("Oxygen > StartOfRoundPatch"); [HarmonyPrefix] [HarmonyPatch("SpawnUnlockable")] private static bool BeforeSpawn(StartOfRound __instance, int unlockableIndex) { return ChargerUnlockable.BeforeSpawn(__instance, unlockableIndex); } [HarmonyPrefix] [HarmonyPatch("ReturnUnlockableFromStorageServerRpc")] private static bool BeforeReturnFromStorage(StartOfRound __instance, int unlockableID) { return ChargerUnlockable.CanReturnFromStorage(__instance, unlockableID); } [HarmonyPostfix] [HarmonyPatch("ResetShipFurniture")] private static void AfterFurnitureReset() { ChargerUnlockable.ResetFurniture(); } [HarmonyPostfix] [HarmonyPatch("SetShipReadyToLand")] private static void AfterShipReady() { ChargerUnlockable.Refresh(); ChargerUnlockable.RestoreInteraction(); } [HarmonyPostfix] [HarmonyPatch("ShipHasLeft")] private static void ShipHasLeft_Patch() { if (OxygenBase.OxygenConfig.recoverOxygen_ShipLeft.Value) { OxygenInit.Percent = 1f; DieEarly.DisplayDieEarlyMeter(value: false); mls.LogInfo((object)"Ship has left, oxygen was recovered."); } } [HarmonyPostfix] [HarmonyPatch("OpenShipDoors")] private static void OpenShipDoors_PostFix() { if (OxygenBase.OxygenConfig.recoverOxygen_StartOfRound.Value) { OxygenInit.Percent = 1f; mls.LogInfo((object)"Round just started, oxygen was recovered."); } } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Patch_RoundStart(StartOfRound __instance) { ChargerUnlockable.StartRound(__instance); OxygenBase.OxygenConfig.RefreshEffects(); } } [HarmonyPatch] internal static class VrTransferHoverPatch { private static IEnumerable<MethodBase> TargetMethods() { if (Chainloader.PluginInfos.TryGetValue("io.daxcess.lcvr", out var value)) { MethodInfo methodInfo = AccessTools.Method(((object)value.Instance).GetType().Assembly.GetType("LCVR.Player.VRController"), "LateUpdate", (Type[])null, (Type[])null); if (methodInfo != null) { yield return methodInfo; } } } [HarmonyPostfix] [HarmonyPriority(0)] private static void Refresh(object __instance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; OxygenTransfer oxygenTransfer = OxygenBase.Instance?.Transfers; if (!((Object)(object)val == (Object)null) && oxygenTransfer != null && VrCompatibility.Active) { oxygenTransfer.Hover(val); Vector3? hoverPoint = oxygenTransfer.HoverPoint; if (hoverPoint.HasValue) { Vector3 valueOrDefault = hoverPoint.GetValueOrDefault(); VrCompatibility.PlacePrompt(__instance, valueOrDefault); } } } } } namespace Oxygen.Items { internal class OxyBoost : TetraChemicalItem { private static readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > OxyBoost"); public IEnumerator UseTZPAnimation() { base.thisAudioSource.PlayOneShot(base.holdCanSFX); WalkieTalkie.TransmitOneShotAudio(base.previousPlayerHeldBy.itemAudio, base.holdCanSFX, 1f); yield return (object)new WaitForSeconds(0.75f); base.emittingGas = true; if (((NetworkBehaviour)this).IsOwner) { base.localHelmetSFX.Play(); base.localHelmetSFX.PlayOneShot(base.twistCanSFX); } else { base.thisAudioSource.clip = base.releaseGasSFX; base.thisAudioSource.Play(); base.thisAudioSource.PlayOneShot(base.twistCanSFX); } } public override void Update() { if ((Object)(object)base.previousPlayerHeldBy != (Object)null) { float drunknessInertia = base.previousPlayerHeldBy.drunknessInertia; ((TetraChemicalItem)this).Update(); base.previousPlayerHeldBy.drunknessInertia = drunknessInertia; base.previousPlayerHeldBy.increasingDrunknessThisFrame = false; } else { ((TetraChemicalItem)this).Update(); } if (base.emittingGas && (Object)(object)base.previousPlayerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { float percent = OxygenInit.Percent; OxygenInit.Percent = Mathf.Clamp(OxygenInit.Percent + OxygenBase.OxygenConfig.oxyBoost_increasingValue.Value, 0f, 1f); mls.LogDebug((object)$"Player's oxygen: {OxygenInit.Percent}"); mls.LogDebug((object)$"OxyBoost fuel: {base.fuel}"); if (percent <= 0.3f && StartOfRound.Instance.drowningTimer > 0.3f) { StartOfRound.Instance.playedDrowningSFX = false; } } } protected override void __initializeVariables() { ((TetraChemicalItem)this).__initializeVariables(); } protected override void __initializeRpcs() { ((TetraChemicalItem)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "OxyBoost"; } } internal class OxyCharger : NetworkBehaviour { private readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > OxyCharger"); private AudioSource audioSource; private readonly NetworkVariable<float> _remainedOxygenAmount = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private float? _queuedServerRemainedOxygenAmount; private readonly NetworkVariable<float> _reserveCapacity = new NetworkVariable<float>(0f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private readonly NetworkVariable<bool> _reserveLimited = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private float IncreasingOxygen => OxygenBase.OxygenConfig.autoFillingOnShip_increasingOxygen.Value; private float Volume => OxygenBase.OxygenConfig.oxyCharger_SFXVolume.Value; private AudioClip[] OxyChargerSFX => OxygenBase.Instance.oxyChargerSFX; internal float ReserveCapacity => _reserveCapacity.Value; internal bool ReserveLimited => _reserveLimited.Value; internal bool ReserveEmpty => RemainedOxygenAmount <= 1E-06f; internal float ReserveFraction { get { if (!(ReserveCapacity > 0f)) { return 0f; } return Mathf.Min(1f, Mathf.Max(0f, RemainedOxygenAmount / ReserveCapacity)); } } public float RemainedOxygenAmount { get { if (!((NetworkBehaviour)this).IsSpawned) { return _queuedServerRemainedOxygenAmount.GetValueOrDefault(); } return _remainedOxygenAmount.Value; } internal set { if (((NetworkBehaviour)this).IsServer && !float.IsNaN(value) && !float.IsInfinity(value)) { float value2 = Mathf.Max(0f, value); if (((NetworkBehaviour)this).IsSpawned) { _remainedOxygenAmount.Value = value2; } else { _queuedServerRemainedOxygenAmount = value2; } } } } public static OxyCharger Instance { get; private set; } private void Update() { if (((NetworkBehaviour)this).IsSpawned && ((NetworkBehaviour)this).IsServer) { _reserveCapacity.Value = WeatherHandler.ReserveCapacity; _reserveLimited.Value = WeatherHandler.IsOxygenOnShipLimited; } } private void Awake() { Instance = this; audioSource = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { mls.LogError((object)"Audio source was not found"); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); OxygenInit.oxyCharger = ((Component)this).gameObject; if (((NetworkBehaviour)this).IsServer) { float num = _queuedServerRemainedOxygenAmount ?? _remainedOxygenAmount.Value; _remainedOxygenAmount.Value = Mathf.Max(0f, num); _queuedServerRemainedOxygenAmount = null; mls.LogDebug((object)$"OnNetworkSpawn initialized RemainedOxygenAmount={_remainedOxygenAmount.Value}"); } VanillaCanisters.SetVisible(visible: false); WeatherHandler.RefreshLimit(); Update(); } public override void OnNetworkDespawn() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; WeatherHandler.ChargerDespawned(_remainedOxygenAmount.Value); } if ((Object)(object)OxygenInit.oxyCharger == (Object)(object)((Component)this).gameObject) { OxygenInit.oxyCharger = null; } VanillaCanisters.SetVisible(visible: true); ((NetworkBehaviour)this).OnNetworkDespawn(); } public void FillOxygen(bool playSound = true) { OxygenBase.Instance.Refills.Request(1f - OxygenInit.Percent, automatic: false, playSound); } public void AutoRefillOxygen() { OxygenBase.Instance.Refills.Request(1f - OxygenInit.Percent, automatic: true, sound: false); } internal float AllocateOxygen(float requested, bool automatic, int ticks) { if (!((NetworkBehaviour)this).IsServer || !((NetworkBehaviour)this).IsSpawned || !OxygenBase.OxygenConfig.oxyCharger_Enabled.Value || float.IsNaN(requested) || float.IsInfinity(requested) || requested <= 0f) { return 0f; } float num = Mathf.Min(1f, requested); if (automatic) { OxygenConfig.AutoFillingOnShip value = OxygenBase.OxygenConfig.autoFillingOnShip.Value; if (value == OxygenConfig.AutoFillingOnShip.Off || (value == OxygenConfig.AutoFillingOnShip.WhenDoorsClosed && !StartOfRound.Instance.hangarDoorsClosed)) { return 0f; } num = Mathf.Min(num, Mathf.Max(0f, IncreasingOxygen) * (float)ticks); } if (WeatherHandler.IsOxygenOnShipLimited) { num = Mathf.Min(num, _remainedOxygenAmount.Value); NetworkVariable<float> remainedOxygenAmount = _remainedOxygenAmount; remainedOxygenAmount.Value -= num; } return num; } internal void PlayGrantedSFX() { if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsSpawned) { PlaySFXClientRpc(); } } [ClientRpc] private void PlaySFXClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3475112299u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3475112299u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if ((Object)(object)audioSource == (Object)null) { mls.LogError((object)"Audio source was not found"); return; } if (OxyChargerSFX == null || OxyChargerSFX.Length == 0) { mls.LogError((object)"OxyCharger SFX references are missing."); return; } if (audioSource.isPlaying) { audioSource.Stop(); } AudioClip val3 = OxyChargerSFX[Random.Range(0, OxyChargerSFX.Length)]; if ((Object)(object)val3 == (Object)null) { mls.LogError((object)"Selected OxyCharger clip is null."); return; } audioSource.PlayOneShot(val3, Volume); mls.LogDebug((object)"Playing sound"); } protected override void __initializeVariables() { if (_remainedOxygenAmount == null) { throw new Exception("OxyCharger._remainedOxygenAmount cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_remainedOxygenAmount).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_remainedOxygenAmount, "_remainedOxygenAmount"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_remainedOxygenAmount); if (_reserveCapacity == null) { throw new Exception("OxyCharger._reserveCapacity cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_reserveCapacity).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_reserveCapacity, "_reserveCapacity"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_reserveCapacity); if (_reserveLimited == null) { throw new Exception("OxyCharger._reserveLimited cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_reserveLimited).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_reserveLimited, "_reserveLimited"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_reserveLimited); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3475112299u, new RpcReceiveHandler(__rpc_handler_3475112299), "PlaySFXClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3475112299(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((OxyCharger)(object)target).PlaySFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "OxyCharger"; } } } namespace Oxygen.General { internal sealed class BackpackGauge : MonoBehaviour { private PlayerControllerB owner; private GaugeDial dial; private GaugeModel model; private AudioSource pump; private static readonly Vector3 MountOffset = new Vector3(-0.12f, 0.04f, -0.43f); internal static Bounds InteractionBounds(PlayerControllerB player) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) BackpackGauge componentInChildren = ((Component)player).GetComponentInChildren<BackpackGauge>(true); return new Bounds((((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).transform.position : ((Component)player).transform.TransformPoint(MountOffset + Vector3.up * 1.71f)) + ((Component)player).transform.forward * 0.1f, new Vector3(0.8f, 1f, 0.65f)); } internal static BackpackGauge Create(PlayerControllerB player) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Oxygen backpack gauge"); val.transform.SetParent(((Component)player).transform, false); val.transform.localPosition = MountOffset + Vector3.up * 1.71f; Transform val2 = null; Transform[] componentsInChildren = ((Component)player).GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if (((Object)val3).name == "spine.003" || ((Object)val3).name == "spine_003") { val2 = val3; break; } } if ((Object)(object)val2 != (Object)null) { val.transform.SetParent(val2, true); } BackpackGauge backpackGauge = val.AddComponent<BackpackGauge>(); backpackGauge.owner = player; Matrix4x4 val4 = ((Component)player).transform.localToWorldMatrix; if ((Object)(object)val2 != (Object)null) { SkinnedMeshRenderer[] componentsInChildren2 = ((Component)player).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val5 in componentsInChildren2) { if (!((Object)(object)val5.sharedMesh == (Object)null)) { int num = Array.IndexOf(val5.bones, val2); Matrix4x4[] bindposes = val5.sharedMesh.bindposes; if (num >= 0 && num < bindposes.Length) { val4 = val2.localToWorldMatrix * bindposes[num] * ((Component)val5).transform.worldToLocalMatrix * ((Component)player).transform.localToWorldMatrix; break; } } } } Quaternion val6 = Quaternion.LookRotation(((Matrix4x4)(ref val4)).MultiplyVector(Vector3.forward), ((Matrix4x4)(ref val4)).MultiplyVector(Vector3.up)); val.transform.SetPositionAndRotation(((Object)(object)val2 != (Object)null) ? (val2.position + val6 * MountOffset) : ((Component)player).transform.TransformPoint(MountOffset + Vector3.up * 1.71f), val6); backpackGauge.Build(); return backpackGauge; } private void Build() { model = new GaugeModel(((Component)this).transform); model.Build(); dial = new GaugeDial(((Component)this).transform, model); pump = ((Component)this).gameObject.AddComponent<AudioSource>(); pump.spatialBlend = 1f; pump.loop = true; pump.volume = 0.08f; pump.minDistance = 0.5f; pump.maxDistance = 4f; pump.rolloffMode = (AudioRolloffMode)1; AudioClip[] oxyChargerSFX = OxygenBase.Instance.oxyChargerSFX; if (oxyChargerSFX != null && oxyChargerSFX.Length != 0) { pump.clip = oxyChargerSFX[0]; } } internal void SetState(float amount, bool transferring) { bool flag = (Object)(object)owner != (Object)null && owner.isPlayerControlled && !owner.isPlayerDead; Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = flag; } if (flag && transferring && (Object)(object)pump.clip != (Object)null) { if (!pump.isPlaying) { pump.Play(); } } else if (pump.isPlaying) { pump.Stop(); } dial.SetAmount(amount); } private void OnDestroy() { dial?.Destroy(); model?.Destroy(); } } internal sealed class ChargerGauge : MonoBehaviour { private OxyCharger charger; private GaugeModel model; private GaugeDial dial; private GameObject unlimited; private Mesh infinityMesh; private void Start() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) charger = ((Component)this).GetComponent<OxyCharger>(); GameObject val = new GameObject("Shared ship oxygen reserve gauge"); val.transform.SetParent(((Component)this).transform, false); val.transform.localPosition = new Vector3(0.85f, -0.22f, 0.5f); val.transform.localRotation = Quaternion.LookRotation(Vector3.up, Vector3.forward); val.transform.localScale = Vector3.one * 6.499581f; GameObject val2 = GameObject.Find("Environment/HangarShip/ScavengerModelSuitParts"); Transform val3 = (((Object)(object)val2 != (Object)null) ? val2.transform.Find("Circle.002") : null); Renderer val4 = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponentInChildren<Renderer>(true) : null); Transform transform = val.transform; object gameShader; if (!((Object)(object)val4 != (Object)null)) { gameShader = null; } else { Material sharedMaterial = val4.sharedMaterial; gameShader = ((sharedMaterial != null) ? sharedMaterial.shader : null); } model = new GaugeModel(transform, (Shader)gameShader); model.Build(); dial = new GaugeDial(val.transform, model); unlimited = new GameObject("Unlimited reserve infinity mark"); unlimited.transform.SetParent(val.transform, false); unlimited.transform.localPosition = new Vector3(0f, 0f, -0.0232f); infinityMesh = Infinity(); unlimited.AddComponent<MeshFilter>().sharedMesh = infinityMesh; ((Renderer)unlimited.AddComponent<MeshRenderer>()).sharedMaterial = model.Marks; LateUpdate(); } private void LateUpdate() { if (dial != null && !((Object)(object)charger == (Object)null)) { bool reserveLimited = charger.ReserveLimited; dial.SetAmount((!reserveLimited) ? 1f : (charger.ReserveEmpty ? 0f : charger.ReserveFraction)); unlimited.SetActive(!reserveLimited); } } private static Mesh Infinity() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown Vector3[] array = (Vector3[])(object)new Vector3[130]; int[] array2 = new int[384]; Vector3 val = default(Vector3); for (int i = 0; i <= 64; i++) { float num = (float)i * MathF.PI * 2f / 64f; ((Vector3)(ref val))..ctor(0.023f * Mathf.Cos(num), 0.012f * Mathf.Sin(2f * num), 0f); Vector3 val2 = new Vector3(-0.023f * Mathf.Sin(num), 0.024f * Mathf.Cos(2f * num), 0f); Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 val3 = new Vector3(0f - normalized.y, normalized.x, 0f) * 0.0015f; array[i * 2] = val - val3; array[i * 2 + 1] = val + val3; if (i != 64) { int num2 = i * 2; int num3 = i * 6; array2[num3] = num2; array2[num3 + 1] = num2 + 1; array2[num3 + 2] = num2 + 2; array2[num3 + 3] = num2 + 1; array2[num3 + 4] = num2 + 3; array2[num3 + 5] = num2 + 2; } } Mesh val4 = new Mesh { name = "Oxygen unlimited reserve symbol", vertices = array, triangles = array2 }; val4.RecalculateNormals(); return val4; } private void OnDestroy() { dial?.Destroy(); model?.Destroy(); if ((Object)(object)infinityMesh != (Object)null) { Object.Destroy((Object)(object)infinityMesh); } } } internal static class ChargerUnlockable { private static UnlockableItem item; private static TerminalNode storageNode; private static bool ready; internal static void Register(GameObject prefab) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if (!((Object)(object)prefab == (Object)null)) { InteractTrigger[] componentsInChildren = prefab.GetComponentsInChildren<InteractTrigger>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.SetActive(true); } item = new UnlockableItem { unlockableName = "OxyCharger", prefabObject = prefab, unlockableType = 1, alreadyUnlocked = true, IsPlaceable = true, canBeStored = true, maxNumber = 1, spawnPrefab = true }; Unlockables.RegisterUnlockable(item, 0, (StoreType)0); storageNode = ScriptableObject.CreateInstance<TerminalNode>(); storageNode.clearPreviousText = true; storageNode.displayText = "OxyCharger. Use STORAGE to view stored ship furniture.\n"; storageNode.returnFromStorage = true; storageNode.shipUnlockableID = -1; TerminalUtils.CreateTerminalKeyword("oxycharger", Object.op_Implicit((Object)(object)storageNode), (CompatibleNoun[])null, (TerminalNode)null, (TerminalKeyword)null, false); } } internal static void Reset() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ready = false; if (item != null) { item.inStorage = false; item.hasBeenMoved = false; item.hasBeenUnlockedByPlayer = false; item.placedPosition = Vector3.zero; item.placedRotation = Vector3.zero; } } internal static void StartRound(StartOfRound round) { Prepare(round); ready = true; } internal static void RestoreInteraction() { StartOfRound instance = StartOfRound.Instance; GameObject oxyCharger = OxygenInit.oxyCharger; if ((Object)(object)instance == (Object)null || instance.firingPlayersCutsceneRunning || instance.suckingFurnitureOutOfShip || item == null || item.inStorage || !OxygenBase.OxygenConfig.oxyCharger_Enabled.Value || (Object)(object)oxyCharger == (Object)null) { return; } NetworkObject component = oxyCharger.GetComponent<NetworkObject>(); if (component == null || !component.IsSpawned) { return; } InteractTrigger[] componentsInChildren = oxyCharger.GetComponentsInChildren<InteractTrigger>(true); foreach (InteractTrigger obj in componentsInChildren) { ((Component)obj).gameObject.SetActive(true); ((Behaviour)obj).enabled = true; obj.interactable = true; Collider[] components = ((Component)obj).GetComponents<Collider>(); for (int j = 0; j < components.Length; j++) { components[j].enabled = true; } } PlaceableShipObject[] componentsInChildren2 = oxyCharger.GetComponentsInChildren<PlaceableShipObject>(true); foreach (PlaceableShipObject val in componentsInChildren2) { if ((Object)(object)val.placeObjectCollider != (Object)null) { val.placeObjectCollider.enabled = true; } } } internal static void ResetFurniture() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) GameObject oxyCharger = OxygenInit.oxyCharger; if ((Object)(object)oxyCharger != (Object)null) { AutoParentToShip[] componentsInChildren = oxyCharger.GetComponentsInChildren<AutoParentToShip>(true); foreach (AutoParentToShip obj in componentsInChildren) { obj.positionOffset = obj.startingPosition; obj.rotationOffset = obj.startingRotation; } } Refresh(); RestoreInteraction(); } internal static int Prepare(StartOfRound round) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if (item == null || (Object)(object)round == (Object)null || (Object)(object)round.unlockablesList == (Object)null) { return -1; } int num = round.unlockablesList.unlockables.IndexOf(item); if (num < 0) { return -1; } storageNode.shipUnlockableID = num; GameObject prefabObject = item.prefabObject; prefabObject.transform.localScale = Vector3.one * 0.2077057f; PlaceableShipObject[] componentsInChildren = prefabObject.GetComponentsInChildren<PlaceableShipObject>(true); foreach (PlaceableShipObject obj in componentsInChildren) { obj.unlockableID = num; NormalizePlacement(obj); } AutoParentToShip[] componentsInChildren2 = prefabObject.GetComponentsInChildren<AutoParentToShip>(true); foreach (AutoParentToShip val in componentsInChildren2) { val.unlockableID = num; val.overrideOffset = true; GameObject val2 = GameObject.Find("Environment/HangarShip/ScavengerModelSuitParts"); Transform val3 = (((Object)(object)val2 != (Object)null) ? val2.transform.Find("Circle.002") : null); if ((Object)(object)val3 != (Object)null) { val.positionOffset = round.elevatorTransform.InverseTransformPoint(val3.position) + new Vector3(0f, 0f, -0.3f); val.rotationOffset = round.elevatorTransform.InverseTransformDirection(val3.eulerAngles); } } return num; } internal static void NormalizePlacement(PlaceableShipObject placeable) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Collider placeObjectCollider = placeable.placeObjectCollider; BoxCollider val = (BoxCollider)(object)((placeObjectCollider is BoxCollider) ? placeObjectCollider : null); if (val != null) { Transform transform = ((Component)val).transform; Vector3 lossyScale = transform.lossyScale; if (!(lossyScale.x <= 0f) && !(lossyScale.y <= 0f) && !(lossyScale.z <= 0f)) { Vector3 position = transform.TransformPoint(val.center); Vector3 size = Vector3.Scale(val.size, lossyScale); transform.localScale = Vector3.Scale(transform.localScale, new Vector3(1f / lossyScale.x, 1f / lossyScale.y, 1f / lossyScale.z)); transform.position = position; val.center = Vector3.zero; val.size = size; SetPlacementHeight(placeable, Quaternion.identity); } } } internal static void SetPlacementHeight(PlaceableShipObject placeable, Quaternion rotation) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Collider placeObjectCollider = placeable.placeObjectCollider; BoxCollider val = (BoxCollider)(object)((placeObjectCollider is BoxCollider) ? placeObjectCollider : null); if (val != null) { Vector3 val2 = rotation * Vector3.right; Vector3 val3 = rotation * Vector3.up; Vector3 val4 = rotation * Vector3.forward; placeable.yOffset = (Mathf.Abs(val2.y) * val.size.x + Mathf.Abs(val3.y) * val.size.y + Mathf.Abs(val4.y) * val.size.z) * 0.5f + 0.01f; } } internal static bool CanSpawn(StartOfRound round, int id) { if (item == null || round.unlockablesList.unlockables[id] != item) { return true; } Prepare(round); if (OxygenBase.OxygenConfig.oxyCharger_Enabled.Value) { if (round.SpawnedShipUnlockables.TryGetValue(id, out var value)) { return (Object)(object)value == (Object)null; } return true; } return false; } internal static bool CanReturnFromStorage(StartOfRound round, int id) { if (((NetworkBehaviour)round).IsServer && round.unlockablesList.unlockables[id] == item) { return OxygenBase.OxygenConfig.oxyCharger_Enabled.Value; } return true; } internal static bool BeforeSpawn(StartOfRound round, int id) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!CanSpawn(round, id)) { return false; } if (round.unlockablesList.unlockables[id] != item || !ready || (!item.hasBeenMoved && item.placedPosition == Vector3.zero)) { return true; } Vector3 placedPosition = item.placedPosition; Vector3 placedRotation = item.placedRotation; GameObject val = Object.Instantiate<GameObject>(item.prefabObject, round.elevatorTransform.position, Quaternion.identity); NetworkObject component = val.GetComponent<NetworkObject>(); try { ShipBuildModeManager.Instance.PlaceShipObject(placedPosition, placedRotation, val.GetComponentInChildren<PlaceableShipObject>(), false); val.GetComponentInChildren<AutoParentToShip>().MoveToOffset(); component.Spawn(false); round.SpawnedShipUnlockables.Add(id, val); } catch { if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } else { Object.Destroy((Object)(object)val); } throw; } return false; } internal static void Refresh() { StartOfRound instance = StartOfRound.Instance; NetworkManager singleton = NetworkManager.Singleton; if (!ready || (Object)(object)instance == (Object)null || (Object)(object)singleton == (Object)null || !singleton.IsServer || !singleton.IsListening) { return; } int num = Prepare(instance); if (num < 0) { return; } GameObject value2; if (!OxygenBase.OxygenConfig.oxyCharger_Enabled.Value) { if (instance.SpawnedShipUnlockables.TryGetValue(num, out var value) && (Object)(object)value != (Object)null) { instance.SpawnedShipUnlockables.Remove(num); NetworkObject component = value.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } else { Object.Destroy((Object)(object)value); } } VanillaCanisters.SetVisible(visible: true); } else if (!item.inStorage && (!instance.SpawnedShipUnlockables.TryGetValue(num, out value2) || (Object)(object)value2 == (Object)null)) { instance.SpawnedShipUnlockables.Remove(num); instance.SpawnUnlockable(num, true); } } } internal sealed class ChargerVisuals : MonoBehaviour { private readonly List<Material> materials = new List<Material>(); private void Start() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown GameObject val = GameObject.Find("Environment/HangarShip/ScavengerModelSuitParts"); Transform val2 = (((Object)(object)val != (Object)null) ? val.transform.Find("Circle.002") : null); Renderer val3 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponentInChildren<Renderer>(true) : null); object obj; if (!((Object)(object)val3 != (Object)null)) { obj = null; } else { Material sharedMaterial = val3.sharedMaterial; obj = ((sharedMaterial != null) ? sharedMaterial.shader : null); } Shader val4 = (Shader)obj; if ((Object)(object)val4 == (Object)null) { OxygenConfig.mls.LogWarning((object)"OxyCharger: stock canister shader unavailable; keeping bundled materials."); return; } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); foreach (Renderer val5 in componentsInChildren) { Material[] sharedMaterials = val5.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val6 = sharedMaterials[j]; if (!((Object)(object)val6 == (Object)null) && !((Object)(object)val6.shader == (Object)(object)val4) && !(((Object)val6.shader).name != ((Object)val4).name)) { Material val7 = new Material(val6) { name = ((Object)val6).name + " (Oxygen game shader)", shader = val4 }; materials.Add(val7); sharedMaterials[j] = val7; flag = true; } } if (flag) { val5.sharedMaterials = sharedMaterials; } } } private void OnDestroy() { foreach (Material material in materials) { if ((Object)(object)material != (Object)null) { Object.Destroy((Object)(object)material); } } materials.Clear(); } } internal class DieEarly : MonoBehaviour { private static readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > DieEarly"); private static TextMeshProUGUI[] controlTips; private static TextMeshProUGUI dieEarlyText; private static Image dieEarlyMeter; private static Image dieEarlyMeterFrame; public static bool isDieEarlyUIEnabled = false; public static float DieEarlyMeterFillAmount => dieEarlyMeter.fillAmount; internal static void Init() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("Systems/UI/Canvas/DeathScreen/SpectateUI/EndGameEarly"); GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner"); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { mls.LogError((object)"endGameEarlyUI or topRightCorner is null"); return; } GameObject obj = Object.Instantiate<GameObject>(val, val2.transform); ((Object)obj).name = "DieEarly"; obj.transform.localPosition = new Vector3(-378f, -196f, 0f); obj.transform.rotation = Quaternion.Euler(0f, 16f, 0f); obj.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); Object.Destroy((Object)(object)((Component)obj.transform.Find("Votes")).gameObject); dieEarlyText = ((Component)obj.transform.Find("Header")).GetComponent<TextMeshProUGUI>(); TextMeshProUGUI obj2 = dieEarlyText; InputBinding val3 = OxygenBase.InputActionsInstance.DieEarlyButton.bindings[0]; ((TMP_Text)obj2).text = "Would you like to die earlier? ;) : [" + ((InputBinding)(ref val3)).ToDisplayString((DisplayStringOptions)0, (InputControl)null) + "] (Hold)"; dieEarlyMeter = ((Component)obj.transform.Find("Meter/Fill")).GetComponent<Image>(); dieEarlyMeterFrame = ((Component)obj.transform.Find("Meter/Fill/Frame")).GetComponent<Image>(); controlTips = (TextMeshProUGUI[])(object)new TextMeshProUGUI[4] { ((Component)val2.transform.Find("ControlTip1")).gameObject.GetComponent<TextMeshProUGUI>(), ((Component)val2.transform.Find("ControlTip2")).gameObject.GetComponent<TextMeshProUGUI>(), ((Component)val2.transform.Find("ControlTip3")).gameObject.GetComponent<TextMeshProUGUI>(), ((Component)val2.transform.Find("ControlTip4")).gameObject.GetComponent<TextMeshProUGUI>() }; DisplayDieEarlyMeter(value: false); SetDieEarlyMeterValue(0f); mls.LogMessage((object)"DieEarly initialized"); } internal static void SetDieEarlyMeterValue(float value) { if (!((Object)(object)dieEarlyMeter == (Object)null) && dieEarlyMeter.fillAmount != value) { dieEarlyMeter.fillAmount = value; } } internal static void DisplayDieEarlyMeter(bool value) { if ((Object)(object)dieEarlyText == (Object)null || (Object)(object)dieEarlyMeter == (Object)null) { mls.LogError((object)"dieEarlyText or dieEarlyMeter is null"); return; } mls.LogDebug((object)$"DisplayDieEarlyMeter: {value}"); if (value) { ((Graphic)dieEarlyText).CrossFadeAlpha(1f, 2f, false); ((Graphic)dieEarlyMeter).CrossFadeAlpha(1f, 2f, false); ((Graphic)dieEarlyMeterFrame).CrossFadeAlpha(1f, 2f, false); TextMeshProUGUI[] array = controlTips; for (int i = 0; i < array.Length; i++) { ((Graphic)array[i]).CrossFadeAlpha(0f, 0.5f, false); } } else { ((Graphic)dieEarlyText).CrossFadeAlpha(0f, 0.5f, false); ((Graphic)dieEarlyMeter).CrossFadeAlpha(0f, 0.5f, false); ((Graphic)dieEarlyMeterFrame).CrossFadeAlpha(0f, 0.5f, false); TextMeshProUGUI[] array = controlTips; for (int i = 0; i < array.Length; i++) { ((Graphic)array[i]).CrossFadeAlpha(1f, 2f, false); } } isDieEarlyUIEnabled = value; } } internal sealed class GaugeDial { private readonly Transform transform; private readonly GaugeModel model; private Mesh arc; private Mesh ticks; private float previous = -1f; internal GaugeDial(Transform transform, GaugeModel model) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) this.transform = transform; this.model = model; GameObject val = new GameObject("Blue oxygen arc"); val.transform.SetParent(transform, false); val.transform.localPosition = new Vector3(0f, 0f, -0.0225f); arc = new Mesh { name = "Oxygen gauge fill" }; val.AddComponent<MeshFilter>().sharedMesh = arc; ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterial = model.Blue; BuildTicks(); } private void BuildTicks() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[20]; int[] array2 = new int[30]; Vector3 val = default(Vector3); for (int i = 0; i < 5; i++) { bool flag = i % 2 == 0; float num = (225f - (float)(270 * i) / 4f) * (MathF.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Cos(num), Mathf.Sin(num), 0f); Vector3 val2 = new Vector3(0f - val.y, val.x, 0f) * (flag ? 0.001f : 0.00065f); Vector3 val3 = val * (flag ? 0.04f : 0.059f); Vector3 val4 = val * 0.071f; int num2 = i * 4; int num3 = i * 6; array[num2] = val3 - val2; array[num2 + 1] = val3 + val2; array[num2 + 2] = val4 - val2; array[num2 + 3] = val4 + val2; array2[num3] = num2; array2[num3 + 1] = num2 + 1; array2[num3 + 2] = num2 + 2; array2[num3 + 3] = num2 + 1; array2[num3 + 4] = num2 + 3; array2[num3 + 5] = num2 + 2; } ticks = new Mesh { name = "Oxygen gauge level ticks" }; ticks.vertices = array; ticks.triangles = array2; ticks.RecalculateNormals(); GameObject val5 = new GameObject("Level ticks 0 25 50 75 100"); val5.transform.SetParent(transform, false); val5.transform.localPosition = new Vector3(0f, 0f, -0.0232f); val5.AddComponent<MeshFilter>().sharedMesh = ticks; MeshRenderer obj = val5.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = model.Marks; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; } internal void SetAmount(float amount) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) amount = Mathf.Clamp01(amount); if (Mathf.Abs(amount - previous) < 0.001f) { return; } previous = amount; Vector3[] array = (Vector3[])(object)new Vector3[98]; Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length]; int[] array3 = new int[288]; Vector3 val = default(Vector3); for (int i = 0; i <= 48; i++) { float num = (225f - 270f * amount * (float)i / 48f) * (MathF.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Cos(num), Mathf.Sin(num), 0f); array[i * 2] = val * 0.043f; array[i * 2 + 1] = val * 0.066f; array2[i * 2] = new Vector2(array[i * 2].x / 0.146f + 0.5f, array[i * 2].y / 0.146f + 0.5f); array2[i * 2 + 1] = new Vector2(array[i * 2 + 1].x / 0.146f + 0.5f, array[i * 2 + 1].y / 0.146f + 0.5f); if (i != 48) { int num2 = i * 6; int num3 = (array3[num2] = i * 2); array3[num2 + 1] = num3 + 1; array3[num2 + 2] = num3 + 2; array3[num2 + 3] = num3 + 1; array3[num2 + 4] = num3 + 3; array3[num2 + 5] = num3 + 2; } } arc.Clear(); arc.vertices = array; arc.uv = array2; arc.triangles = array3; arc.RecalculateNormals(); } internal void Destroy() { Object.Destroy((Object)(object)arc); Object.Destroy((Object)(object)ticks); } } internal sealed class GaugeModel { internal const float ArcDepth = -0.0225f; internal const float TickDepth = -0.0232f; private readonly Transform root; private readonly Shader gameShader; private readonly List<Object> assets = new List<Object>(); private readonly Material steel; private readonly Material casing; private readonly Material brass; private readonly Material rubber; private readonly Material face; internal readonly Material Blue; internal readonly Material Marks; internal GaugeModel(Transform root, Shader gameShader = null) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) this.root = root; this.gameShader = gameShader; steel = WornMaterial("Worn steel", new Color(0.38f, 0.4f, 0.39f), 0.55f, chipped: true); casing = WornMaterial("Chipped charcoal case", new Color(0.13f, 0.15f, 0.15f), 0.35f, chipped: true); brass = WornMaterial("Tarnished fitting", new Color(0.36f, 0.29f, 0.16f), 0.55f, chipped: true); rubber = WornMaterial("Old rubber gasket", new Color(0.055f, 0.06f, 0.052f), 0f, chipped: false); face = WornMaterial("Aged enamel dial", new Color(0.76f, 0.74f, 0.65f), 0f, chipped: false); Blue = WornMaterial("Worn blue paint", new Color(0.08f, 0.29f, 0.66f), 0f, chipped: false); Marks = WornMaterial("Printed level marks", new Color(0.08f, 0.09f, 0.075f), 0f, chipped: false); } internal void Build() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) Disk("Pressure gauge case", 0.083f, 0.036f, 0.008f, casing); Disk("Recessed enamel dial", 0.073f, 0.006f, -0.018f, face); Bezel(); Cylinder("Threaded pressure stem", Vector3.forward * 0.026f, Vector3.forward * 0.09f, 0.012f, brass, 12); Cylinder("Hex union", Vector3.forward * 0.029f, Vector3.forward * 0.048f, 0.022f, brass, 6); Cylinder("Fitting seal", Vector3.forward * 0.049f, Vector3.forward * 0.056f, 0.018f, rubber, 12); Box("Steel mounting saddle", new Vector3(0f, 0f, 0.11f), new Vector3(0.105f, 0.12f, 0.06f), steel); Band(); Vector3 val = default(Vector3); for (int i = -1; i <= 1; i += 2) { ((Vector3)(ref val))..ctor((float)i * 0.039f, 0f, 0.075f); Cylinder("Saddle bolt", val, val + Vector3.forward * 0.009f, 0.0055f, steel, 6); Box("Screw slot", val - Vector3.forward * 0.001f, new Vector3(0.006f, 0.0012f, 0.001f), rubber); } } private Material WornMaterial(string name, Color color, float metallic, bool chipped) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(gameShader ?? Shader.Find("HDRP/Lit") ?? Shader.Find("Standard") ?? Shader.Find("Unlit/Color")) { name = "Oxygen " + name, color = Color.white }; assets.Add((Object)(object)val); Color[] array = (Color[])(object)new Color[16384]; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = Mathf.PerlinNoise((float)j * 0.19f + 7.1f, (float)i * 0.19f + 11.4f); float num2 = Mathf.PerlinNoise((float)j * 0.057f + 41f, (float)i * 0.057f + 19f); Vector2 val2 = new Vector2((float)j - 63.5f, (float)i - 63.5f); float num3 = Mathf.Clamp01((((Vector2)(ref val2)).magnitude - 43f) / 25f); float num4 = (chipped ? (0.79f + num * 0.25f - num2 * 0.13f - num3 * 0.12f) : (0.94f + num * 0.015f - num2 * 0.025f - num3 * 0.035f)); array[i * 128 + j] = color * num4; array[i * 128 + j].a = 1f; } } Random random = new Random(7183); for (int k = 0; k < (chipped ? 95 : 12); k++) { int num5 = random.Next(128); int num6 = random.Next(128); int num7 = random.Next(2, chipped ? 14 : 8); int num8 = ((random.Next(2) != 0) ? 1 : (-1)); for (int l = 0; l < num7; l++) { int num9 = num5 + num8 * l; int num10 = num6 + l / 3; if (num9 >= 0 && num9 < 128 && num10 < 128) { Color val3 = (Color)(chipped ? new Color(0.46f, 0.45f, 0.39f) : (color * 0.57f)); array[num10 * 128 + num9] = Color.Lerp(array[num10 * 128 + num9], val3, chipped ? 0.65f : 0.12f); } } } Texture2D val4 = new Texture2D(128, 128, (TextureFormat)4, true) { name = "Oxygen " + name + " wear", wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; val4.SetPixels(array); val4.Apply(true, true); assets.Add((Object)(object)val4); val.mainTexture = (Texture)(object)val4; if (val.HasProperty("_BaseColorMap")) { val.SetTexture("_BaseColorMap", (Texture)(object)val4); } if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", Color.white); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metallic); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.075f); } return val; } internal Material Paint(string name, Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return WornMaterial(name, color, 0f, chipped: false); } private void Renderer(GameObject part, Material material) { MeshRenderer component = part.GetComponent<MeshRenderer>(); ((Renderer)component).sharedMaterial = material; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)1; } private GameObject Primitive(string name, PrimitiveType type, Material material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); ((Object)val).name = name; Collider component = val.GetComponent<Collider>(); component.enabled = false; Object.Destroy((Object)(object)component); val.transform.SetParent(root, false); Renderer(val, material); return val; } private void Box(string name, Vector3 position, Vector3 size, Material material) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Primitive(name, (PrimitiveType)3, material); obj.transform.localPosition = position; obj.transform.localScale = size; } private void Disk(string name, float radius, float depth, float z, Material material) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Primitive(name, (PrimitiveType)2, material); obj.transform.localPosition = Vector3.forward * z; obj.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); obj.transform.localScale = new Vector3(radius * 2f, depth / 2f, radius * 2f); } private void Part(string name, List<Vector3> vertices, List<int> triangles, Material material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown Mesh val = new Mesh { name = "Oxygen " + name }; val.SetVertices(vertices); val.SetTriangles(triangles, 0); Vector2[] array = (Vector2[])(object)new Vector2[vertices.Count]; for (int i = 0; i < array.Length; i++) { array[i] = new Vector2(vertices[i].x / 0.17f + 0.5f, vertices[i].y / 0.17f + 0.5f); } val.uv = array; val.RecalculateNormals(); assets.Add((Object)(object)val); GameObject val2 = new GameObject(name); val2.transform.SetParent(root, false); val2.AddComponent<MeshFilter>().sharedMesh = val; val2.AddComponent<MeshRenderer>(); Renderer(val2, material); } private static void Quad(List<Vector3> vertices, List<int> triangles, Vector3 a, Vector3 b, Vector3 c, Vector3 d) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) int count = vertices.Count; vertices.Add(a); vertices.Add(b); vertices.Add(c); vertices.Add(d); triangles.AddRange(new int[6] { count, count + 1, count + 2, count, count + 2, count + 3 }); } private void Bezel() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) List<Vector3> vertices = new List<Vector3>(); List<int> triangles = new List<int>(); float[] array = new float[4] { 0.083f, 0.085f, 0.079f, 0.073f }; float[] array2 = new float[4] { 0.008f, -0.02f, -0.027f, -0.021f }; for (int i = 0; i < 20; i++) { float num = (float)i * MathF.PI * 2f / 20f; float num2 = (float)(i + 1) * MathF.PI * 2f / 20f; for (int j = 0; j < 3; j++) { Quad(vertices, triangles, new Vector3(Mathf.Cos(num) * array[j], Mathf.Sin(num) * array[j], array2[j]), new Vector3(Mathf.Cos(num) * array[j + 1], Mathf.Sin(num) * array[j + 1], array2[j + 1]), new Vector3(Mathf.Cos(num2) * array[j + 1], Mathf.Sin(num2) * array[j + 1], array2[j + 1]), new Vector3(Mathf.Cos(num2) * array[j], Mathf.Sin(num2) * array[j], array2[j])); } } Part("Chipped bevelled bezel", vertices, triangles, steel); } private void Cylinder(string name, Vector3 from, Vector3 to, float radius, Material material, int sides) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) List<Vector3> vertices = new List<Vector3>(); List<int> triangles = new List<int>(); Vector3 val = to - from; Vector3 normalized = ((Vector3)(ref val)).normalized; val = Vector3.Cross(normalized, (Mathf.Abs(normalized.y) < 0.9f) ? Vector3.up : Vector3.right); Vector3 val2 = ((Vector3)(ref val)).normalized * radius; val = Vector3.Cross(normalized, val2); Vector3 val3 = ((Vector3)(ref val)).normalized * radius; for (int i = 0; i < sides; i++) { float num = (float)i * MathF.PI * 2f / (float)sides; float num2 = (float)(i + 1) * MathF.PI * 2f / (float)sides; Vector3 val4 = val2 * Mathf.Cos(num) + val3 * Mathf.Sin(num); Vector3 val5 = val2 * Mathf.Cos(num2) + val3 * Mathf.Sin(num2); Quad(vertices, triangles, from + val4, from + val5, to + val5, to + val4); Quad(vertices, triangles, from, from + val5, from + val4, from); Quad(vertices, triangles, to, to + val4, to + val5, to); } Part(name, vertices, triangles, material); } private void Band() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) List<Vector3> vertices = new List<Vector3>(); List<int> triangles = new List<int>(); Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < 12; i++) { float num = (-80f + (float)i * 160f / 12f) * (MathF.PI / 180f); float num2 = (-80f + (float)(i + 1) * 160f / 12f) * (MathF.PI / 180f); ((Vector3)(ref val))..ctor(Mathf.Sin(num) * 0.112f, 0f, 0.24f - Mathf.Cos(num) * 0.112f); ((Vector3)(ref val2))..ctor(Mathf.Sin(num2) * 0.112f, 0f, 0.24f - Mathf.Cos(num2) * 0.112f); Quad(vertices, triangles, val + Vector3.up * 0.013f, val2 + Vector3.up * 0.013f, val2 - Vector3.up * 0.013f, val - Vector3.up * 0.013f); } Part("Curved tank clamp", vertices, triangles, steel); } internal void Destroy() { foreach (Object asset in assets) { if (asset != (Object)null) { Object.Destroy(asset); } } assets.Clear(); } } public class OxygenInit : MonoBehaviour { private static readonly ManualLogSource mls = Logger.CreateLogSource("Oxygen > OxygenInit"); private const float AccurateMinValue = 0.2978f; private const float AccurateMaxValue = 0.9101f; private const float AccurateValueRange = 0.6123f; internal static GameObject oxyCharger; private static Image sprintMeterImage; private static Image oxygenHUD; private static TextMeshProUGUI eladsUIText; public static bool IsOxygenHUDInitialized => (Object)(object)oxygenHUD != (Object)null; public static float StaminaFillAmount => sprintMeterImage.fillAmount; public static float Percent { get { if ((Object)(object)oxygenHUD == (Object)null) { return 0f; } if (!OxygenBase.Instance.IsEladsHUDFound) { return InvAdjustFillAmount(oxygenHUD.fillAmount); } return oxygenHUD.fillAmount; } internal set { if (((Object)(object)OxygenBase.Instance != (Object)null && OxygenBase.Instance.Transfers.ChangeLocal(value)) || (Object)(object)oxygenHUD == (Object)null) { return; } float num = Mathf.Clamp01(OxygenBase.Instance.IsEladsHUDFound ? value : AdjustFillAmount(value)); if (oxygenHUD.fillAmount != num) { oxygenHUD.fillAmount = num; if ((Object)(object)eladsUIText != (Object)null) { int num2 = (int)((float)Math.Round(Percent, 2) * 100f); ((TMP_Text)eladsUIText).text = $"{num2}<size=75%><voffset=1>%</voffset></size>"; } if (!OxygenBase.Instance.IsEladsHUDFound && ((OxygenBase.Instance.IsShyHUDFound && OxygenBase.OxygenConfig.autoHideHUD.Value) || OxygenBase.OxygenConfig.autoHideHUD.Value)) { float num3 = ((OxygenBase.OxygenConfig.autoHideHUD_value.Value > 1f) ? 1f : OxygenBase.OxygenConfig.autoHideHUD_value.Value); bool flag = value >= num3; ((Graphic)oxygenHUD).CrossFadeAlpha(flag ? 0f : 1f, flag ? 3f : 0.5f, false); } } } } private static float AdjustFillAmount(float value) { if (!OxygenBase.OxygenConfig.accurateMeter.Value) { return value; } return value * 0.6123f + 0.2978f; } private static float InvAdjustFillAmount(float value) { if (!OxygenBase.OxygenConfig.accurateMeter.Value) { return value; } return (value - 0.2978f) / 0.6123f; } internal static void Init() { GameObject val = (OxygenBase.Instance.IsEladsHUDFound ? GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/PlayerInfo(Clone)/Stamina") : GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/SprintMeter")); if ((Object)(object)val == (Object)null) { mls.LogError((object)"sprintMeter is null"); return; } sprintMeterImage = (OxygenBase.Instance.IsEladsHUDFound ? ((Component)val.transform.Find("Bar/StaminaBar")).GetComponent<Image>() : val.GetComponent<Image>()); if (!OxygenBase.Instance.IsEladsHUDFound) { Init_vanilla(val); if (OxygenBase.Instance.IsLCVRFound) { ((MonoBehaviour)OxygenBase.Instance).StartCoroutine(Init_LCVR(val)); } } else { Init_EladsHUD(val); } OxygenLogic.ResetAllNotifications(); Percent = 1f; mls.LogInfo((object)"Oxygen is initialized"); } private static void Init_vanilla(GameObj