Decompiled source of BetterGasTank v1.0.1

BetterGasTank.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("HLin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Null")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterGasTank")]
[assembly: AssemblyTitle("BetterGasTank")]
[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 BetterGasTank
{
	[HarmonyPatch(typeof(Brut_GasCuboid), "GenerateGout")]
	public static class Harmony_GenerateGout
	{
		[HarmonyPrefix]
		public static bool Prefix(Brut_GasCuboid __instance, Vector3 point, Vector3 normal)
		{
			//IL_003c: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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)
			if (__instance.hasGeneratedGoutYet)
			{
				return false;
			}
			if (__instance.m_isDestroyed)
			{
				return false;
			}
			if (__instance.m_fuel <= 0f)
			{
				return false;
			}
			__instance.hasGeneratedGoutYet = true;
			SM.PlayCoreSound((FVRPooledAudioType)0, __instance.AudEvent_GoutStart, ((Component)__instance).gameObject.transform.position);
			if (!__instance.AudSource_GoutLoop.isPlaying)
			{
				__instance.AudSource_GoutLoop.Play();
			}
			if (!__instance.m_hasGoneNoFric)
			{
				__instance.m_hasGoneNoFric = true;
				__instance.NoFricCollider.material = __instance.NoFricMaterial;
			}
			GameObject obj = Object.Instantiate<GameObject>(__instance.FireGoutPrefab, point, Quaternion.LookRotation(normal, Random.onUnitSphere));
			obj.transform.SetParent(((Component)__instance).gameObject.transform);
			Brut_GasCuboidGout component = obj.GetComponent<Brut_GasCuboidGout>();
			__instance.m_gouts.Add(component);
			component.TurnOn();
			return false;
		}
	}
	[HarmonyPatch(typeof(Brut_GasCuboid), "FixedUpdate")]
	public static class Harmony_FixedUpdate
	{
		[HarmonyPrefix]
		public static bool Prefix(Brut_GasCuboid __instance)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00cc: 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_00e4: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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_011a: 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_012f: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.RB == (Object)null)
			{
				return false;
			}
			if (__instance.m_gouts.Any())
			{
				float num;
				float num2;
				float num3;
				if (((Object)((Component)__instance).gameObject).name == "Brut_GasCuboid_Cryo_Large(Clone)")
				{
					num = 0.005f;
					num2 = 0.1f;
					num3 = 1f;
				}
				else
				{
					num = 0.0002f;
					num2 = 0.05f;
					num3 = 0.7f;
				}
				float num4 = 0.47f;
				Vector3 velocity = __instance.RB.velocity;
				float num5 = ((Vector3)(ref velocity)).magnitude / 5f;
				velocity = __instance.RB.velocity;
				Vector3 val = -((Vector3)(ref velocity)).normalized;
				float num6 = 1.225f * num5 * num5 * num4 * num2 / 2f;
				Vector3 val2 = ((Component)__instance.RB).transform.position + ((Component)__instance.RB).transform.up * num;
				__instance.RB.AddForceAtPosition(val * num6, val2);
				velocity = __instance.RB.velocity;
				if (((Vector3)(ref velocity)).magnitude > 10f && Physics.Raycast(((Component)__instance).gameObject.transform.position, -((Component)__instance).gameObject.transform.up, num3, LayerMask.op_Implicit(__instance.m_gouts[0].Burning_LM)))
				{
					__instance.Explode(((Component)__instance).gameObject.transform.position, -((Component)__instance).gameObject.transform.up, false);
				}
			}
			if (__instance.m_fuel > 0f)
			{
				for (int i = 0; i < __instance.m_gouts.Count; i++)
				{
					__instance.RB.AddForceAtPosition(-((Component)__instance.m_gouts[i]).transform.forward * __instance.GoutForce, ((Component)__instance.m_gouts[i]).transform.position, (ForceMode)5);
					__instance.m_gouts[i].Burn();
				}
			}
			return false;
		}
	}
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("HLin-BetterGasTank", "BetterGasTank", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static readonly Harmony harmony = new Harmony("HLin-BetterGasTank");

		public void Awake()
		{
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded BetterGasTank Successfully!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BetterGasTank";

		public const string PLUGIN_NAME = "BetterGasTank";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}