Decompiled source of AtmosphereFix v0.0.0

AtmosphereFix.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CG.Ship.Modules;
using Gameplay.Atmosphere;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using VoidManager;
using VoidManager.MPModChecks;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AtmosphereFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AtmosphereFix")]
[assembly: AssemblyTitle("AtmosphereFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 AtmosphereFix
{
	internal static class MyPluginInfo
	{
		internal const string PLUGIN_GUID = "id107.atmospherefix";

		internal const string PLUGIN_NAME = "AtmosphereFix";

		internal const string PLUGIN_VERSION = "0.0.0";
	}
	[BepInPlugin("id107.atmospherefix", "AtmosphereFix", "0.0.0")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "id107.atmospherefix");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin id107.atmospherefix is loaded!");
		}
	}
	[HarmonyPatch(typeof(LifeSupportModule))]
	internal class LifeSupportModulePatch
	{
		private static readonly MethodInfo GetAtmosphereValuesMethod = AccessTools.Method(typeof(Atmosphere), "GetAtmosphereValues", (Type[])null, (Type[])null);

		private static readonly MethodInfo SetAtmosphereValuesMethod = AccessTools.Method(typeof(Atmosphere), "SetAtmosphereValues", (Type[])null, (Type[])null);

		[HarmonyPrefix]
		[HarmonyPatch("ApplyPressureIncrease")]
		private static bool ApplyPressureIncrease()
		{
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("ApplyOxygenIncrease")]
		private static void ApplyOxygenIncrease(Atmosphere ____atmosphere)
		{
			//IL_0033: 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_003b: 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)
			foreach (Room key in ____atmosphere.Atmospheres.keys)
			{
				AtmosphereValues val = (AtmosphereValues)GetAtmosphereValuesMethod.Invoke(____atmosphere, new object[1] { key });
				val.Pressure = val.Oxygen;
				SetAtmosphereValuesMethod.Invoke(____atmosphere, new object[2] { key, val });
			}
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)4;

		public override string Author => "18107";

		public override string Description => "Synchronises O2 and pressure";
	}
}