Decompiled source of Thundercopter v1.1.3

Plonk_Helicopter.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Configgy;
using HarmonyLib;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Plonk_Helicopter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Plonk_Helicopter")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e74c96d0-1f92-4168-93dd-9d1048650a23")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Plonk_Helicopter;

[BepInPlugin("plonk.thundercopter", "Thundercopter", "1.1.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Thundercopter : BaseUnityPlugin
{
	public enum ThunderCopterShotType
	{
		Electric = 1,
		Malicious,
		Rocket
	}

	public enum ThunderCopterBottomShotType
	{
		Hitscan = 1,
		Shotgun,
		Rocket
	}

	public enum ThunderCopterType
	{
		Helicopter = 1,
		Walker
	}

	public enum AbilityType
	{
		Harpoon = 1,
		Laser,
		Cannonball
	}

	[HarmonyPatch]
	public static class BGPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(BeamgunBeam), "FixedUpdate")]
		public static bool FixedUpdatePatch(BeamgunBeam __instance)
		{
			if ((Object)(object)((Component)__instance).transform.parent != (Object)(object)((Component)MonoSingleton<CameraController>.instance).transform)
			{
				return true;
			}
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BeamgunBeam), "Update")]
		public static bool UpdatePatch(BeamgunBeam __instance)
		{
			//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_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00a9: 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_0106: 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_011f: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f6: 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)
			if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<TMechBeamID>()))
			{
				return true;
			}
			if (__instance.fakeStartPoint != Vector3.zero)
			{
				__instance.line.SetPosition(0, __instance.fakeStartPoint);
			}
			else
			{
				__instance.line.SetPosition(0, ((Component)__instance.line).transform.position);
			}
			Vector3 val = ((Component)__instance).transform.forward * -1f;
			LayerMask val2 = LayerMaskDefaults.Get((LMD)3);
			if (__instance.canHitPlayer && __instance.playerDamageCooldown <= 0f)
			{
				val2 = LayerMaskDefaults.Get((LMD)6);
			}
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val3, float.PositiveInfinity, LayerMask.op_Implicit(val2), (QueryTriggerInteraction)1))
			{
				__instance.hitPosition = ((RaycastHit)(ref val3)).point;
				val = ((RaycastHit)(ref val3)).normal;
			}
			else
			{
				__instance.hitPosition = ((Component)MonoSingleton<CameraController>.instance).transform.position + ((Component)MonoSingleton<CameraController>.instance).transform.forward * 1000f;
			}
			__instance.line.SetPosition(1, __instance.hitPosition);
			return false;
		}
	}

	public static SpawnMenuSectionReference helisection;

	public static bool canspawnheli;

	public static Button helibutton;

	public static TextMeshProUGUI helitext;

	public static GameObject heli;

	public static bool inheli;

	public static float heliexitdelay;

	private static bool cansendhudtip = true;

	private static float heliupdown;

	private static bool canchangeplayer;

	private static int beamsleft;

	private static float beamtimer;

	private static float speed = 10000f;

	private static float gravity = 15f;

	private static float jumpfrc = 3750f;

	[Configgable("", "Enter/Exit key", 0, "Key to enter the Thundercopter.")]
	private static ConfigKeybind exitkey = new ConfigKeybind((KeyCode)116);

	[Configgable("", "Spawn key", 0, "Key to spawn the Thundercopter.")]
	private static ConfigKeybind spawnkey = new ConfigKeybind((KeyCode)121);

	[Configgable("", "Inside of vehicle visible", 0, "Makes the inside of the vehicle visible whilst driving it.\n May greatly obstruct player vision.")]
	private static ConfigToggle insidevisible = new ConfigToggle(false);

	[Configgable("", null, 0, null)]
	public static InternalConfigValue<bool> hasthundermech = new InternalConfigValue<bool>(defaultValue: false);

	private static float harpoonforce = 200f;

	public static GameObject tmroom;

	public static GameObject tmroom2;

	public static GameObject tmpickup;

	public static AssetBundle tmbundle;

	[Configgable("", "Spawn Thundercopter", 0, "Spawns Thundercopter.")]
	private static ConfigButton spawnbutton = new ConfigButton((Action)SpawnHeli, "SPAWN");

	[Configgable("", "Kill Thundercopter", 0, "Kills Thundercopter.")]
	private static ConfigButton killbutton = new ConfigButton((Action)KillHeli, "DESTROY");

	[Configgable("", "Thundercopter railcannon shot type", 0, "Defines what beam the top guns shoot.")]
	private static ConfigDropdown<ThunderCopterShotType> topbeamtype = new ConfigDropdown<ThunderCopterShotType>((ThunderCopterShotType[])Enum.GetValues(typeof(ThunderCopterShotType)), (string[])null, 0);

	[Configgable("", "Thundercopter machinegun shot type", 0, "Defines what the bottom guns shoot.")]
	private static ConfigDropdown<ThunderCopterBottomShotType> bottombeamtype = new ConfigDropdown<ThunderCopterBottomShotType>((ThunderCopterBottomShotType[])Enum.GetValues(typeof(ThunderCopterBottomShotType)), (string[])null, 0);

	[Configgable("", "Vechicle type", 0, "Choose what type of vehicle the Thundercopter is.")]
	private static ConfigDropdown<ThunderCopterType> tctype = new ConfigDropdown<ThunderCopterType>((ThunderCopterType[])Enum.GetValues(typeof(ThunderCopterType)), (string[])null, 0);

	[Configgable("", "Ability type", 0, "Choose what type of ability the Thundermech uses.")]
	private static ConfigDropdown<AbilityType> ability = new ConfigDropdown<AbilityType>((AbilityType[])Enum.GetValues(typeof(AbilityType)), (string[])null, 0);

	[Configgable("", "Ability key", 0, "Key to activate chosen Thundermech ability.")]
	private static ConfigKeybind abilitykey = new ConfigKeybind((KeyCode)101);

	private static GameObject blades;

	private static GameObject blades2;

	private static bool helidead;

	public static float helispawndelay;

	private float legrot;

	private bool candoshit = false;

	public static GameObject legs;

	private static float harpoonshotdelay;

	private static GameObject harpoon;

	private static GameObject harpoon2;

	private static GameObject harpoon3;

	private static float shoottimer;

	private static float shoot2timer;

	private static bool canshoot2;

	private static float bladerot;

	private static float shoot3timer;

	private static float shoot4timer;

	private static bool canshoot3;

	private static GameObject lleg;

	private static GameObject rleg;

	private static GameObject barrel;

	private static GameObject beamcutterbeam;

	private static BeamgunBeam bcbeam;

	private static GameObject tcmodel;

	private static Transform arms;

	private static bool direction;

	private static bool direction2;

	private static bool grounded = true;

	private bool canboom;

	private float unkinematictimer;

	private float unkinematictimer2;

	private bool cancrack2;

	public static ConfigBuilder ConfigBuilder { get; private set; }

	public static T Fetch<T>(string key)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
	}

	public static T FetchFromBundle<T>(string key) where T : Object
	{
		return tmbundle.LoadAsset<T>(key);
	}

	public void Awake()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		ConfigBuilder = new ConfigBuilder("plonk.thundercopter", "Thundercopter");
		ConfigBuilder.Build();
		ConfigBuilder.GetConfigElements();
		SceneManager.sceneLoaded += SceneManager_OnSceneLoaded;
		if ((Object)(object)tmbundle == (Object)null)
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			tmbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "thundermechroomprefab"));
			Log("Got bundle " + (object)tmbundle, 1);
		}
		if ((Object)(object)tmroom == (Object)null)
		{
			for (int i = 0; i < tmbundle.GetAllAssetNames().Length; i++)
			{
				Log(tmbundle.GetAllAssetNames()[i], 1);
			}
			if (tmbundle.GetAllAssetNames()[1] != null)
			{
				tmroom = Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/stairs.prefab");
			}
			Log(tmbundle.GetAllAssetNames()[1], 1);
		}
		if (!((ConfigValueElement<bool>)hasthundermech).Value)
		{
			((ConfigValueElement<ThunderCopterType>)(object)tctype).ResetValue();
		}
	}

	public void Start()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("plonk.thundercopter");
		val.PatchAll();
		inheli = false;
		canchangeplayer = true;
		heli = null;
		legs = null;
		helispawndelay = 0f;
		helidead = false;
	}

	public void Update()
	{
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		if (!candoshit && SceneHelper.CurrentScene == "Main Menu" && (Object)(object)tmbundle != (Object)null)
		{
			candoshit = true;
		}
		if ((Object)(object)tmbundle == (Object)null)
		{
			SendHudMessage("Thundercopter mod failed to load.\r\n<color=green>The asset bundle (thundermechroomprefab) is missing or in the wrong place. please place it where the mod's .dll is located.</color>", 0, silent: true);
		}
		if (!((ConfigValueElement<bool>)hasthundermech).Value && ((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker && candoshit)
		{
			((ConfigValueElement<ThunderCopterType>)(object)tctype).ResetValue();
			SendHudMessage("<color=red> You must unlock the Thundermech first!</color>\nLook for V-Shaped lights in the direction of the Earthmovers.", 0, silent: false);
		}
		if (candoshit && SceneHelper.CurrentScene != "Main Menu")
		{
			Heli();
		}
		if (!(SceneHelper.CurrentScene == "Level 7-2"))
		{
			return;
		}
		if ((Object)(object)tmroom != (Object)null)
		{
			if ((Object)(object)tmroom2 == (Object)null)
			{
				tmroom2 = Object.Instantiate<GameObject>(tmroom);
				tmroom2.transform.position = new Vector3(-361.7052f, 39.1942f, 1401.286f);
				tmroom2.layer = LayerMask.NameToLayer("Environment");
				if (!((ConfigValueElement<bool>)hasthundermech).Value && (Object)(object)tmpickup == (Object)null)
				{
					tmpickup = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/thundermech_unlockable.prefab"), ((Component)tmroom2.transform.GetChild(0)).transform.position, Quaternion.Euler(0f, 180f, 0f), tmroom2.transform);
					tmpickup.AddComponent<tmech_triggerscr>();
				}
			}
		}
		else
		{
			tmroom = Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/stairs.prefab");
		}
	}

	private void SceneManager_OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (SceneManager.GetActiveScene() == scene)
		{
			inheli = false;
			canchangeplayer = true;
			heli = null;
			legs = null;
			helispawndelay = 0f;
			helidead = false;
		}
	}

	private void OnDestroy()
	{
		SceneManager.sceneLoaded -= SceneManager_OnSceneLoaded;
	}

	public static void SendHudMessage(string msg, int delay, bool silent)
	{
		MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(msg, "", "", delay, silent);
	}

	public static void Log(string msg, int type)
	{
		if (type == 1)
		{
			Debug.Log((object)msg);
		}
		else if (type == 2)
		{
			Debug.LogWarning((object)msg);
		}
		else if (type == 3)
		{
			Debug.LogError((object)msg);
		}
		else if (type > 3)
		{
			type = 3;
		}
	}

	public static void SetLayerRecursive(GameObject gobject, string layername)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		gobject.layer = LayerMask.NameToLayer(layername);
		foreach (Transform item in gobject.transform)
		{
			Transform val = item;
			((Component)val).gameObject.layer = LayerMask.NameToLayer(layername);
			Transform componentInChildren = ((Component)val).GetComponentInChildren<Transform>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				SetLayerRecursive(((Component)val).gameObject, layername);
			}
		}
	}

	private void Heli()
	{
		//IL_0006: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_1063: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04db: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_0644: Unknown result type (might be due to invalid IL or missing references)
		//IL_0653: Unknown result type (might be due to invalid IL or missing references)
		//IL_0658: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0565: Unknown result type (might be due to invalid IL or missing references)
		//IL_0533: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b86: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0800: Unknown result type (might be due to invalid IL or missing references)
		//IL_080a: Unknown result type (might be due to invalid IL or missing references)
		//IL_080f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0762: Unknown result type (might be due to invalid IL or missing references)
		//IL_0771: Unknown result type (might be due to invalid IL or missing references)
		//IL_077b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0780: Unknown result type (might be due to invalid IL or missing references)
		//IL_078f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0799: Unknown result type (might be due to invalid IL or missing references)
		//IL_079e: Unknown result type (might be due to invalid IL or missing references)
		//IL_073f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f14: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c88: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cbf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ce8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0877: Unknown result type (might be due to invalid IL or missing references)
		//IL_0845: Unknown result type (might be due to invalid IL or missing references)
		//IL_084a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d2c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d3b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d4f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d59: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d81: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0de1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f6b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0af9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b1d: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)spawnkey).Value))
		{
			SpawnHeli();
		}
		if ((Object)(object)heli != (Object)null)
		{
			if ((Object)(object)beamcutterbeam == (Object)null)
			{
				beamcutterbeam = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Unused/BeamgunBeam.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation, ((Component)MonoSingleton<CameraController>.instance).transform);
				bcbeam = beamcutterbeam.GetComponent<BeamgunBeam>();
				bcbeam.beamWidth = 0f;
				bcbeam.beamCheckSpeed = 0f;
				beamcutterbeam.AddComponent<TMechBeamID>();
			}
			harpoonshotdelay = Mathf.MoveTowards(harpoonshotdelay, 0f, Time.deltaTime);
			if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Helicopter)
			{
				blades.SetActive(true);
				blades2.SetActive(true);
				if (((Behaviour)heli.GetComponent<AlwaysLookAtCamera>()).enabled)
				{
					((Behaviour)heli.GetComponent<AlwaysLookAtCamera>()).enabled = false;
				}
				if ((Object)(object)legs != (Object)null)
				{
					Object.Destroy((Object)(object)legs);
					heli.transform.parent = null;
				}
				if (!helidead)
				{
					heli.GetComponent<Rigidbody>().isKinematic = false;
				}
				((Collider)heli.GetComponent<BoxCollider>()).enabled = true;
				if ((Object)(object)barrel != (Object)null)
				{
					Object.Destroy((Object)(object)barrel);
				}
				if ((Object)(object)arms != (Object)null)
				{
					((Component)arms).gameObject.SetActive(false);
				}
			}
			if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker && !helidead)
			{
				blades.SetActive(false);
				blades2.SetActive(false);
				heli.transform.localPosition = new Vector3(0f, 2.5f, 0f);
				if ((Object)(object)legs == (Object)null)
				{
					legs = MakeLegs();
				}
				if ((Object)(object)legs != (Object)null && inheli)
				{
					legs.transform.rotation = ((Component)MonoSingleton<NewMovement>.instance).transform.rotation;
				}
				heli.GetComponent<Rigidbody>().isKinematic = true;
				((Collider)heli.GetComponent<BoxCollider>()).enabled = false;
				Vector2 val = MonoSingleton<InputManager>.instance.InputSource.Move.ReadValue<Vector2>();
				if (!legs.GetComponent<Rigidbody>().isKinematic && inheli)
				{
					lleg.transform.localRotation = Quaternion.Euler(legrot * val.y, 0f, (0f - legrot) * val.x);
					rleg.transform.localRotation = Quaternion.Euler((0f - legrot) * val.y, 0f, legrot * val.x);
				}
				if (!inheli)
				{
					lleg.transform.localRotation = Quaternion.Euler(17f, 0f, 342f);
					rleg.transform.localRotation = Quaternion.Euler(342f, 0f, 17f);
					((Behaviour)heli.GetComponent<AlwaysLookAtCamera>()).enabled = false;
				}
				else
				{
					((Behaviour)heli.GetComponent<AlwaysLookAtCamera>()).enabled = false;
				}
				if ((Object)(object)arms != (Object)null)
				{
					((Component)arms).gameObject.SetActive(true);
					if (((ConfigValueElement<AbilityType>)(object)ability).Value == AbilityType.Harpoon)
					{
						((Component)arms.GetChild(0)).gameObject.SetActive(true);
					}
					else
					{
						((Component)arms.GetChild(0)).gameObject.SetActive(false);
					}
					if (((ConfigValueElement<AbilityType>)(object)ability).Value == AbilityType.Laser)
					{
						((Component)arms.GetChild(2)).gameObject.SetActive(true);
					}
					else
					{
						((Component)arms.GetChild(2)).gameObject.SetActive(false);
					}
					if (((ConfigValueElement<AbilityType>)(object)ability).Value == AbilityType.Cannonball)
					{
						((Component)arms.GetChild(4)).gameObject.SetActive(true);
					}
					else
					{
						((Component)arms.GetChild(4)).gameObject.SetActive(false);
					}
				}
			}
			Vector3 val2 = ((Component)MonoSingleton<NewMovement>.instance).transform.position - heli.transform.position;
			KeyCode value;
			if (Mathf.Abs(((Vector3)(ref val2)).magnitude) < 5f)
			{
				if (cansendhudtip && heliexitdelay <= 0f && !inheli)
				{
					value = ((ConfigValueElement<KeyCode>)(object)exitkey).Value;
					SendHudMessage("Press " + ((object)(KeyCode)(ref value)).ToString() + " to enter", 0, silent: false);
					cansendhudtip = false;
				}
				if (Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)exitkey).Value) && !inheli && heliexitdelay <= 0f)
				{
					Log("entered heli", 1);
					inheli = true;
					heliexitdelay = 0.5f;
					cansendhudtip = true;
				}
			}
			val2 = ((Component)MonoSingleton<NewMovement>.instance).transform.position - heli.transform.position;
			if (Mathf.Abs(((Vector3)(ref val2)).magnitude) <= 5f && !inheli)
			{
				((Component)tcmodel.transform.GetChild(0)).GetComponentInChildren<Door>().Open(false, false);
				((Component)tcmodel.transform.GetChild(1)).GetComponentInChildren<Door>().Open(false, false);
			}
			val2 = ((Component)MonoSingleton<NewMovement>.instance).transform.position - heli.transform.position;
			if (Mathf.Abs(((Vector3)(ref val2)).magnitude) > 5f || inheli)
			{
				((Component)tcmodel.transform.GetChild(0)).GetComponentInChildren<Door>().Close(false);
				((Component)tcmodel.transform.GetChild(1)).GetComponentInChildren<Door>().Close(false);
			}
			if (inheli)
			{
				if (MonoSingleton<NewMovement>.instance.dead)
				{
					KillHeli();
				}
				heli.transform.rotation = ((Component)MonoSingleton<CameraController>.instance).transform.rotation;
				if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker)
				{
					if (!((ConfigValueElement<bool>)(object)insidevisible).Value)
					{
						((Component)MonoSingleton<NewMovement>.instance).transform.position = heli.transform.position;
					}
					else
					{
						((Component)MonoSingleton<NewMovement>.instance).transform.position = heli.transform.position + heli.transform.up * 1.5f + heli.transform.forward * 2f;
					}
				}
				if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Helicopter)
				{
					((Component)MonoSingleton<NewMovement>.instance).transform.position = heli.transform.position + heli.transform.up * 1.5f + heli.transform.forward * 2f;
				}
				if (cansendhudtip && heliexitdelay <= 0f)
				{
					value = ((ConfigValueElement<KeyCode>)(object)exitkey).Value;
					SendHudMessage("Press " + ((object)(KeyCode)(ref value)).ToString() + " to exit", 0, silent: false);
					cansendhudtip = false;
				}
				if (Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)exitkey).Value) && heliexitdelay <= 0f)
				{
					inheli = false;
					heliexitdelay = 0.5f;
					cansendhudtip = true;
				}
				((Component)MonoSingleton<NewMovement>.instance).GetComponent<Rigidbody>().isKinematic = true;
				for (int i = 0; i < ((Component)MonoSingleton<GunControl>.instance).transform.childCount; i++)
				{
					((Component)((Component)MonoSingleton<GunControl>.instance).transform.GetChild(i)).gameObject.SetActive(false);
				}
				canchangeplayer = true;
				if (MonoSingleton<InputManager>.instance.InputSource.Fire1.IsPressed && MonoSingleton<GunControl>.instance.activated)
				{
					if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Hitscan)
					{
						ShootHeli();
					}
					if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Shotgun)
					{
						ShootHeliShotgun();
					}
					if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Rocket && ((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value != ThunderCopterShotType.Rocket)
					{
						ShootHeli();
					}
				}
				if ((MonoSingleton<InputManager>.instance.InputSource.Fire1.IsPressed || MonoSingleton<InputManager>.instance.InputSource.Fire2.IsPressed) && MonoSingleton<GunControl>.instance.activated && ((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Rocket && ((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Rocket)
				{
					ShootHeli();
				}
				if (MonoSingleton<InputManager>.instance.InputSource.Fire2.IsPressed && MonoSingleton<GunControl>.instance.activated && (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value != ThunderCopterBottomShotType.Rocket || ((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value != ThunderCopterShotType.Rocket))
				{
					ShootHeli2();
				}
				if ((MonoSingleton<InputManager>.instance.InputSource.Fire1.IsPressed || MonoSingleton<InputManager>.instance.InputSource.Fire2.IsPressed) && MonoSingleton<GunControl>.instance.activated && ((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Rocket && ((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Rocket)
				{
					ShootHeli2();
				}
				bladerot = Mathf.MoveTowards(bladerot, float.PositiveInfinity, Time.deltaTime * 1500f);
				blades.transform.localRotation = Quaternion.Euler(90f, bladerot, 0f);
				blades2.transform.localRotation = Quaternion.Euler(0f, 90f, bladerot);
				((Renderer)blades.GetComponent<SpriteRenderer>()).enabled = true;
				((Renderer)blades2.GetComponent<SpriteRenderer>()).enabled = true;
			}
			else
			{
				bladerot = Mathf.MoveTowards(bladerot, float.PositiveInfinity, Time.deltaTime * 150f);
				blades.transform.localRotation = Quaternion.Euler(90f, bladerot, 0f);
				((Renderer)blades.GetComponent<SpriteRenderer>()).enabled = false;
				((Renderer)blades2.GetComponent<SpriteRenderer>()).enabled = false;
			}
			heliexitdelay = Mathf.MoveTowards(heliexitdelay, 0f, Time.deltaTime);
			if (helidead)
			{
				beamtimer = Mathf.MoveTowards(beamtimer, 0f, Time.deltaTime);
				if (beamtimer <= 0f && beamsleft > 0)
				{
					beamtimer = 0.25f;
					beamsleft--;
					Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Railcannon Beam Malicious.prefab"), heli.transform.position, Quaternion.Euler((float)Random.Range(0, 360), (float)Random.Range(0, 360), (float)Random.Range(0, 360)));
					Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Breaks/BreakParticleMetal.prefab"), heli.transform.position + new Vector3(Random.Range(-3f, 3f), Random.Range(1.5f, 4.5f), Random.Range(-3f, 3f)), Quaternion.Euler((float)Random.Range(0, 360), (float)Random.Range(0, 360), (float)Random.Range(0, 360)));
				}
				if (beamtimer <= 0f && beamsleft <= 0)
				{
					GameObject val3 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Harmless.prefab"), heli.transform.position, heli.transform.rotation);
					Transform transform = val3.transform;
					transform.localScale *= 3f;
					for (int j = 0; j < 6; j++)
					{
						Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Breaks/BreakParticleMetal.prefab"), heli.transform.position + new Vector3(Random.Range(-3f, 3f), Random.Range(1.5f, 4.5f), Random.Range(-3f, 3f)), Quaternion.Euler((float)Random.Range(0, 360), (float)Random.Range(0, 360), (float)Random.Range(0, 360)));
					}
					helidead = false;
					Object.Destroy((Object)(object)heli);
				}
			}
			if (inheli)
			{
				if (!((ConfigValueElement<bool>)(object)insidevisible).Value)
				{
					SetLayerRecursive(heli, "Invisible");
				}
				else
				{
					SetLayerRecursive(heli, "Outdoors");
				}
				if ((Object)(object)legs != (Object)null)
				{
					SetLayerRecursive(((Component)legs.transform.GetChild(3)).gameObject, "Invisible");
				}
				SetLayerRecursive(((Component)tcmodel.transform.GetChild(2)).gameObject, "Outdoors");
			}
			else
			{
				SetLayerRecursive(heli, "Outdoors");
				if ((Object)(object)legs != (Object)null)
				{
					SetLayerRecursive(((Component)legs.transform.GetChild(3)).gameObject, "Outdoors");
				}
				if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Helicopter)
				{
					heli.transform.rotation = Quaternion.identity;
				}
			}
			if (inheli && ((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker && harpoonshotdelay <= 0f && (Object)(object)harpoon == (Object)null && Input.GetKeyDown(((ConfigValueElement<KeyCode>)(object)abilitykey).Value))
			{
				if (MonoSingleton<NewMovement>.instance.boostCharge == 300f)
				{
					if (((ConfigValueElement<AbilityType>)(object)ability).Value == AbilityType.Harpoon)
					{
						FireHarpoon();
					}
					if (((ConfigValueElement<AbilityType>)(object)ability).Value == AbilityType.Cannonball)
					{
						FireCannonball();
					}
					if (((ConfigValueElement<AbilityType>)(object)ability).Value == AbilityType.Laser)
					{
						FireLaser();
					}
					MonoSingleton<NewMovement>.instance.boostCharge = 0f;
				}
				else
				{
					Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/sounds/TMechCantUseAbility.prefab"));
				}
			}
		}
		if (canchangeplayer && !inheli)
		{
			((Component)MonoSingleton<NewMovement>.instance).GetComponent<Rigidbody>().isKinematic = false;
			if ((Object)(object)heli != (Object)null)
			{
				heli.transform.rotation = ((Component)MonoSingleton<NewMovement>.instance).transform.rotation;
			}
			canchangeplayer = false;
		}
		shoottimer = Mathf.MoveTowards(shoottimer, 0f, Time.deltaTime);
		shoot2timer = Mathf.MoveTowards(shoot2timer, 0f, Time.deltaTime * 2f);
		shoot3timer = Mathf.MoveTowards(shoot3timer, 0f, Time.deltaTime);
		shoot4timer = Mathf.MoveTowards(shoot4timer, 0f, Time.deltaTime * 2f);
		helispawndelay = Mathf.MoveTowards(helispawndelay, 0f, Time.deltaTime);
	}

	public static void SpawnHeli()
	{
		//IL_00b2: 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_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: 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)
		if ((Object)(object)heli == (Object)null)
		{
			if (helispawndelay <= 0f)
			{
				heli = MakeHeli("Helicopter");
			}
			else
			{
				SendHudMessage("Please wait " + Mathf.Round(helispawndelay) + " more seconds before spawning the Thundercopter.", 0, silent: false);
			}
		}
		else
		{
			if (helidead)
			{
				return;
			}
			if (!inheli)
			{
				if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Helicopter)
				{
					heli.transform.position = ((Component)MonoSingleton<NewMovement>.instance).transform.position + new Vector3(0f, 6f, 0f);
				}
				if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker && (Object)(object)legs == (Object)null)
				{
					legs = MakeLegs();
				}
				if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker && (Object)(object)legs != (Object)null)
				{
					legs.transform.position = ((Component)MonoSingleton<NewMovement>.instance).transform.position + new Vector3(0f, 6f, 0f) + ((Component)MonoSingleton<NewMovement>.instance).transform.forward * 2f;
					legs.transform.rotation = ((Component)MonoSingleton<NewMovement>.instance).transform.rotation;
					legs.GetComponent<Rigidbody>().velocity = Vector3.zero;
				}
			}
			else
			{
				SendHudMessage("<color=red>Can't spawn the </color>" + ((ConfigValueElement<ThunderCopterType>)(object)tctype).Value.ToString() + "<color=red> while inside it, dumbass</color>", 0, silent: false);
			}
		}
	}

	public static void KillHeli()
	{
		if ((Object)(object)heli != (Object)null)
		{
			if ((Object)(object)legs != (Object)null)
			{
				heli.transform.parent = null;
				Object.Destroy((Object)(object)legs);
			}
			helispawndelay = 7f;
			inheli = false;
			canchangeplayer = true;
			helidead = true;
			beamsleft = 4;
			heli.GetComponent<Rigidbody>().isKinematic = true;
		}
	}

	public static GameObject MakeHeli(string name)
	{
		//IL_0015: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Expected O, but got Unknown
		//IL_00cb: 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_00ed: 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_010d: 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_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)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: 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_018a: Expected O, but got Unknown
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Expected O, but got Unknown
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Expected O, but got Unknown
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Expected O, but got Unknown
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_0488: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_056e: Expected O, but got Unknown
		//IL_057b: Unknown result type (might be due to invalid IL or missing references)
		//IL_05af: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Expected O, but got Unknown
		//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0509: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Sandbox/Procedural Armor.prefab"), ((Component)MonoSingleton<NewMovement>.instance).transform.position + new Vector3(0f, 6f, 0f), Quaternion.identity);
		((Behaviour)val.GetComponent<BrushBlock>()).enabled = false;
		val.transform.localScale = new Vector3(1f, 1f, 1f);
		val.AddComponent<Rigidbody>();
		((Object)val).name = name;
		val.GetComponent<Rigidbody>().isKinematic = false;
		Object.Destroy((Object)(object)((Component)val.transform.GetChild(0)).gameObject);
		GameObject val2 = new GameObject();
		val2.transform.SetParent(val.transform);
		val2.transform.localScale = new Vector3(1f, 1f, 1f);
		val2.transform.localPosition = Vector3.zero;
		val2.transform.localRotation = Quaternion.Euler(Vector3.zero);
		tcmodel = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/thundercopterbody.prefab"), val.transform.position, val.transform.rotation * Quaternion.Euler(0f, 180f, 0f), val.transform);
		((Renderer)val.GetComponent<MeshRenderer>()).enabled = false;
		val.layer = LayerMask.NameToLayer("Outdoors");
		blades = Object.Instantiate<GameObject>(new GameObject(), val.transform.position, val.transform.rotation, val2.transform);
		blades.AddComponent<SpriteRenderer>();
		blades.GetComponent<SpriteRenderer>().sprite = Fetch<Sprite>("Assets/Textures/Sprites/splash 2.png");
		blades.transform.localScale = new Vector3(50f, 50f, 50f);
		blades.transform.localRotation = Quaternion.Euler(90f, bladerot, 0f);
		blades.transform.localPosition = new Vector3(0f, 4.4255f, 0f);
		for (int i = 0; i < 4; i++)
		{
			GameObject val3 = Object.Instantiate<GameObject>(new GameObject(), blades.transform.position, blades.transform.rotation, blades.transform);
			val3.AddComponent<SpriteRenderer>();
			val3.GetComponent<SpriteRenderer>().sprite = Fetch<Sprite>("Assets/Textures/Sprites/muzzleflashwhite.png");
			val3.GetComponent<SpriteRenderer>().color = new Color(0f, 0f, 0f, 1f);
			val3.transform.localScale = new Vector3(1f, 0.3f, 1f);
			if (i >= 2)
			{
				val3.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			}
		}
		blades2 = Object.Instantiate<GameObject>(new GameObject(), val.transform.position, val.transform.rotation, val2.transform);
		blades2.AddComponent<SpriteRenderer>();
		blades2.GetComponent<SpriteRenderer>().sprite = Fetch<Sprite>("Assets/Textures/Sprites/splash 2.png");
		blades2.transform.localScale = new Vector3(20f, 20f, 20f);
		blades2.transform.localRotation = Quaternion.Euler(0f, 90f, bladerot);
		blades2.transform.localPosition = new Vector3(0f, 3.0218f, -9.4745f);
		for (int j = 0; j < 4; j++)
		{
			GameObject val4 = Object.Instantiate<GameObject>(new GameObject(), blades2.transform.position, blades2.transform.rotation, blades2.transform);
			val4.AddComponent<SpriteRenderer>();
			val4.GetComponent<SpriteRenderer>().sprite = Fetch<Sprite>("Assets/Textures/Sprites/muzzleflashwhite.png");
			val4.GetComponent<SpriteRenderer>().color = new Color(0f, 0f, 0f, 1f);
			val4.transform.localScale = new Vector3(1f, 0.3f, 1f);
			if (j >= 2)
			{
				val4.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
			}
		}
		for (int k = 0; k < 1; k++)
		{
			if (k == 1)
			{
				GameObject val5 = new GameObject();
				val5.transform.rotation = val.transform.rotation;
				val5.transform.parent = val.transform;
				val5.transform.localPosition = new Vector3(0.6f, 0f, 1f);
				val5.AddComponent<Light>();
				val5.GetComponent<Light>().type = (LightType)0;
				val5.GetComponent<Light>().spotAngle = 75f;
				val5.GetComponent<Light>().range = 1000f;
				val5.GetComponent<Light>().intensity = 0.75f;
			}
			else
			{
				GameObject val6 = new GameObject();
				val6.transform.rotation = val.transform.rotation;
				val6.transform.parent = val.transform;
				val6.transform.localPosition = new Vector3(-0.6f, 0f, 1f);
				val6.AddComponent<Light>();
				val6.GetComponent<Light>().type = (LightType)0;
				val6.GetComponent<Light>().spotAngle = 75f;
				val6.GetComponent<Light>().range = 1000f;
				val6.GetComponent<Light>().intensity = 0.75f;
			}
		}
		((Component)val.transform).tag = "Untagged";
		val.GetComponent<Rigidbody>().mass = 1000f;
		SetLayerRecursive(val, "Outdoors");
		val.AddComponent<AlwaysLookAtCamera>();
		AlwaysLookAtCamera component = val.GetComponent<AlwaysLookAtCamera>();
		component.speed = 100f;
		((Behaviour)component).enabled = false;
		arms = tcmodel.transform.GetChild(2);
		return val;
	}

	public static GameObject MakeLegs()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_0440: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		//IL_04be: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_0521: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject();
		val.transform.position = heli.transform.position;
		heli.transform.parent = val.transform;
		lleg = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/leg.prefab"));
		((Object)lleg.transform).name = "Leg_Left";
		lleg.transform.position = val.transform.position;
		lleg.transform.rotation = val.transform.rotation;
		lleg.transform.parent = val.transform;
		rleg = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/leg.prefab"));
		((Object)rleg.transform).name = "Leg_Right";
		rleg.transform.position = val.transform.position;
		rleg.transform.rotation = val.transform.rotation;
		rleg.transform.parent = val.transform;
		GameObject val2 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Sandbox/Procedural Armor.prefab"), val.transform.position, val.transform.rotation, val.transform);
		((Object)val2).name = "part";
		((Collider)val2.GetComponent<BoxCollider>()).enabled = false;
		((Behaviour)val2.GetComponent<BrushBlock>()).enabled = false;
		((Component)val2.transform).tag = "Untagged";
		Object.Destroy((Object)(object)((Component)val2.transform.GetChild(0)).gameObject);
		val2.transform.localScale = new Vector3(5f, 2f, 3f);
		lleg.transform.localPosition = new Vector3(-1.8f, 0f, 0f);
		rleg.transform.localPosition = new Vector3(1.8f, 0f, 0f);
		val.AddComponent<Rigidbody>();
		val.GetComponent<Rigidbody>().isKinematic = false;
		val.AddComponent<CapsuleCollider>();
		val.GetComponent<CapsuleCollider>().radius = 1f;
		val.GetComponent<CapsuleCollider>().height = 7.5f;
		val.GetComponent<CapsuleCollider>().center = new Vector3(0f, -3.75f, 0f);
		val.GetComponent<Rigidbody>().constraints = (RigidbodyConstraints)112;
		barrel = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Sandbox/Barrel Prop.prefab"), heli.transform.position, heli.transform.rotation, heli.transform);
		Object.Destroy((Object)(object)((Component)barrel.transform.GetChild(0)).gameObject);
		barrel.GetComponent<Rigidbody>().isKinematic = true;
		barrel.transform.localPosition = new Vector3(0f, 0.6f, -10.4195f);
		barrel.transform.localScale = new Vector3(2f, 2f, 2.3100002f);
		((Collider)barrel.GetComponent<MeshCollider>()).enabled = false;
		((Renderer)barrel.GetComponent<MeshRenderer>()).material = ((Renderer)Fetch<GameObject>("Assets/Prefabs/Sandbox/Procedural Armor.prefab").GetComponent<MeshRenderer>()).material;
		SetLayerRecursive(val, "Outdoors");
		val.layer = LayerMask.NameToLayer("Default");
		lleg.transform.localScale = new Vector3(1f, 1f, 1f);
		rleg.transform.localScale = new Vector3(1f, 1f, 1f);
		GameObject val3 = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/jumpjet.prefab"), val.transform.position, val.transform.rotation, val.transform);
		val3.transform.localPosition = new Vector3(-1.2273f, 0f, -2.9909f);
		val3.transform.localRotation = Quaternion.Euler(19.6421f, 0f, 0f);
		GameObject val4 = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/jumpjet.prefab"), val.transform.position, val.transform.rotation, val.transform);
		val4.transform.localPosition = new Vector3(1.2273f, 0f, -2.9909f);
		val4.transform.localRotation = Quaternion.Euler(19.6421f, 0f, 0f);
		val.GetComponent<Rigidbody>().mass = 1000f;
		((Object)val).name = "Thundermech";
		val.transform.position = ((Component)MonoSingleton<NewMovement>.instance).transform.position + new Vector3(0f, 6f, 0f) + ((Component)MonoSingleton<NewMovement>.instance).transform.forward * 2f;
		val.transform.rotation = ((Component)MonoSingleton<NewMovement>.instance).transform.rotation;
		val.GetComponent<Rigidbody>().velocity = Vector3.zero;
		return val;
	}

	private void ShootHeli()
	{
		//IL_0081: 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_0095: 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_009b: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_0354: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_0454: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: Unknown result type (might be due to invalid IL or missing references)
		//IL_0499: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		if (shoottimer <= 0f)
		{
			if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Hitscan)
			{
				Log("shot", 1);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(Random.Range(-2f, 2f), Random.Range(-4f, 4f), Random.Range(-2f, 2f));
				GameObject val2 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Revolver Beam.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation * Quaternion.Euler(val));
				val2.GetComponent<RevolverBeam>().alternateStartPoint = heli.transform.position + heli.transform.right * 3f;
				shoottimer = 0.1f;
				shoot2timer = 0.1f;
				val2.AddComponent<AudioSource>();
				val2.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Gutterman Beam.prefab").GetComponent<AudioSource>().clip;
				AudioSource component = val2.GetComponent<AudioSource>();
				component.volume /= 2f;
				AudioSource component2 = val2.GetComponent<AudioSource>();
				component2.pitch /= 2f;
				val2.GetComponent<AudioSource>().Play();
				MonoSingleton<CameraController>.instance.CameraShake(0.1f);
			}
			if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Rocket)
			{
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(Random.Range(-2f, 2f), Random.Range(-4f, 4f), Random.Range(-2f, 2f));
				GameObject val4 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Rocket.prefab"), heli.transform.position + heli.transform.right * -3f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
				val4.transform.LookAt(bcbeam.hitPosition);
				Transform transform = val4.transform;
				transform.localRotation *= Quaternion.Euler(val3);
				Grenade component3 = val4.GetComponent<Grenade>();
				component3.rocketSpeed *= 2f;
				shoottimer = 0.67f;
				shoot2timer = 0.67f;
				MonoSingleton<CameraController>.instance.CameraShake(0.5f);
				val4.GetComponent<Grenade>().harmlessExplosion = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
			}
			canshoot2 = true;
		}
		if (canshoot2 && shoot2timer <= 0f)
		{
			if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Hitscan)
			{
				Log("shot", 1);
				Vector3 val5 = default(Vector3);
				((Vector3)(ref val5))..ctor(Random.Range(-2f, 2f), Random.Range(-4f, 4f), Random.Range(-2f, 2f));
				GameObject val6 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Revolver Beam.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation * Quaternion.Euler(val5));
				val6.GetComponent<RevolverBeam>().alternateStartPoint = heli.transform.position + heli.transform.right * -3f;
				val6.AddComponent<AudioSource>();
				val6.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Gutterman Beam.prefab").GetComponent<AudioSource>().clip;
				AudioSource component4 = val6.GetComponent<AudioSource>();
				component4.volume /= 2f;
				AudioSource component5 = val6.GetComponent<AudioSource>();
				component5.pitch /= 2f;
				val6.GetComponent<AudioSource>().Play();
				MonoSingleton<CameraController>.instance.CameraShake(0.1f);
			}
			if (((ConfigValueElement<ThunderCopterBottomShotType>)(object)bottombeamtype).Value == ThunderCopterBottomShotType.Rocket)
			{
				Vector3 val7 = default(Vector3);
				((Vector3)(ref val7))..ctor(Random.Range(-2f, 2f), Random.Range(-4f, 4f), Random.Range(-2f, 2f));
				GameObject val8 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Rocket.prefab"), heli.transform.position + heli.transform.right * 3f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
				val8.transform.LookAt(bcbeam.hitPosition);
				Transform transform2 = val8.transform;
				transform2.localRotation *= Quaternion.Euler(val7);
				Grenade component6 = val8.GetComponent<Grenade>();
				component6.rocketSpeed *= 2f;
				MonoSingleton<CameraController>.instance.CameraShake(0.5f);
				val8.GetComponent<Grenade>().harmlessExplosion = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
			}
			canshoot2 = false;
		}
	}

	private void ShootHeliShotgun()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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_00b2: 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_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_0132: 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_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)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		if (shoottimer <= 0f)
		{
			Log("shot", 1);
			Vector3 val = default(Vector3);
			for (int i = 0; i < 24; i++)
			{
				((Vector3)(ref val))..ctor((float)Random.Range(-5, 5), (float)Random.Range(-5, 5), (float)Random.Range(-5, 5));
				GameObject val2 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Shotgun Projectile.prefab"), heli.transform.position + heli.transform.right * 3f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation * Quaternion.Euler(val));
				val2.transform.LookAt(bcbeam.hitPosition);
				Transform transform = val2.transform;
				transform.localRotation *= Quaternion.Euler(val);
				Projectile component = val2.GetComponent<Projectile>();
				component.maxSpeed *= 2f;
				Projectile component2 = val2.GetComponent<Projectile>();
				component2.speed *= 2f;
			}
			GameObject val3 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Flashes/ShotgunMuzzleFlash.prefab"), heli.transform.position + heli.transform.right * 3f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
			SetLayerRecursive(val3, "Outdoors");
			val3.AddComponent<AudioSource>();
			val3.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Weapons/Shotgun Grenade.prefab").GetComponent<Shotgun>().shootSound;
			val3.GetComponent<AudioSource>().pitch = Random.Range(1.33f, 1.75f);
			AudioSource component3 = val3.GetComponent<AudioSource>();
			component3.volume /= 2f;
			val3.GetComponent<AudioSource>().Play();
			shoottimer = 0.5f;
			shoot2timer = 0.5f;
			canshoot2 = true;
			MonoSingleton<CameraController>.instance.CameraShake(0.25f);
		}
		if (canshoot2 && shoot2timer <= 0f)
		{
			Log("shot", 1);
			Vector3 val4 = default(Vector3);
			for (int j = 0; j < 24; j++)
			{
				((Vector3)(ref val4))..ctor((float)Random.Range(-5, 5), (float)Random.Range(-5, 5), (float)Random.Range(-5, 5));
				GameObject val5 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Shotgun Projectile.prefab"), heli.transform.position + heli.transform.right * -3f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation * Quaternion.Euler(val4));
				val5.transform.LookAt(bcbeam.hitPosition);
				Transform transform2 = val5.transform;
				transform2.localRotation *= Quaternion.Euler(val4);
				Projectile component4 = val5.GetComponent<Projectile>();
				component4.maxSpeed *= 2f;
				Projectile component5 = val5.GetComponent<Projectile>();
				component5.speed *= 2f;
			}
			GameObject val6 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Flashes/ShotgunMuzzleFlash.prefab"), heli.transform.position + heli.transform.right * 3f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
			SetLayerRecursive(val6, "Outdoors");
			val6.AddComponent<AudioSource>();
			val6.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Weapons/Shotgun Grenade.prefab").GetComponent<Shotgun>().shootSound;
			val6.GetComponent<AudioSource>().pitch = Random.Range(1.33f, 1.75f);
			AudioSource component6 = val6.GetComponent<AudioSource>();
			component6.volume /= 2f;
			val6.GetComponent<AudioSource>().Play();
			canshoot2 = false;
			MonoSingleton<CameraController>.instance.CameraShake(0.25f);
		}
	}

	private void ShootHeli2()
	{
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_0352: Unknown result type (might be due to invalid IL or missing references)
		//IL_0357: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_0396: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: 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_0091: 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_01c8: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: 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_00ed: 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_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0718: Unknown result type (might be due to invalid IL or missing references)
		//IL_0727: Unknown result type (might be due to invalid IL or missing references)
		//IL_0731: Unknown result type (might be due to invalid IL or missing references)
		//IL_0736: Unknown result type (might be due to invalid IL or missing references)
		//IL_0745: Unknown result type (might be due to invalid IL or missing references)
		//IL_074f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0754: Unknown result type (might be due to invalid IL or missing references)
		//IL_0763: Unknown result type (might be due to invalid IL or missing references)
		//IL_077b: Unknown result type (might be due to invalid IL or missing references)
		//IL_078e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0793: Unknown result type (might be due to invalid IL or missing references)
		//IL_0795: Unknown result type (might be due to invalid IL or missing references)
		//IL_079a: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0603: Unknown result type (might be due to invalid IL or missing references)
		//IL_060d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0612: Unknown result type (might be due to invalid IL or missing references)
		//IL_0621: Unknown result type (might be due to invalid IL or missing references)
		//IL_062b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0630: Unknown result type (might be due to invalid IL or missing references)
		//IL_0635: Unknown result type (might be due to invalid IL or missing references)
		if (shoot3timer <= 0f)
		{
			Log("shot", 1);
			if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value != ThunderCopterShotType.Rocket)
			{
				shoot3timer = 2f;
				shoot4timer = 2f;
			}
			if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Malicious)
			{
				for (int i = 0; i < 2; i++)
				{
					GameObject val = null;
					val = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Railcannon Beam Malicious.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
					if ((Object)(object)val != (Object)null)
					{
						val.GetComponent<RevolverBeam>().alternateStartPoint = heli.transform.position + heli.transform.right * 3f + heli.transform.up * 4f;
						val.AddComponent<AudioSource>();
						val.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Turret Beam.prefab").GetComponent<AudioSource>().clip;
						AudioSource component = val.GetComponent<AudioSource>();
						component.volume /= 2f;
						AudioSource component2 = val.GetComponent<AudioSource>();
						component2.pitch /= 2f;
						val.GetComponent<AudioSource>().Play();
					}
				}
			}
			if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Electric)
			{
				for (int j = 0; j < 2; j++)
				{
					GameObject val2 = null;
					val2 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Railcannon Beam.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
					if ((Object)(object)val2 != (Object)null)
					{
						val2.GetComponent<RevolverBeam>().alternateStartPoint = heli.transform.position + heli.transform.right * 3f + heli.transform.up * 4f;
						val2.AddComponent<AudioSource>();
						val2.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Turret Beam.prefab").GetComponent<AudioSource>().clip;
						AudioSource component3 = val2.GetComponent<AudioSource>();
						component3.volume /= 6f;
						AudioSource component4 = val2.GetComponent<AudioSource>();
						component4.pitch /= 2f;
						val2.GetComponent<AudioSource>().Play();
					}
				}
			}
			if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Rocket)
			{
				Vector3 val3 = default(Vector3);
				((Vector3)(ref val3))..ctor(Random.Range(-2f, 2f), Random.Range(-4f, 4f), Random.Range(-2f, 2f));
				GameObject val4 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Rocket.prefab"), heli.transform.position + heli.transform.right * 3f + heli.transform.up * 4f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
				val4.transform.LookAt(bcbeam.hitPosition);
				Transform transform = val4.transform;
				transform.localRotation *= Quaternion.Euler(val3);
				Grenade component5 = val4.GetComponent<Grenade>();
				component5.rocketSpeed *= 2f;
				shoot3timer = 0.67f;
				shoot4timer = 0.67f;
				MonoSingleton<CameraController>.instance.CameraShake(0.5f);
				val4.GetComponent<Grenade>().harmlessExplosion = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
			}
			else
			{
				MonoSingleton<CameraController>.instance.CameraShake(1f);
			}
			canshoot3 = true;
		}
		if (!canshoot3 || !(shoot4timer <= 0f))
		{
			return;
		}
		Log("shot", 1);
		if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Malicious)
		{
			for (int k = 0; k < 2; k++)
			{
				GameObject val5 = null;
				val5 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Railcannon Beam Malicious.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
				if ((Object)(object)val5 != (Object)null)
				{
					val5.GetComponent<RevolverBeam>().alternateStartPoint = heli.transform.position + heli.transform.right * -3f + heli.transform.up * 4f;
					val5.AddComponent<AudioSource>();
					val5.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Turret Beam.prefab").GetComponent<AudioSource>().clip;
					AudioSource component6 = val5.GetComponent<AudioSource>();
					component6.volume /= 2f;
					AudioSource component7 = val5.GetComponent<AudioSource>();
					component7.pitch /= 2f;
					val5.GetComponent<AudioSource>().Play();
				}
			}
		}
		if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Electric)
		{
			for (int l = 0; l < 2; l++)
			{
				GameObject val6 = null;
				val6 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Railcannon Beam.prefab"), ((Component)MonoSingleton<CameraController>.instance).transform.position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
				if ((Object)(object)val6 != (Object)null)
				{
					val6.GetComponent<RevolverBeam>().alternateStartPoint = heli.transform.position + heli.transform.right * -3f + heli.transform.up * 4f;
					val6.AddComponent<AudioSource>();
					val6.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Turret Beam.prefab").GetComponent<AudioSource>().clip;
					AudioSource component8 = val6.GetComponent<AudioSource>();
					component8.volume /= 6f;
					AudioSource component9 = val6.GetComponent<AudioSource>();
					component9.pitch /= 2f;
					val6.GetComponent<AudioSource>().Play();
				}
			}
		}
		if (((ConfigValueElement<ThunderCopterShotType>)(object)topbeamtype).Value == ThunderCopterShotType.Rocket)
		{
			Vector3 val7 = default(Vector3);
			((Vector3)(ref val7))..ctor(Random.Range(-2f, 2f), Random.Range(-4f, 4f), Random.Range(-2f, 2f));
			GameObject val8 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Rocket.prefab"), heli.transform.position + heli.transform.right * -3f + heli.transform.up * 4f, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
			val8.transform.LookAt(bcbeam.hitPosition);
			Transform transform2 = val8.transform;
			transform2.localRotation *= Quaternion.Euler(val7);
			Grenade component10 = val8.GetComponent<Grenade>();
			component10.rocketSpeed *= 2f;
			MonoSingleton<CameraController>.instance.CameraShake(0.5f);
			val8.GetComponent<Grenade>().harmlessExplosion = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion.prefab");
		}
		else
		{
			MonoSingleton<CameraController>.instance.CameraShake(1f);
		}
		canshoot3 = false;
	}

	private void FireHarpoon()
	{
		//IL_002c: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/sounds/TMechHarpoonFire.prefab"));
		GameObject val2 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Harpoon Malicious.prefab"), arms.GetChild(0).GetChild(0).position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
		val2.transform.LookAt(bcbeam.hitPosition);
		harpoon = val2;
		harpoon.GetComponent<Rigidbody>().AddForce(harpoon.transform.forward * harpoonforce, (ForceMode)2);
		harpoon.GetComponent<Harpoon>().breakEffect = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Super.prefab");
		MonoSingleton<CameraController>.instance.CameraShake(0.5f);
		harpoonshotdelay = 1f;
	}

	private void FireCannonball()
	{
		//IL_002c: 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_0051: 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)
		GameObject val = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/sounds/TMechCannonballFire.prefab"));
		GameObject val2 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Cannonball.prefab"), arms.GetChild(4).GetChild(0).position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
		val2.transform.LookAt(bcbeam.hitPosition);
		val2.GetComponent<Rigidbody>().AddForce(val2.transform.forward * harpoonforce, (ForceMode)2);
		val2.GetComponent<Cannonball>().hasBounced = true;
		Cannonball component = val2.GetComponent<Cannonball>();
		component.damage *= 3f;
		val2.GetComponent<Cannonball>().maxBounces = 0;
		MonoSingleton<CameraController>.instance.CameraShake(1f);
		harpoonshotdelay = 1f;
	}

	private void FireLaser()
	{
		//IL_002c: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/sounds/lasershoot.prefab"));
		GameObject val2 = Object.Instantiate<GameObject>(Thundercopter.FetchFromBundle<GameObject>("assets/formods/thundermechroomprefab/laserproj.prefab"), arms.GetChild(4).GetChild(0).position, ((Component)MonoSingleton<CameraController>.instance).transform.rotation);
		val2.transform.LookAt(bcbeam.hitPosition);
		MonoSingleton<CameraController>.instance.CameraShake(1f);
		harpoonshotdelay = 1f;
	}

	private void FixedUpdate()
	{
		//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_007e: 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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: 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_00e3: 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_0102: 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_011b: 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_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: 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_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_0357: Unknown result type (might be due to invalid IL or missing references)
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: 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_01a5: 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_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a50: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0457: Unknown result type (might be due to invalid IL or missing references)
		//IL_040a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0446: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d60: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d75: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d7f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d94: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d99: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
		//IL_070a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e07: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e16: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e2b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e30: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e35: Unknown result type (might be due to invalid IL or missing references)
		//IL_0758: Unknown result type (might be due to invalid IL or missing references)
		//IL_0762: Unknown result type (might be due to invalid IL or missing references)
		//IL_0776: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ba6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bd0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bf4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bf9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bfe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c4e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c72: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c77: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c7c: Unknown result type (might be due to invalid IL or missing references)
		//IL_055f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0564: Unknown result type (might be due to invalid IL or missing references)
		//IL_084f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0868: Unknown result type (might be due to invalid IL or missing references)
		//IL_0872: Unknown result type (might be due to invalid IL or missing references)
		//IL_090a: Unknown result type (might be due to invalid IL or missing references)
		//IL_094a: Unknown result type (might be due to invalid IL or missing references)
		//IL_095e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0973: Unknown result type (might be due to invalid IL or missing references)
		//IL_0978: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_09db: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
		if (!(SceneHelper.CurrentScene != "Main Menu") || !candoshit)
		{
			return;
		}
		if (inheli && ((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Helicopter)
		{
			Vector2 val = MonoSingleton<InputManager>.instance.InputSource.Move.ReadValue<Vector2>();
			if ((Object)(object)heli.GetComponent<Rigidbody>() == (Object)null)
			{
				heli.AddComponent<Rigidbody>();
			}
			else
			{
				Vector3 velocity;
				if (val.x != 0f || val.y != 0f)
				{
					velocity = heli.GetComponent<Rigidbody>().velocity;
					if (((Vector3)(ref velocity)).magnitude < speed / 150f)
					{
						heli.GetComponent<Rigidbody>().AddForce((heli.transform.up * Mathf.Clamp(val.y, -1f, 1f) * speed / 20f + heli.transform.right * Mathf.Clamp(val.x, -1f, 1f) * speed / 20f) * heli.GetComponent<Rigidbody>().mass);
					}
				}
				velocity = heli.GetComponent<Rigidbody>().velocity;
				if (((Vector3)(ref velocity)).magnitude > speed / 150f)
				{
					Rigidbody component = heli.GetComponent<Rigidbody>();
					component.velocity -= heli.GetComponent<Rigidbody>().velocity / 40f;
				}
				if (val.x == 0f && val.y == 0f)
				{
					heli.GetComponent<Rigidbody>().AddForce(Vector3.down * gravity * heli.GetComponent<Rigidbody>().mass);
				}
				heli.GetComponent<Rigidbody>().isKinematic = false;
			}
		}
		if (inheli && ((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker)
		{
			Vector2 val2 = MonoSingleton<InputManager>.instance.InputSource.Move.ReadValue<Vector2>();
			if ((Object)(object)legs.GetComponent<Rigidbody>() == (Object)null)
			{
				legs.AddComponent<Rigidbody>();
			}
			else
			{
				if ((Mathf.Abs(legs.GetComponent<Rigidbody>().velocity.x) + Mathf.Abs(legs.GetComponent<Rigidbody>().velocity.z)) / 2f < speed / 500f)
				{
					legs.GetComponent<Rigidbody>().AddForce((legs.transform.forward * Mathf.Clamp(val2.y, -1f, 1f) * speed / 10f + legs.transform.right * Mathf.Clamp(val2.x, -1f, 1f) * speed / 10f) * legs.GetComponent<Rigidbody>().mass);
				}
				if ((Mathf.Abs(legs.GetComponent<Rigidbody>().velocity.x) + Mathf.Abs(legs.GetComponent<Rigidbody>().velocity.z)) / 2f > speed / 500f || (val2.x == 0f && val2.y == 0f))
				{
					Rigidbody component2 = legs.GetComponent<Rigidbody>();
					component2.velocity -= new Vector3(legs.GetComponent<Rigidbody>().velocity.x, 0f, legs.GetComponent<Rigidbody>().velocity.z) / 10f;
				}
				if (val2.x == 0f && val2.y == 0f)
				{
					legs.GetComponent<CapsuleCollider>().height = Mathf.MoveTowards(legs.GetComponent<CapsuleCollider>().height, 7.5f, Time.deltaTime * 8f);
					legrot = Mathf.MoveTowards(legrot, 0f, Time.deltaTime * 160f);
				}
				else if (!MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed)
				{
					if (legs.GetComponent<CapsuleCollider>().height <= 6f && direction)
					{
						direction = false;
						direction2 = !direction2;
						if (!legs.GetComponent<Rigidbody>().isKinematic)
						{
							Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/SoundBubbles/GuttertankStep.prefab"), legs.transform.position, Quaternion.identity);
						}
					}
					if (legs.GetComponent<CapsuleCollider>().height >= 7.5f && !direction)
					{
						direction = true;
					}
					if (direction)
					{
						legs.GetComponent<CapsuleCollider>().height = Mathf.MoveTowards(legs.GetComponent<CapsuleCollider>().height, 6f, Time.deltaTime * 8f);
					}
					else
					{
						legs.GetComponent<CapsuleCollider>().height = Mathf.MoveTowards(legs.GetComponent<CapsuleCollider>().height, 7.5f, Time.deltaTime * 8f);
					}
					if (direction2)
					{
						legrot = Mathf.MoveTowards(legrot, 45f, Time.deltaTime * 160f);
					}
					else
					{
						legrot = Mathf.MoveTowards(legrot, -45f, Time.deltaTime * 160f);
					}
				}
				else
				{
					if (legs.GetComponent<CapsuleCollider>().height < 7.5f)
					{
						legs.GetComponent<CapsuleCollider>().height = Mathf.MoveTowards(legs.GetComponent<CapsuleCollider>().height, 7.5f, Time.deltaTime * 8f);
					}
					if (legrot != 0f)
					{
						legrot = Mathf.MoveTowards(legrot, 0f, Time.deltaTime * 160f);
					}
				}
				if (legs.GetComponent<Rigidbody>().velocity.y < jumpfrc / 500f && MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed)
				{
					Log("jet", 1);
					legs.GetComponent<Rigidbody>().AddForce(Vector3.up * jumpfrc * legs.GetComponent<Rigidbody>().mass);
					if ((Object)(object)legs.GetComponent<AudioSource>() == (Object)null)
					{
						legs.AddComponent<AudioSource>();
						legs.GetComponent<AudioSource>().pitch = 0.25f;
					}
					if (!legs.GetComponent<AudioSource>().isPlaying)
					{
						legs.GetComponent<AudioSource>().Play();
					}
					if ((Object)(object)legs.GetComponent<AudioSource>() != (Object)null)
					{
						legs.GetComponent<AudioSource>().clip = Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Mindflayer Beam.prefab").GetComponent<AudioSource>().clip;
					}
				}
				if (MonoSingleton<InputManager>.instance.InputSource.Jump.WasCanceledThisFrame)
				{
					legs.GetComponent<Rigidbody>().velocity = new Vector3(legs.GetComponent<Rigidbody>().velocity.x, 0f, legs.GetComponent<Rigidbody>().velocity.z);
				}
				if ((Object)(object)legs.GetComponent<AudioSource>() != (Object)null && !MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed && legs.GetComponent<AudioSource>().isPlaying && (Object)(object)legs.GetComponent<AudioSource>().clip == (Object)(object)Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Mindflayer Beam.prefab").GetComponent<AudioSource>().clip)
				{
					legs.GetComponent<AudioSource>().Stop();
				}
				if (legs.GetComponent<Rigidbody>().velocity.y > jumpfrc / 500f && MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed)
				{
					Rigidbody component3 = legs.GetComponent<Rigidbody>();
					component3.velocity -= new Vector3(0f, legs.GetComponent<Rigidbody>().velocity.y / 10f, 0f);
				}
				if (MonoSingleton<InputManager>.instance.InputSource.Slide.IsPressed && legs.GetComponent<Rigidbody>().velocity.y > (0f - gravity) * 5f)
				{
					legs.GetComponent<Rigidbody>().velocity = Vector3.up * (0f - gravity) * 5f;
				}
				if (MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed && canboom)
				{
					canboom = false;
				}
			}
		}
		if (((ConfigValueElement<ThunderCopterType>)(object)tctype).Value == ThunderCopterType.Walker && (Object)(object)legs != (Object)null)
		{
			if (legs.GetComponent<Rigidbody>().velocity.y < (0f - gravity) * 4f && !MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed)
			{
				canboom = true;
			}
			if (!MonoSingleton<InputManager>.instance.InputSource.Slide.IsPressed && legs.GetComponent<Rigidbody>().velocity.y > (0f - gravity) / 10f && canboom && !MonoSingleton<InputManager>.instance.InputSource.Jump.IsPressed)
			{
				if (MonoSingleton<NewMovement>.instance.boostCharge >= 300f && inheli)
				{
					Log("boom", 1);
					unkinematictimer = 1f;
					unkinematictimer2 = 1f;
					cancrack2 = true;
					legs.GetComponent<Rigidbody>().isKinematic = true;
					if (inheli)
					{
						MonoSingleton<NewMovement>.instance.boostCharge = 0f;
					}
					GameObject val3 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/Explosions/Explosion Gutterman.prefab"), legs.transform.position + legs.transform.up * (0f - legs.GetComponent<CapsuleCollider>().height), Quaternion.identity);
					GameObject val4 = Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Prefabs/Attacks and Projectiles/PhysicalShockwaveHarmless.prefab"), legs.transform.position + legs.transform.up * (0f - legs.GetComponent<CapsuleCollider>().height), Quaternion.identity);
					val4.GetComponent<PhysicalShockwave>().maxSize = 50f;
					PhysicalShockwave component4 = val4.GetComponent<PhysicalShockwave>();
					component4.speed *= 2f;
					canboom = false;
					Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Breaks/BreakParticleBig.prefab"), legs.transform.position + legs.transform.up * (0f - legs.GetComponent<CapsuleCollider>().height), Quaternion.identity);
					if (!inheli)
					{
						KillHeli();
					}
				}
				if (MonoSingleton<NewMovement>.instance.boostCharge < 300f || !inheli)
				{
					canboom = false;
				}
			}
		}
		unkinematictimer = Mathf.MoveTowards(unkinematictimer, 0f, Time.deltaTime);
		unkinematictimer2 = Mathf.MoveTowards(unkinematictimer2, 0f, Time.deltaTime * 2f);
		if (unkinematictimer2 <= 0f && (Object)(object)legs != (Object)null && cancrack2)
		{
			Log("crack1", 1);
			Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Breaks/BreakParticle.prefab"), legs.transform.position + legs.transform.up * (0f - legs.GetComponent<CapsuleCollider>().height), Quaternion.identity);
			rleg.transform.localRotation = Quaternion.Euler(Vector3.zero);
			cancrack2 = false;
		}
		if (unkinematictimer <= 0f && (Object)(object)legs != (Object)null)
		{
			if (legs.GetComponent<Rigidbody>().isKinematic)
			{
				Log("crack2", 1);
				Object.Instantiate<GameObject>(Fetch<GameObject>("Assets/Particles/Breaks/BreakParticle.prefab"), legs.transform.position + legs.transform.up * (0f - legs.GetComponent<CapsuleCollider>().height), Quaternion.identity);
				legrot = 0f;
			}
			legs.GetComponent<Rigidbody>().isKinematic = false;
		}
	}
}
public class InternalConfigValue<T> : ConfigValueElement<T>
{
	public InternalConfigValue(T defaultValue)
		: base(defaultValue)
	{
	}

	protected override void BuildElementCore(ConfiggableAttribute _, RectTransform __)
	{
	}

	protected override void RefreshElementValueCore()
	{
	}
}
internal class TMechBeamID : MonoBehaviour
{
	public bool IsAimingBeam = true;
}
internal class tmech_triggerscr : MonoBehaviour
{
	public static void