Decompiled source of Working HLA gravity gloves with wrist pockets v1.0.1

Mods/GravityGloves.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BoneLib;
using BoneLib.BoneMenu;
using GravityGloves;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.Utilities;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Mod), "Gravity Gloves", "1.0.1", "William", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GravityGloves")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GravityGloves")]
[assembly: AssemblyTitle("GravityGloves")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GravityGloves
{
	internal sealed class AimLine
	{
		private sealed class LineColors
		{
			public readonly Gradient Gradient = new Gradient();

			public readonly Il2CppStructArray<GradientColorKey> ColorKeys = new Il2CppStructArray<GradientColorKey>(2L);

			public readonly Il2CppStructArray<GradientAlphaKey> AlphaKeys = new Il2CppStructArray<GradientAlphaKey>(3L);
		}

		private const int Points = 32;

		private const float FadeInTime = 0.12f;

		private const float FadeOutTime = 0.15f;

		private const float FlashTime = 0.3f;

		private const float GrowTime = 0.15f;

		private const float SqueezeSmoothing = 0.05f;

		private const float MinReach = 0.002f;

		private const float StartFade = 0.2f;

		private const float FadeInEnd = 0.15f;

		private const int CapVertices = 4;

		private const float MaxStiffAngle = 45f;

		private static Material _flareMaterial;

		private static Material _lightMaterial;

		private static bool _lightUnavailable;

		private static AnimationCurve _beamWidth;

		private readonly Il2CppStructArray<Vector3> _points = new Il2CppStructArray<Vector3>(32L);

		private readonly LineColors _glowColors = new LineColors();

		private readonly LineColors _coreColors = new LineColors();

		private readonly LineColors _lightColors = new LineColors();

		private readonly LineColors _hotColors = new LineColors();

		private Material _beamMaterial;

		private LineRenderer _glow;

		private LineRenderer _core;

		private LineRenderer _flare;

		private LineRenderer _light;

		private LineRenderer _hot;

		private bool _unavailable;

		private float _visibility;

		private float _flash;

		private float _reach;

		private float _squeeze = 1f;

		private bool _retracting;

		private float _retractRate;

		private bool _locked;

		private Vector3 _source;

		private float _sparkDebt;

		public bool IsShowing => _visibility > 0f;

		public void Flash(float strength)
		{
			_flash = Mathf.Max(_flash, strength);
		}

		public void Update(bool visible, Vector3 hand, Vector3 aim, Vector3? source, bool locked, Vector3 eye, float squeeze)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: 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_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: 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)
			float unscaledDeltaTime = Time.unscaledDeltaTime;
			if (source.HasValue)
			{
				_source = source.Value;
			}
			if (visible)
			{
				_locked = locked;
				_retracting = false;
			}
			_squeeze += (Mathf.Clamp01(squeeze) - _squeeze) * (1f - Mathf.Exp((0f - unscaledDeltaTime) / 0.05f));
			if (_retracting)
			{
				_reach = Mathf.MoveTowards(_reach, 0f, unscaledDeltaTime * _retractRate);
				if (_reach <= 0f)
				{
					_retracting = false;
					Flash(1f);
				}
			}
			else if (visible)
			{
				if (_visibility <= 0f)
				{
					_reach = 0f;
				}
				_reach = Mathf.MoveTowards(_reach, (float)Settings.BeamLength.Value / 100f, unscaledDeltaTime / 0.15f);
			}
			bool flag = visible || _retracting;
			_visibility = Mathf.MoveTowards(_visibility, flag ? 1f : 0f, unscaledDeltaTime / (flag ? 0.12f : 0.15f));
			_flash = Mathf.MoveTowards(_flash, 0f, unscaledDeltaTime / 0.3f);
			if (_visibility <= 0f)
			{
				SetEnabled(enabled: false);
			}
			else if (EnsureCreated())
			{
				float num = Vector3.Distance(hand, _source);
				float unscaledTime = Time.unscaledTime;
				float num2 = 1f + 0.6f * _flash;
				float num3 = 1f + 0.05f * num;
				float num4 = (float)Settings.LineThickness.Value / 100f;
				float num5 = (float)Settings.LineOpacity.Value / 100f;
				float num6 = 1f - (float)Settings.LineGripResponse.Value / 100f * (1f - _squeeze);
				float num7 = (float)Settings.LineFlare.Value / 100f;
				float startShare = Mathf.Lerp(0.2f, 1f, Mathf.Clamp01(num7));
				int num8 = ((num7 >= 0.5f) ? 4 : 0);
				if (_reach > 0.002f)
				{
					DrawBeam(hand, aim, num, eye, unscaledTime);
					_glow.widthMultiplier = (_locked ? 0.09f : 0.06f) * num3 * num2 * num4;
					_core.widthMultiplier = (_locked ? 0.022f : 0.014f) * num3 * (1f + 0.3f * _flash) * num4;
					_glow.numCapVertices = num8;
					_core.numCapVertices = num8;
					SetColors(_glow, _glowColors, Palette.Apply(new Color(1f, 0.5f, 0.1f, Mathf.Clamp01((_locked ? 0.55f : 0.3f) * _visibility * num2 * num5) * num6)), startShare);
					SetColors(_core, _coreColors, Palette.Apply(new Color(1f, 0.85f, 0.6f, Mathf.Clamp01((_locked ? 1f : 0.65f) * _visibility * num2 * num5) * num6)), startShare);
					DrawLight(num3, num2, num4, num6, num8, startShare);
					EmitSparks(unscaledDeltaTime, visible ? Sparks.LineSparkRate(_locked, _squeeze) : 0f);
				}
				else
				{
					((Renderer)_glow).enabled = false;
					((Renderer)_core).enabled = false;
					SetLightEnabled(enabled: false);
				}
				if (num7 > 0f)
				{
					float num9 = (_locked ? (1f + 0.12f * Mathf.Sin(unscaledTime * 14f)) : 1f);
					Vector3 val = ((num > 0.01f) ? ((hand - _source) / num) : Vector3.zero);
					DrawFlare(_flare, _source + val * 0.01f, (_locked ? 0.18f : 0.12f) * num3 * num2 * num9 * num7 * (0.8f + 0.2f * num6), Mathf.Clamp01((_locked ? 0.8f : 0.5f) * _visibility * num5) * num6, eye);
				}
				else
				{
					((Renderer)_flare).enabled = false;
				}
			}
		}

		public void Retract(float time)
		{
			if (time <= 0f || _visibility <= 0f || _reach <= 0.002f)
			{
				Hide();
				return;
			}
			_retracting = true;
			_retractRate = _reach / time;
		}

		public void Hide()
		{
			_visibility = 0f;
			_flash = 0f;
			_retracting = false;
			SetEnabled(enabled: false);
		}

		private void DrawBeam(Vector3 hand, Vector3 aim, float distance, Vector3 eye, float time)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0071: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_012f: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((distance > 0.0001f) ? ((_source - hand) / distance) : aim);
			float num = (float)Settings.LineStiffness.Value / 100f * 45f;
			float num2 = Vector3.Angle(val, aim);
			Vector3 val2 = ((num2 > num) ? Vector3.RotateTowards(val, aim, (num2 - num) * ((float)Math.PI / 180f), 0f) : val);
			Vector3 val3 = hand + val2 * (distance * 0.45f);
			Vector3 val4 = Vector3.Cross(_source - hand, (hand + _source) * 0.5f - eye);
			val4 = ((((Vector3)(ref val4)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val4)).normalized : Vector3.up);
			float num3 = (_locked ? 0.0015f : 0.004f) + distance * (_locked ? 0.0003f : 0.0008f);
			for (int i = 0; i < 32; i++)
			{
				float num4 = (float)i / 31f;
				float num5 = 1f - num4 * _reach;
				float num6 = 1f - num5;
				Vector3 val5 = num6 * num6 * hand + 2f * num6 * num5 * val3 + num5 * num5 * _source;
				float num7 = 0.6f * Mathf.Sin((float)Math.PI * 2f * (2.5f * num5 + 1.1f * time)) + 0.4f * Mathf.Sin((float)Math.PI * 2f * (4.3f * num5 - 0.7f * time));
				((Il2CppArrayBase<Vector3>)(object)_points)[i] = val5 + val4 * (num3 * Mathf.Sin((float)Math.PI * num4) * num7);
			}
			_glow.SetPositions(_points);
			_core.SetPositions(_points);
			((Renderer)_glow).enabled = true;
			((Renderer)_core).enabled = true;
			if ((Object)(object)_light != (Object)null && (Object)(object)_hot != (Object)null)
			{
				_light.SetPositions(_points);
				_hot.SetPositions(_points);
			}
		}

		private void DrawLight(float scale, float flash, float thickness, float grip, int caps, float startShare)
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)Settings.LineGlow.Value / 100f;
			if ((Object)(object)_light == (Object)null || (Object)(object)_hot == (Object)null || num <= 0f)
			{
				SetLightEnabled(enabled: false);
				return;
			}
			_light.widthMultiplier = (_locked ? 0.035f : 0.025f) * scale * flash * thickness;
			_hot.widthMultiplier = (_locked ? 0.012f : 0.008f) * scale * (1f + 0.3f * _flash) * thickness;
			_light.numCapVertices = caps;
			_hot.numCapVertices = caps;
			SetColors(_light, _lightColors, Palette.Apply(new Color(1f, 0.5f, 0.1f, Mathf.Clamp01((_locked ? 0.35f : 0.2f) * _visibility * flash * num) * grip)), startShare);
			SetColors(_hot, _hotColors, Palette.Apply(new Color(1f, 0.75f, 0.45f, Mathf.Clamp01((_locked ? 0.5f : 0.3f) * _visibility * flash * num) * grip)), startShare);
			SetLightEnabled(enabled: true);
		}

		private void SetLightEnabled(bool enabled)
		{
			if ((Object)(object)_light != (Object)null)
			{
				((Renderer)_light).enabled = enabled;
			}
			if ((Object)(object)_hot != (Object)null)
			{
				((Renderer)_hot).enabled = enabled;
			}
		}

		private static void DrawFlare(LineRenderer flare, Vector3 center, float size, float alpha, Vector3 eye)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.Cross(Vector3.up, center - eye);
			val = ((((Vector3)(ref val)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val)).normalized : Vector3.right);
			flare.SetPosition(0, center - val * (size * 0.5f));
			flare.SetPosition(1, center + val * (size * 0.5f));
			flare.widthMultiplier = size;
			Color endColor = (flare.startColor = Palette.Apply(new Color(1f, 0.6f, 0.2f, Mathf.Clamp01(alpha))));
			flare.endColor = endColor;
			((Renderer)flare).enabled = true;
		}

		private void EmitSparks(float dt, float rate)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (rate <= 0f)
			{
				_sparkDebt = 0f;
				return;
			}
			_sparkDebt += dt * rate;
			if (!(_sparkDebt < 1f))
			{
				Color color = Palette.Apply(new Color(1f, 0.85f, 0.6f, 0.9f));
				while (_sparkDebt >= 1f)
				{
					_sparkDebt -= 1f;
					float num = Sparks.RandomValue() * 0.8f * 31f;
					int num2 = Mathf.Min((int)num, 30);
					Vector3 val = ((Il2CppArrayBase<Vector3>)(object)_points)[num2];
					Vector3 val2 = ((Il2CppArrayBase<Vector3>)(object)_points)[num2 + 1];
					Vector3 val3 = val2 - val;
					Vector3 towardHand = ((((Vector3)(ref val3)).sqrMagnitude > 1E-10f) ? ((Vector3)(ref val3)).normalized : Vector3.zero);
					Sparks.EmitAlongLine(Vector3.Lerp(val, val2, num - (float)num2), towardHand, color);
				}
			}
		}

		private static void SetColors(LineRenderer line, LineColors colors, Color color, float startShare)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01(color.a);
			color.a = 1f;
			((Il2CppArrayBase<GradientColorKey>)(object)colors.ColorKeys)[0] = new GradientColorKey(color, 0f);
			((Il2CppArrayBase<GradientColorKey>)(object)colors.ColorKeys)[1] = new GradientColorKey(color, 1f);
			((Il2CppArrayBase<GradientAlphaKey>)(object)colors.AlphaKeys)[0] = new GradientAlphaKey(num * startShare, 0f);
			((Il2CppArrayBase<GradientAlphaKey>)(object)colors.AlphaKeys)[1] = new GradientAlphaKey(num * 0.85f, 0.15f);
			((Il2CppArrayBase<GradientAlphaKey>)(object)colors.AlphaKeys)[2] = new GradientAlphaKey(0f, 1f);
			colors.Gradient.SetKeys(colors.ColorKeys, colors.AlphaKeys);
			line.colorGradient = colors.Gradient;
		}

		private void SetEnabled(bool enabled)
		{
			if ((Object)(object)_glow != (Object)null)
			{
				((Renderer)_glow).enabled = enabled;
			}
			if ((Object)(object)_core != (Object)null)
			{
				((Renderer)_core).enabled = enabled;
			}
			if ((Object)(object)_flare != (Object)null)
			{
				((Renderer)_flare).enabled = enabled;
			}
			if (!enabled)
			{
				SetLightEnabled(enabled: false);
			}
		}

		private bool EnsureCreated()
		{
			if (_unavailable)
			{
				return false;
			}
			if ((Object)(object)_beamMaterial == (Object)null)
			{
				_beamMaterial = LineFactory.CreateMaterial((Texture)(object)GlowTextures.Beam);
				if ((Object)(object)_beamMaterial == (Object)null)
				{
					_unavailable = true;
					return false;
				}
			}
			if ((Object)(object)_flareMaterial == (Object)null)
			{
				_flareMaterial = LineFactory.CreateMaterial((Texture)(object)GlowTextures.Dot);
			}
			if ((Object)(object)_glow == (Object)null)
			{
				_glow = CreateBeam("Gravity Gloves Beam Glow", 0);
			}
			if ((Object)(object)_core == (Object)null)
			{
				_core = CreateBeam("Gravity Gloves Beam Core", 1);
			}
			if ((Object)(object)_flare == (Object)null)
			{
				_flare = CreateFlare("Gravity Gloves Beam Flare");
			}
			if ((Object)(object)_lightMaterial == (Object)null && !_lightUnavailable)
			{
				_lightMaterial = GlowMaterials.CreateAdditive();
				_lightUnavailable = (Object)(object)_lightMaterial == (Object)null;
			}
			if ((Object)(object)_lightMaterial != (Object)null)
			{
				if (_light == null)
				{
					_light = CreateLight("Gravity Gloves Beam Light", 3);
				}
				if (_hot == null)
				{
					_hot = CreateLight("Gravity Gloves Beam Light Core", 4);
				}
			}
			if ((Object)(object)_glow != (Object)null && (Object)(object)_core != (Object)null)
			{
				return (Object)(object)_flare != (Object)null;
			}
			return false;
		}

		private static LineRenderer CreateLight(string name, int sortingOrder)
		{
			LineRenderer val = LineFactory.Create(name, 32, _lightMaterial);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			val.widthCurve = BeamWidth();
			((Renderer)val).sortingOrder = sortingOrder;
			return val;
		}

		private LineRenderer CreateBeam(string name, int sortingOrder)
		{
			LineRenderer val = LineFactory.Create(name, 32, _beamMaterial);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			val.textureMode = (LineTextureMode)1;
			val.widthCurve = BeamWidth();
			((Renderer)val).sortingOrder = sortingOrder;
			return val;
		}

		private static LineRenderer CreateFlare(string name)
		{
			LineRenderer val = LineFactory.Create(name, 2, _flareMaterial);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			val.numCapVertices = 0;
			((Renderer)val).sortingOrder = 2;
			return val;
		}

		private static AnimationCurve BeamWidth()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (_beamWidth != null)
			{
				return _beamWidth;
			}
			_beamWidth = new AnimationCurve();
			_beamWidth.AddKey(0f, 1f);
			_beamWidth.AddKey(0.35f, 0.65f);
			_beamWidth.AddKey(1f, 0.06f);
			return _beamWidth;
		}
	}
	internal static class AmmoBatch
	{
		private sealed class Batch
		{
			public readonly List<Target> Members = new List<Target>();

			public float Expires;
		}

		private const int MaxBatchSize = 8;

		private const float CollectWindow = 3f;

		private const int GatherMask = 33792;

		private static readonly Il2CppReferenceArray<Collider> Overlaps = new Il2CppReferenceArray<Collider>(64L);

		private static readonly HashSet<IntPtr> Seen = new HashSet<IntPtr>();

		private static readonly List<Batch> Pending = new List<Batch>();

		public static void Find(Target primary, List<Target> batch)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			batch.Clear();
			if (primary == null || !Settings.BatchAmmo.Value || (Object)(object)primary.AmmoPickup == (Object)null)
			{
				return;
			}
			HeldObjects heldObjects = HeldObjects.Read();
			int num = Physics.OverlapSphereNonAlloc(primary.CenterOfMass, Settings.BatchRadius.Value, Overlaps, 33792, (QueryTriggerInteraction)1);
			Seen.Clear();
			Seen.Add(primary.Key);
			for (int i = 0; i < num; i++)
			{
				if (batch.Count >= 7)
				{
					break;
				}
				Collider val = ((Il2CppArrayBase<Collider>)(object)Overlaps)[i];
				Rigidbody val2 = (((Object)(object)val != (Object)null) ? val.attachedRigidbody : null);
				if ((Object)(object)val2 == (Object)null || val2.isKinematic)
				{
					continue;
				}
				Target target = TargetCache.Get(val2);
				if (Seen.Add(target.Key))
				{
					AmmoPickup ammoPickup = target.AmmoPickup;
					if (!((Object)(object)ammoPickup == (Object)null) && !ammoPickup._isCollected && !heldObjects.Contains(target) && Flights.CanPull(target) && !(target.Mass > Settings.MaxMass.Value))
					{
						batch.Add(target);
					}
				}
			}
		}

		public static void Track(List<Target> members, float longestFlight)
		{
			Batch batch = new Batch
			{
				Expires = Time.time + longestFlight + 3f
			};
			batch.Members.AddRange(members);
			Pending.Add(batch);
		}

		public static void FixedUpdate()
		{
			if (Pending.Count == 0)
			{
				return;
			}
			HeldObjects held = HeldObjects.Read();
			for (int num = Pending.Count - 1; num >= 0; num--)
			{
				Batch batch = Pending[num];
				if (IsAnyPickedUp(batch, held))
				{
					Pending.RemoveAt(num);
					if (CollectAll(batch) <= 0)
					{
					}
				}
				else if (Time.time > batch.Expires)
				{
					Pending.RemoveAt(num);
				}
			}
		}

		public static void Clear()
		{
			Pending.Clear();
		}

		private static bool IsAnyPickedUp(Batch batch, HeldObjects held)
		{
			foreach (Target member in batch.Members)
			{
				if (member.IsAlive)
				{
					AmmoPickup ammoPickup = member.AmmoPickup;
					if ((Object)(object)ammoPickup != (Object)null && (ammoPickup._isCollected || held.Contains(member)))
					{
						return true;
					}
				}
			}
			return false;
		}

		private static int CollectAll(Batch batch)
		{
			int num = 0;
			foreach (Target member in batch.Members)
			{
				if (!member.IsAlive)
				{
					continue;
				}
				AmmoPickup ammoPickup = member.AmmoPickup;
				if (!((Object)(object)ammoPickup == (Object)null) && !ammoPickup._isCollected)
				{
					try
					{
						ammoPickup.ForcePickup();
						num++;
					}
					catch (Exception ex)
					{
						Mod.Log.Error("Couldn't collect " + member.Name + " with its batch: " + ex.Message);
					}
				}
			}
			return num;
		}
	}
	internal static class Ballistics
	{
		public static Vector3 LaunchVelocity(Vector3 start, Vector3 target, Vector3 gravity, float time)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			return (target - start - 0.5f * time * time * gravity) / time;
		}
	}
	internal static class BodyScale
	{
		private const float ReferenceHeight = 1.76f;

		private const float CheckInterval = 1f;

		private static float _scale = 1f;

		private static float _loggedHeight;

		private static float _nextCheck;

		public static float Value
		{
			get
			{
				Refresh();
				if (!Settings.ScaleWithAvatar.Value)
				{
					return 1f;
				}
				return _scale;
			}
		}

		public static float Avatar
		{
			get
			{
				Refresh();
				return _scale;
			}
		}

		private static void Refresh()
		{
			float unscaledTime = Time.unscaledTime;
			if (!(unscaledTime < _nextCheck))
			{
				_nextCheck = unscaledTime + 1f;
				Read();
			}
		}

		private static void Read()
		{
			float height;
			try
			{
				Avatar avatar = Player.Avatar;
				if ((Object)(object)avatar == (Object)null)
				{
					return;
				}
				height = avatar.height;
			}
			catch (Exception)
			{
				return;
			}
			if (!float.IsNaN(height) && !(height < 0.1f))
			{
				_scale = Mathf.Clamp(height / 1.76f, 0.1f, 20f);
				if (Mathf.Abs(height - _loggedHeight) > 0.01f)
				{
					_loggedHeight = height;
				}
			}
		}
	}
	[HarmonyPatch(typeof(AssetWarehouse), "UnloadCrateAsset", new Type[]
	{
		typeof(Crate),
		typeof(bool)
	})]
	internal static class KeepPocketCratePatch
	{
		private static bool Prefix(Crate crate, ref bool __result)
		{
			string barcode;
			try
			{
				Barcode val = (((Object)(object)crate != (Object)null) ? ((Scannable)crate).Barcode : null);
				barcode = ((val != (Barcode)null) ? val.ID : null);
			}
			catch (Exception)
			{
				return true;
			}
			if (!WristPockets.KeepsCrate(barcode))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(AssetWarehouse), "UnloadCrateAsset", new Type[]
	{
		typeof(Barcode),
		typeof(bool)
	})]
	internal static class KeepPocketCrateByBarcodePatch
	{
		private static bool Prefix(Barcode barcode, ref bool __result)
		{
			string barcode2;
			try
			{
				barcode2 = ((barcode != (Barcode)null) ? barcode.ID : null);
			}
			catch (Exception)
			{
				return true;
			}
			if (!WristPockets.KeepsCrate(barcode2))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(MarrowEntity), "OnCullResolve")]
	internal static class CullResolvePatch
	{
		private static void Prefix(MarrowEntity __instance)
		{
			CullCheck.Clean(__instance);
		}
	}
	internal static class CullCheck
	{
		private const int MaxNamed = 20;

		private static readonly HashSet<IntPtr> Named = new HashSet<IntPtr>();

		private static int _objects;

		private static int _entries;

		private static int _pocketObjects;

		private static bool _loggedError;

		public static void Clean(MarrowEntity entity)
		{
			try
			{
				if ((Object)(object)entity == (Object)null)
				{
					return;
				}
				List<string> list = new List<string>();
				Il2CppReferenceArray<MarrowBehaviour> behaviours = entity._behaviours;
				if (behaviours != null)
				{
					List<MarrowBehaviour> list2 = null;
					for (int i = 0; i < ((Il2CppArrayBase<MarrowBehaviour>)(object)behaviours).Length; i++)
					{
						MarrowBehaviour val = ((Il2CppArrayBase<MarrowBehaviour>)(object)behaviours)[i];
						if ((Object)(object)val != (Object)null)
						{
							list2?.Add(val);
							continue;
						}
						if (list2 == null)
						{
							list2 = new List<MarrowBehaviour>();
							for (int j = 0; j < i; j++)
							{
								list2.Add(((Il2CppArrayBase<MarrowBehaviour>)(object)behaviours)[j]);
							}
						}
						list.Add(TypeOf((Il2CppObjectBase)(object)val));
					}
					if (list2 != null)
					{
						entity._behaviours = new Il2CppReferenceArray<MarrowBehaviour>(list2.ToArray());
					}
				}
				List<IMarrowEntityCullable> cullables = entity._cullables;
				if (cullables != null)
				{
					for (int num = cullables.Count - 1; num >= 0; num--)
					{
						Il2CppObjectBase entry = (Il2CppObjectBase)(object)cullables[num];
						if (IsDead(entry))
						{
							list.Add(TypeOf(entry));
							cullables.RemoveAt(num);
						}
					}
				}
				if (list.Count > 0)
				{
					Report(entity, list);
				}
			}
			catch (Exception ex)
			{
				if (!_loggedError)
				{
					_loggedError = true;
					Mod.Log.Warning("Couldn't check an object before the game culled it: " + ex.Message);
				}
			}
		}

		public static void Clear()
		{
			_ = _objects;
			_ = 0;
			Named.Clear();
			_objects = 0;
			_entries = 0;
			_pocketObjects = 0;
		}

		private static void Report(MarrowEntity entity, List<string> dead)
		{
			string text = WristPockets.HistoryOf(entity);
			if (Named.Add(((Il2CppObjectBase)entity).Pointer))
			{
				_objects++;
				if (text != null)
				{
					_pocketObjects++;
				}
			}
			_entries += dead.Count;
			if (Named.Count > 20)
			{
				return;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (string item in dead)
			{
				dictionary[item] = ((!dictionary.TryGetValue(item, out var value)) ? 1 : (value + 1));
			}
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, int> item2 in dictionary)
			{
				list.Add((item2.Value > 1) ? $"{item2.Value} {item2.Key}" : item2.Key);
			}
		}

		private static bool IsDead(Il2CppObjectBase entry)
		{
			if (entry == null)
			{
				return true;
			}
			Object val = entry.TryCast<Object>();
			if (val != null)
			{
				return val == (Object)null;
			}
			return false;
		}

		private static string TypeOf(Il2CppObjectBase entry)
		{
			if (entry == null)
			{
				return "empty slot";
			}
			try
			{
				Object val = entry.TryCast<Object>();
				return (val == null) ? "unknown" : ((MemberInfo)val.GetIl2CppType()).Name;
			}
			catch (Exception)
			{
				return "unknown";
			}
		}
	}
	internal static class DebugView
	{
		private const int RimSegments = 24;

		private const int ConePoints = 34;

		private const float Width = 0.015f;

		private static readonly LineRenderer[] Cones = (LineRenderer[])(object)new LineRenderer[2];

		private static Il2CppStructArray<Vector3> _conePoints;

		public static LineRenderer CreateLine(string name, int points, Color color)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer val = LineFactory.Create(name, points);
			if ((Object)(object)val != (Object)null)
			{
				val.startWidth = 0.015f;
				val.endWidth = 0.015f;
				val.startColor = color;
				val.endColor = color;
			}
			return val;
		}

		public static void ShowCone(int index, Vector3 apex, Vector3 axis, float angle, float range)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Cones[index] == (Object)null)
			{
				Cones[index] = CreateLine("Gravity Gloves Cone", 34, new Color(0.2f, 0.8f, 1f));
			}
			LineRenderer val = Cones[index];
			Vector3 side;
			Vector3 up;
			Vector3 center;
			float radius;
			if (!((Object)(object)val == (Object)null))
			{
				if (_conePoints == null)
				{
					_conePoints = new Il2CppStructArray<Vector3>(34L);
				}
				side = Vector3.Cross(axis, Vector3.up);
				if (((Vector3)(ref side)).sqrMagnitude < 0.0001f)
				{
					side = Vector3.Cross(axis, Vector3.right);
				}
				((Vector3)(ref side)).Normalize();
				up = Vector3.Cross(side, axis);
				center = apex + axis * range;
				radius = range * Mathf.Tan(angle * ((float)Math.PI / 180f));
				int num = 0;
				((Il2CppArrayBase<Vector3>)(object)_conePoints)[num++] = apex;
				for (int i = 0; i <= 24; i++)
				{
					((Il2CppArrayBase<Vector3>)(object)_conePoints)[num++] = Rim(i);
				}
				for (int j = 0; j < 4; j++)
				{
					((Il2CppArrayBase<Vector3>)(object)_conePoints)[num++] = apex;
					((Il2CppArrayBase<Vector3>)(object)_conePoints)[num++] = ((j < 3) ? Rim((j + 1) * 24 / 4) : center);
				}
				val.SetPositions(_conePoints);
				((Renderer)val).enabled = true;
			}
			Vector3 Rim(int num3)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				float num2 = (float)Math.PI * 2f * (float)num3 / 24f;
				return center + (side * Mathf.Cos(num2) + up * Mathf.Sin(num2)) * radius;
			}
		}

		public static void HideCone(int index)
		{
			LineRenderer val = Cones[index];
			if ((Object)(object)val != (Object)null)
			{
				((Renderer)val).enabled = false;
			}
		}
	}
	internal enum FeedbackKind
	{
		Select,
		Lock,
		Launch
	}
	internal static class Feedback
	{
		private const float MinPulse = 0.01f;

		private const float BuzzInterval = 0.05f;

		private const float CatchSpacing = 0.15f;

		private static readonly float[] NextBuzz = new float[2];

		private static readonly float[] NextCatch = new float[2];

		private static bool _loggedHaptics;

		private static float HapticStrength => (float)Settings.HapticStrength.Value / 100f;

		public static void Play(FeedbackKind kind, BaseController controller, Vector3 position)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			PlayHaptic(kind, controller);
			Sounds.Play(kind, position);
		}

		public static void Tick(BaseController controller)
		{
			Haptor val = (((Object)(object)controller != (Object)null) ? controller.haptor : null);
			if ((Object)(object)val != (Object)null && HapticStrength > 0f)
			{
				Send(val, val.hap_tap_duration * 0.5f, val.hap_tap_frequency, val.hap_subtle_amplitude * HapticStrength);
			}
		}

		public static void ReachTick(BaseController controller)
		{
			Haptor val = (((Object)(object)controller != (Object)null) ? controller.haptor : null);
			float num = HapticStrength * (float)Settings.ReachTick.Value / 100f;
			if ((Object)(object)val != (Object)null && num > 0f)
			{
				Send(val, (float)Settings.ReachTickLength.Value / 1000f, val.hap_tap_frequency, val.hap_tap_amplitude * num);
			}
		}

		public static void PocketHum(int hand, BaseController controller)
		{
			float num = HapticStrength * (float)Settings.PocketHum.Value / 100f;
			float unscaledTime = Time.unscaledTime;
			if (!(num <= 0f) && !((Object)(object)controller == (Object)null) && !(unscaledTime < NextBuzz[hand]))
			{
				Haptor haptor = controller.haptor;
				if (!((Object)(object)haptor == (Object)null))
				{
					NextBuzz[hand] = unscaledTime + 0.05f;
					Send(haptor, 0.080000006f, 60f, 0.035f * num);
				}
			}
		}

		public static void Buzz(int hand, BaseController controller, float squeeze)
		{
			float num = HapticStrength * (float)Settings.LockVibration.Value / 100f;
			float unscaledTime = Time.unscaledTime;
			if (!(num <= 0f) && !((Object)(object)controller == (Object)null) && !(unscaledTime < NextBuzz[hand]))
			{
				Haptor haptor = controller.haptor;
				if (!((Object)(object)haptor == (Object)null))
				{
					NextBuzz[hand] = unscaledTime + 0.05f;
					Send(haptor, 0.080000006f, 80f + 60f * squeeze, (0.02f + 0.1f * squeeze) * num);
				}
			}
		}

		public static void Catch(Hand hand, Target target)
		{
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)Settings.CatchThump.Value / 100f;
			if ((Object)(object)hand == (Object)null || num <= 0f)
			{
				return;
			}
			int num2 = IndexOf(hand);
			float unscaledTime = Time.unscaledTime;
			if (!(unscaledTime < NextCatch[num2]))
			{
				NextCatch[num2] = unscaledTime + 0.15f;
				float num3 = Heaviness.Of(target.Mass);
				BaseController controller = hand.Controller;
				Haptor val = (((Object)(object)controller != (Object)null) ? controller.haptor : null);
				float num4 = HapticStrength * num;
				if ((Object)(object)val != (Object)null && num4 > 0f)
				{
					Send(val, 0.07f + 0.1f * num3, val.hap_knock_frequency / (1f + 0.4f * num3), (0.45f + 0.4f * num3) * num4);
				}
				Sounds.PlayCatch(GloveHand.PalmPosition(hand), num, num3);
			}
		}

		private static void PlayHaptic(FeedbackKind kind, BaseController controller)
		{
			float hapticStrength = HapticStrength;
			Haptor haptor = controller.haptor;
			if (!(hapticStrength <= 0f) && !((Object)(object)haptor == (Object)null))
			{
				LogPresetsOnce(haptor);
				switch (kind)
				{
				case FeedbackKind.Select:
					Send(haptor, haptor.hap_tap_duration * 0.5f, haptor.hap_tap_frequency, haptor.hap_subtle_amplitude * hapticStrength);
					break;
				case FeedbackKind.Lock:
					Send(haptor, haptor.hap_tap_duration, haptor.hap_tap_frequency, haptor.hap_tap_amplitude * hapticStrength);
					break;
				default:
					Send(haptor, haptor.hap_knock_duration, haptor.hap_knock_frequency, haptor.hap_knock_amplitude * hapticStrength);
					break;
				}
			}
		}

		private static int IndexOf(Hand hand)
		{
			Hand rightHand = Player.RightHand;
			if (!((Object)(object)rightHand != (Object)null) || !(((Il2CppObjectBase)rightHand).Pointer == ((Il2CppObjectBase)hand).Pointer))
			{
				return 0;
			}
			return 1;
		}

		private static void Send(Haptor haptor, float duration, float frequency, float amplitude)
		{
			haptor.SENDHAPTIC(0f, Mathf.Max(duration, 0.01f), frequency, Mathf.Clamp01(amplitude));
		}

		private static void LogPresetsOnce(Haptor haptor)
		{
			if (!_loggedHaptics)
			{
				_loggedHaptics = true;
			}
		}
	}
	internal readonly struct LaunchResult
	{
		public float Distance { get; }

		public float FlightTime { get; }

		public float Speed { get; }

		public string Rotation { get; }

		public string Notes { get; }

		public LaunchResult(float distance, float flightTime, float speed, string rotation, string notes)
		{
			Distance = distance;
			FlightTime = flightTime;
			Speed = speed;
			Rotation = rotation;
			Notes = notes;
		}
	}
	internal static class Flights
	{
		private enum FloatPhase
		{
			None,
			Braking,
			Floating,
			Done
		}

		private sealed class Flight
		{
			public Target Target;

			public GloveHand Glove;

			public float StartTime;

			public float Duration;

			public Vector3 ArrivalOffset;

			public Vector3 Start;

			public Vector3 LaunchVelocity;

			public Vector3 PathGravity;

			public Vector3 Destination;

			public Vector3 Gravity;

			public Vector3 ExtraGravity;

			public bool Guided;

			public Vector3 Origin;

			public bool Released;

			public float PathTime;

			public Vector3 TrackedEnd;

			public HoldPose Hold;

			public float Follow;

			public bool Following;

			public Quaternion HandReference;

			public Quaternion ObjectReference;

			public LineRenderer PathLine;

			public Vector3 LastCenter;

			public bool Caught;

			public bool ReachTicked;

			public float LetGoAt = -1f;

			public Vector3 LaunchPalm;

			public string EndReason;

			public bool EndLogged;

			public string ArrivalNote;

			public FloatPhase Float;

			public Vector3 FloatPoint;

			public Vector3 FloatBase;

			public Vector3 FloatAnchor;

			public Vector3 FloatOffset;

			public Vector3 FloatCarry;

			public bool Settles;

			public float FloatBrake;

			public float PhaseStart;

			public float BrakeUntil;

			public float BrakeSpeed;

			public float ArriveSpeed;

			public float ArriveDistance;

			public float FloatEnd;

			public Vector3 PathPoint(float time)
			{
				//IL_0001: 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)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				return Start + LaunchVelocity * time + 0.5f * time * time * PathGravity;
			}
		}

		private sealed class FitCheck
		{
			public Hand Hand;

			public Target Target;

			public HoldPose Hold;

			public float Time;
		}

		private const float GracePeriod = 0.75f;

		private const float MaxPathError = 0.5f;

		private const float FarSmoothing = 0.3f;

		private const float NearSmoothing = 0.03f;

		private const float FollowDelay = 0.12f;

		private const float FollowResponse = 0.1f;

		private const float MinTurnTime = 0.1f;

		private const float MaxTurnSpeed = 15f;

		private const float FitCheckDelay = 0.4f;

		private const int PathPoints = 24;

		private const float CollectReach = 0.35f;

		private const float MinFloatProgress = 0.5f;

		private const float FloatFade = 0.2f;

		private const float SettleMargin = 1.25f;

		private const float SettleRate = 10f;

		private const float FloatFollowSmoothing = 0.1f;

		private const float FloatDamping = 0.1f;

		private const float FloatSpinSettle = 0.25f;

		private const float StoppedSpeed = 0.1f;

		private const float PassedSpeed = 0.5f;

		private const float MaxBrakeTime = 1f;

		private const float BrakeTimeMargin = 1.2f;

		private const float BrakeTimeSlack = 0.05f;

		private const float MaxCatchUpSpeed = 4f;

		private const float HoverSphereOut = 0.8f;

		private const float MaxReachTickSize = 1.5f;

		private static bool _loggedHoverSphere;

		private const float MinFloatZone = 0.25f;

		private const int WorldMask = 65;

		private static readonly float[] ArcTries = new float[6] { 1f, 0.6f, 0.3f, 0f, 1.6f, 2.4f };

		private const float CheckStep = 0.3f;

		private const float HandClearance = 0.3f;

		private static readonly List<Flight> Active = new List<Flight>();

		private static readonly Dictionary<Target, float> Resting = new Dictionary<Target, float>();

		private static readonly List<Target> Rested = new List<Target>();

		private static readonly List<FitCheck> FitChecks = new List<FitCheck>();

		private static Il2CppStructArray<Vector3> _pathBuffer;

		private static readonly Il2CppStructArray<RaycastHit> Hits = new Il2CppStructArray<RaycastHit>(16L);

		private static float SlowdownAmount => (float)Settings.SlowdownAmount.Value / 100f;

		private static float SlowdownStart => (float)Settings.SlowdownStart.Value / 100f;

		private static float Tracking => (float)Settings.HandTracking.Value / 100f;

		private static float FloatTime => Settings.FloatTime.Value;

		private static float FloatBrakeTime => Settings.FloatBrakeTime.Value;

		private static float MaxFloatBrake => Settings.FloatStopSpeed.Value / FloatBrakeTime;

		private static float FloatZone => Settings.FloatStopSpeed.Value * FloatBrakeTime / 2f;

		public static LaunchResult Launch(Target target, GloveHand glove, Hand hand, Vector3 palm, Vector3 arrivalOffset = default(Vector3), float extraTime = 0f, bool main = true)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0093: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: 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_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			string problem;
			HoldPose holdPose = HoldPose.TryCreate(target, hand, out problem);
			string text = ((holdPose != null) ? "fitted to hand" : ("couldn't fit to hand: " + problem));
			if (holdPose == null && Settings.FollowHand.Value > 0)
			{
				text += $", follows hand {Settings.FollowHand.Value}%";
			}
			Vector3 centerOfMass = target.CenterOfMass;
			Vector3 val = holdPose?.HeldCenter(((Component)hand).transform) ?? (palm + arrivalOffset);
			float num = Vector3.Distance(centerOfMass, val);
			float num2 = Heaviness.Of(target.Mass);
			float num3 = Heaviness.TimeScale(num2);
			float num4 = (Settings.FlightTime.Value + (float)Settings.ExtraTimePerMetre.Value / 1000f * num / BodyScale.Value) * num3 + extraTime;
			bool flag = Tracking > 0f || SlowdownAmount > 0f;
			Vector3 playerVelocity = glove.PlayerVelocity;
			Vector3 val2 = (flag ? val : (val + playerVelocity * (num4 * (float)Settings.HandPrediction.Value / 100f)));
			Vector3 val3 = (target.UsesGravity ? Physics.gravity : Vector3.zero);
			float num5 = Settings.ArcHeight.Value * Heaviness.ArcScale(num2) / (num3 * num3);
			string note = null;
			if (Settings.AvoidObstacles.Value)
			{
				num5 = ClearArc(target, centerOfMass, val2, val3, num5, num4, out note);
			}
			Vector3 val4 = val3 * num5;
			Vector3 val5 = Ballistics.LaunchVelocity(centerOfMass, val2, val4, num4);
			target.SetVelocity(flag ? (val5 + playerVelocity) : val5, dampSpin: false);
			target.SetFastCollision(fast: true);
			RemoveFlightOf(target);
			Resting.Remove(target);
			Active.Add(new Flight
			{
				Target = target,
				Glove = glove,
				StartTime = Time.time,
				Duration = num4,
				ArrivalOffset = ((holdPose != null) ? Vector3.zero : arrivalOffset),
				Start = centerOfMass,
				LaunchVelocity = val5,
				PathGravity = val4,
				Destination = val2,
				Gravity = val3,
				ExtraGravity = val4 - val3,
				Guided = flag,
				Origin = PlayerOrigin(),
				TrackedEnd = val2,
				Hold = holdPose,
				Follow = ((holdPose == null) ? ((float)Settings.FollowHand.Value / 100f) : 0f),
				LastCenter = centerOfMass,
				LaunchPalm = palm
			});
			if (main)
			{
				FlightSounds.Start(target);
			}
			string text2 = "";
			if (num2 > 0.005f)
			{
				text2 += $", weight {target.Mass:0} kg: {num3:0.00}x the time, arc {Heaviness.ArcScale(num2):0%} as high";
			}
			if (note != null)
			{
				text2 = text2 + ", " + note;
			}
			return new LaunchResult(num, num4, ((Vector3)(ref val5)).magnitude, text, text2);
		}

		public static bool IsFlying(Target target)
		{
			return FindFlightOf(target) != null;
		}

		public static bool CanPull(Target target)
		{
			Flight flight = FindFlightOf(target);
			if (flight != null)
			{
				if (flight.LetGoAt >= 0f && !InFloat(flight))
				{
					return Time.time >= flight.LetGoAt + Settings.PullAgainAfter.Value;
				}
				return false;
			}
			if (!Resting.TryGetValue(target, out var value))
			{
				return true;
			}
			if (Time.time < value)
			{
				return false;
			}
			Resting.Remove(target);
			return true;
		}

		public static bool HasFlightFrom(GloveHand glove)
		{
			foreach (Flight item in Active)
			{
				if (item.Glove == glove)
				{
					return true;
				}
			}
			return false;
		}

		public static float AirborneGlowFrom(GloveHand glove, List<Target> targets)
		{
			targets.Clear();
			float num = (float)Settings.GlowInFlight.Value / 100f;
			float num2 = 0f;
			if (num <= 0f)
			{
				return num2;
			}
			for (int num3 = Active.Count - 1; num3 >= 0; num3--)
			{
				Flight flight = Active[num3];
				if (flight.Glove == glove && flight.Target.IsAlive)
				{
					float num4 = 1f - Smooth(Progress(flight) / num);
					if (!(num4 <= 0f))
					{
						targets.Add(flight.Target);
						num2 = Mathf.Max(num2, num4);
					}
				}
			}
			return num2;
		}

		public static bool TryAssistGrab(Hand hand, float reach, out string caught)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			caught = null;
			Vector3 val = GloveHand.PalmPosition(hand);
			Flight flight = null;
			float num = reach;
			foreach (Flight item in Active)
			{
				if (item.Target.IsAlive && item.Target.IsActive)
				{
					float num2 = Vector3.Distance(item.Target.SurfacePointToward(val), val);
					if (num2 <= num)
					{
						flight = item;
						num = num2;
					}
				}
			}
			if (flight == null || !GrabAssist.Start(flight.Target, hand, UsesMainGrip(flight), out var description))
			{
				return false;
			}
			caught = $"{flight.Target.Name} from {num * 100f:0} cm away {description}";
			LogCatchInFloat(flight, "was caught by grab assist");
			QueueFitCheck(flight, hand);
			FlightSounds.Stop(flight.Target, caught: true);
			RemoveFlightOf(flight.Target);
			return true;
		}

		public static void Clear()
		{
			foreach (Flight item in Active)
			{
				LineFactory.Destroy(item.PathLine);
				item.Target.SetFastCollision(fast: false);
			}
			Active.Clear();
			FitChecks.Clear();
			Resting.Clear();
		}

		public static void FixedUpdate()
		{
			if (FitChecks.Count > 0)
			{
				RunFitChecks();
			}
			if (Active.Count == 0)
			{
				return;
			}
			HeldObjects held = HeldObjects.Read();
			for (int num = Active.Count - 1; num >= 0; num--)
			{
				Flight flight = Active[num];
				if (!Step(flight, held))
				{
					Rest(flight);
					LogArrivalNote(flight);
					FlightSounds.Stop(flight.Target, flight.Caught);
					LineFactory.Destroy(flight.PathLine);
					flight.Target.SetFastCollision(fast: false);
					Active.RemoveAt(num);
				}
			}
		}

		private static void Rest(Flight flight)
		{
			float time = Time.time;
			Rested.Clear();
			foreach (KeyValuePair<Target, float> item in Resting)
			{
				if (time >= item.Value)
				{
					Rested.Add(item.Key);
				}
			}
			foreach (Target item2 in Rested)
			{
				Resting.Remove(item2);
			}
			if (!flight.Caught && flight.Target.IsAlive)
			{
				float num = ((flight.LetGoAt >= 0f) ? flight.LetGoAt : time) + Settings.PullAgainAfter.Value;
				if (num > time)
				{
					Resting[flight.Target] = num;
				}
			}
		}

		private static bool UsesMainGrip(Flight flight)
		{
			if (flight.Hold == null)
			{
				return flight.Target.IsWeapon;
			}
			return true;
		}

		private static bool Step(Flight flight, HeldObjects held)
		{
			//IL_0110: 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_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_0115: 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_011d: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: 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_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: 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_0245: Unknown result type (might be due to invalid IL or missing references)
			Target target = flight.Target;
			Hand hand = flight.Glove.Hand;
			if (!target.IsAlive || !target.IsActive)
			{
				CheckCollected(flight);
				if (flight.Caught)
				{
					LogCatchInFloat(flight, "was collected");
				}
				return false;
			}
			if (target.IsKinematic || (Object)(object)hand == (Object)null)
			{
				return false;
			}
			if (held.Contains(target))
			{
				flight.Caught = true;
				LogCatchInFloat(flight, "was caught");
				Feedback.Catch(held.HandHolding(target), target);
				QueueFitCheck(flight, hand);
				return false;
			}
			float num = Time.time - flight.StartTime;
			float num2 = (flight.Guided ? (flight.Duration / Mathf.Max(1f - SlowdownAmount, 0.1f)) : flight.Duration);
			if (!InFloat(flight) && num > num2 + 0.75f && Time.time > flight.FloatEnd + 0.75f)
			{
				return false;
			}
			Transform transform = ((Component)hand).transform;
			Vector3 val = ((flight.Hold != null) ? flight.Hold.HeldCenter(transform) : (GloveHand.PalmPosition(hand) + flight.ArrivalOffset));
			Vector3 val2 = (flight.LastCenter = target.CenterOfMass);
			float distance = Vector3.Distance(val, val2);
			if (!flight.ReachTicked)
			{
				CheckInReach(flight, hand, val2);
			}
			if (InFloat(flight) || TryStartFloat(flight, val2, val))
			{
				DrawPath(flight, -1f);
				StepFloat(flight, transform, num, val2, val);
				return true;
			}
			bool flag = !flight.Released && (flight.Guided ? (flight.PathTime < flight.Duration) : (num < flight.Duration));
			DrawPath(flight, (!flag) ? (-1f) : (flight.Guided ? flight.PathTime : num));
			if (!flag)
			{
				if (flight.LetGoAt < 0f)
				{
					flight.LetGoAt = Time.time;
				}
				if (!flight.EndLogged)
				{
					NoteArrival(flight, hand, distance);
				}
				return true;
			}
			Vector3 velocity = Vector3.zero;
			bool flag2 = flight.Guided && TryGuide(flight, val, val2, distance, out velocity);
			Vector3 turnRate;
			bool flag3 = TryTurn(flight, transform, num, out turnRate);
			if (flag2 || flag3)
			{
				target.SetMotion(flag2 ? velocity : target.Velocity, flag3 ? new Vector3?(turnRate) : ((Vector3?)null));
			}
			if (flag2)
			{
				target.AddAcceleration(-flight.Gravity);
			}
			else if (!flight.Guided && flight.ExtraGravity != Vector3.zero)
			{
				target.AddAcceleration(flight.ExtraGravity);
			}
			return true;
		}

		private static bool TryGuide(Flight flight, Vector3 arrival, Vector3 center, float distance, out Vector3 velocity)
		{
			//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)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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)
			velocity = Vector3.zero;
			if (distance <= Settings.TrackingStop.Value * BodyScale.Value)
			{
				flight.Released = true;
				flight.EndReason = "stopped steering inside the tracking stop";
				return false;
			}
			float fixedDeltaTime = Time.fixedDeltaTime;
			float num = flight.PathTime / flight.Duration;
			float num2 = Smooth((num - SlowdownStart) / Mathf.Max(1f - SlowdownStart, 0.01f));
			float num3 = 1f - SlowdownAmount * num2;
			float num4 = Mathf.Min(flight.PathTime + num3 * fixedDeltaTime, flight.Duration);
			if (Tracking > 0f)
			{
				Vector3 val = arrival - PlayerShift(flight);
				float num5 = Mathf.Lerp(0.3f, 0.03f, Smooth(num));
				flight.TrackedEnd += (val - flight.TrackedEnd) * (1f - Mathf.Exp((0f - fixedDeltaTime) / num5));
			}
			Vector3 val2 = PathPointWithTracking(flight, flight.PathTime);
			Vector3 val3 = PathPointWithTracking(flight, num4);
			Vector3 val4 = val2 - center;
			if (((Vector3)(ref val4)).magnitude > 0.5f)
			{
				flight.Released = true;
				flight.EndReason = $"was knocked {((Vector3)(ref val4)).magnitude * 100f:0} cm off its path";
				return false;
			}
			flight.PathTime = num4;
			velocity = (val3 - val2) / fixedDeltaTime + flight.Glove.PlayerVelocity + Vector3.ClampMagnitude(val4 / fixedDeltaTime, 4f);
			return true;
		}

		private static void NoteArrival(Flight flight, Hand hand, float distance)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			flight.EndLogged = true;
			string value = flight.EndReason ?? (flight.Guided ? "reached the end of its path" : "finished its arc");
			float num = Vector3.Distance(GloveHand.PalmPosition(hand), flight.LaunchPalm);
			string arrivalNote = $"{flight.Target.Name} {value} {distance * 100f:0} cm from the hand, which moved {num * 100f:0} cm since the flick{PlayerMoved(flight)} (hand tracking {Settings.HandTracking.Value}%)";
			if (FloatTime > 0f)
			{
				flight.ArrivalNote = arrivalNote;
			}
		}

		private static void LogArrivalNote(Flight flight)
		{
			if (flight.ArrivalNote != null)
			{
				_ = flight.Float;
			}
			flight.ArrivalNote = null;
		}

		private static bool InFloat(Flight flight)
		{
			if (flight.Float != FloatPhase.Braking)
			{
				return flight.Float == FloatPhase.Floating;
			}
			return true;
		}

		private static bool TryStartFloat(Flight flight, Vector3 center, Vector3 arrival)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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)
			if (flight.Float != FloatPhase.None || FloatTime <= 0f || Progress(flight) < 0.5f)
			{
				return false;
			}
			Vector3 val = StopPoint(flight, center);
			Vector3 val2 = val - center;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			Vector3 playerVelocity = flight.Glove.PlayerVelocity;
			Vector3 val3 = flight.Target.Velocity - playerVelocity;
			float magnitude2 = ((Vector3)(ref val3)).magnitude;
			bool flag = magnitude2 > 0.1f && Vector3.Dot(val3, val2) > 0f;
			bool num;
			if (!flag)
			{
				if (!(magnitude2 <= 0.5f))
				{
					goto IL_00c7;
				}
				num = magnitude <= Mathf.Max(FloatZone, 0.25f);
			}
			else
			{
				num = magnitude <= Mathf.Min(magnitude2 * FloatBrakeTime / 2f, FloatZone);
			}
			if (num)
			{
				flight.Float = FloatPhase.Braking;
				flight.LetGoAt = -1f;
				flight.Target.SetFastCollision(fast: false);
				Vector3 val4 = PlayerOrigin();
				flight.FloatPoint = val;
				flight.FloatBase = val - val4;
				flight.FloatAnchor = arrival - val4;
				flight.FloatOffset = flight.FloatBase;
				flight.FloatCarry = playerVelocity;
				flight.FloatBrake = Mathf.Min(magnitude2 * magnitude2 / (2f * Mathf.Max(magnitude, 0.01f)), MaxFloatBrake);
				flight.PhaseStart = Time.time;
				float num2 = (flag ? (2f * magnitude / Mathf.Max(magnitude2, 0.1f)) : 0f);
				flight.BrakeUntil = Time.time + Mathf.Min(num2 * 1.2f + 0.05f, 1f);
				flight.BrakeSpeed = magnitude2;
				flight.Settles = magnitude2 <= Settings.FloatStopSpeed.Value * 1.25f;
				flight.Released = true;
				flight.EndLogged = true;
				return true;
			}
			goto IL_00c7;
			IL_00c7:
			return false;
		}

		private static Vector3 StopPoint(Flight flight, Vector3 center)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = PathPointWithTracking(flight, flight.Duration);
			Vector3 val2 = val - center;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			if (flight.Hold != null || magnitude < 0.001f)
			{
				return val;
			}
			Vector3 val3 = val2 / magnitude;
			float num = Vector3.Dot(flight.Target.SurfacePointToward(val) - center, val3);
			return val - val3 * Mathf.Clamp(num, 0f, magnitude);
		}

		private static void StepFloat(Flight flight, Transform hand, float elapsed, Vector3 center, Vector3 arrival)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: 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_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: 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_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: 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_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: 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_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: 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_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			Target target = flight.Target;
			float fixedDeltaTime = Time.fixedDeltaTime;
			float num = MaxFloatBrake * fixedDeltaTime;
			Vector3 val = PlayerOrigin();
			Vector3 val2 = flight.FloatBase + (arrival - val - flight.FloatAnchor) * ((float)Settings.FloatFollow.Value / 100f);
			Vector3 floatOffset = flight.FloatOffset;
			flight.FloatOffset += (val2 - flight.FloatOffset) * (1f - Mathf.Exp((0f - fixedDeltaTime) / 0.1f));
			flight.FloatPoint = val + flight.FloatOffset;
			Vector3 playerVelocity = flight.Glove.PlayerVelocity;
			Vector3 val3 = (flight.FloatOffset - floatOffset) / fixedDeltaTime;
			Vector3 val4 = target.Velocity - flight.FloatCarry;
			Vector3 val5 = flight.FloatPoint - center;
			float magnitude = ((Vector3)(ref val5)).magnitude;
			if (flight.Float == FloatPhase.Braking)
			{
				float num2 = ((magnitude > 0.0001f) ? (Vector3.Dot(val4, val5) / magnitude) : 0f);
				if (num2 > 0f && ((Vector3)(ref val4)).magnitude > 0.1f && Time.time < flight.BrakeUntil)
				{
					Vector3 val6 = val5 / magnitude;
					Vector3 val7 = val4 - val6 * num2;
					float num3 = Mathf.Min(Mathf.Sqrt(2f * flight.FloatBrake * magnitude), num2);
					val4 = val6 * Mathf.Max(num3, num2 - num) + Vector3.MoveTowards(val7, Vector3.zero, num);
				}
				else
				{
					flight.Float = FloatPhase.Floating;
					flight.PhaseStart = Time.time;
					flight.ArriveSpeed = ((Vector3)(ref val4)).magnitude;
					flight.ArriveDistance = ((flight.Hold != null) ? Vector3.Distance(center, arrival) : Vector3.Distance(target.SurfacePointToward(arrival), arrival));
				}
			}
			float num4 = 1f;
			if (flight.Float == FloatPhase.Floating)
			{
				float num5 = Time.time - flight.PhaseStart;
				num4 = 1f - Mathf.Clamp01((num5 - FloatTime) / 0.2f);
				if (num4 <= 0f || magnitude > Mathf.Max(FloatZone, 0.25f) * (flight.Settles ? 2f : 1f))
				{
					EndFloat(flight, (num4 <= 0f) ? $"floated {FloatTime:0.00} s before it fell" : $"left the float after {num5:0.00} s");
					return;
				}
				float magnitude2 = ((Vector3)(ref val4)).magnitude;
				if (flight.Settles)
				{
					Vector3 val8 = val5 * 100f - val4 * 20f;
					val4 += Vector3.ClampMagnitude(val8, MaxFloatBrake) * (fixedDeltaTime * num4);
				}
				else if (magnitude2 > 0.0001f)
				{
					val4 *= 1f - Mathf.Min(1f - Mathf.Exp((0f - fixedDeltaTime) / 0.1f), num / magnitude2) * num4;
				}
			}
			Vector3 turnRate;
			Vector3 value = (TryTurn(flight, hand, elapsed, out turnRate) ? turnRate : (target.MainBody.angularVelocity * Mathf.Exp((0f - fixedDeltaTime) * num4 / 0.25f)));
			flight.FloatCarry = playerVelocity + val3 * num4;
			target.SetMotion(val4 + flight.FloatCarry, value);
			target.AddAcceleration(-flight.Gravity * num4);
		}

		private static void EndFloat(Flight flight, string ending)
		{
			LogFloat(flight, ending);
			flight.Float = FloatPhase.Done;
			flight.FloatEnd = Time.time;
			flight.LetGoAt = Time.time;
			flight.Target.WakeUp();
			FlightSounds.Stop(flight.Target, caught: false);
		}

		private static void LogCatchInFloat(Flight flight, string how)
		{
			if (flight.Float == FloatPhase.Floating)
			{
				LogFloat(flight, $"{how} after floating {Time.time - flight.PhaseStart:0.00} s");
			}
			else if (flight.Float == FloatPhase.Braking)
			{
				LogFloat(flight, how + " while slowing down");
			}
		}

		private static void LogFloat(Flight flight, string ending)
		{
			//IL_00d3: 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)
			if (flight.Float != FloatPhase.Braking)
			{
				if (flight.ArriveSpeed <= 0.5f)
				{
					_ = $", stopped {flight.ArriveDistance * 100f:0} cm from the hand";
				}
				else
				{
					_ = $", went past {flight.ArriveDistance * 100f:0} cm from the hand at {flight.ArriveSpeed:0.0} m/s";
				}
			}
			Hand hand = flight.Glove.Hand;
			if ((Object)(object)hand != (Object)null)
			{
				Vector3.Distance(GloveHand.PalmPosition(hand), flight.LaunchPalm);
			}
		}

		private static string PlayerMoved(Flight flight)
		{
			//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)
			Vector3 val = PlayerShift(flight);
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (!(magnitude >= 0.05f))
			{
				return "";
			}
			return $", the player {magnitude * 100f:0} cm";
		}

		private static Vector3 PathPointWithTracking(Flight flight, float time)
		{
			//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)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = flight.PathPoint(time);
			if (!flight.Guided)
			{
				return val;
			}
			return val + PlayerShift(flight) + (flight.TrackedEnd - flight.Destination) * TrackingWeight(flight, time);
		}

		private static Vector3 PlayerShift(Flight flight)
		{
			//IL_0000: 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)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return PlayerOrigin() - flight.Origin;
		}

		private static Vector3 PlayerOrigin()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			OpenControllerRig controllerRig = Player.ControllerRig;
			if ((Object)(object)controllerRig == (Object)null)
			{
				return Vector3.zero;
			}
			return (((Object)(object)controllerRig.vrRoot != (Object)null) ? controllerRig.vrRoot : ((Component)controllerRig).transform).position;
		}

		private static float TrackingWeight(Flight flight, float time)
		{
			float num = (float)Settings.TrackingStart.Value / 100f;
			float num2 = time / Mathf.Max(flight.Duration, 0.01f);
			return Tracking * Smooth((num2 - num) / Mathf.Max(1f - num, 0.01f));
		}

		private static bool TryTurn(Flight flight, Transform hand, float elapsed, out Vector3 turnRate)
		{
			//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)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00de: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			turnRate = Vector3.zero;
			Quaternion val;
			Quaternion rotation;
			float num2;
			if (flight.Hold != null)
			{
				val = flight.Hold.HeldRotation(hand);
				rotation = flight.Hold.HostBody.rotation;
				float num = (flight.Guided ? flight.PathTime : elapsed);
				num2 = Mathf.Max(flight.Duration - num, 0.1f);
			}
			else
			{
				if (!(flight.Follow > 0f) || !(elapsed >= 0.12f))
				{
					return false;
				}
				if (!flight.Following)
				{
					flight.Following = true;
					flight.HandReference = hand.rotation;
					flight.ObjectReference = flight.Target.MainBody.rotation;
				}
				Quaternion val2 = hand.rotation * Quaternion.Inverse(flight.HandReference);
				val = Quaternion.Slerp(Quaternion.identity, val2, flight.Follow) * flight.ObjectReference;
				rotation = flight.Target.MainBody.rotation;
				num2 = 0.1f;
			}
			Vector3 val3 = RotationMath.ToAngleAxis(val * Quaternion.Inverse(rotation)) * ((float)Math.PI / 180f);
			turnRate = Vector3.ClampMagnitude(val3 / num2, 15f);
			return true;
		}

		private static void CheckCollected(Flight flight)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			float num = 0.35f * BodyScale.Value;
			Hand val = null;
			Hand[] array = (Hand[])(object)new Hand[2]
			{
				Player.LeftHand,
				Player.RightHand
			};
			foreach (Hand val2 in array)
			{
				if (!((Object)(object)val2 == (Object)null))
				{
					float num2 = Vector3.Distance(GloveHand.PalmPosition(val2), flight.LastCenter);
					if (num2 <= num)
					{
						val = val2;
						num = num2;
					}
				}
			}
			if (!((Object)(object)val == (Object)null))
			{
				flight.Caught = true;
				Feedback.Catch(val, flight.Target);
			}
		}

		private static float ClearArc(Target target, Vector3 start, Vector3 end, Vector3 gravity, float arc, float time, out string note)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			note = null;
			if (gravity == Vector3.zero || time <= 0f)
			{
				return arc;
			}
			float radius = 0.03f;
			if (target.TryGetBounds(out var bounds))
			{
				Vector3 extents = ((Bounds)(ref bounds)).extents;
				radius = Mathf.Clamp(Mathf.Min(extents.x, Mathf.Min(extents.y, extents.z)), 0.02f, 0.1f);
			}
			float clearance = 0.3f * BodyScale.Value;
			Collider val = null;
			float[] arcTries = ArcTries;
			foreach (float num in arcTries)
			{
				Collider val2 = FindObstacle(target, start, end, gravity * (arc * num), time, radius, clearance);
				if ((Object)(object)val2 == (Object)null)
				{
					if ((Object)(object)val != (Object)null)
					{
						note = $"arc {((num < 1f) ? "lowered" : "raised")} to {num:0%} to clear {((Object)val).name}";
					}
					return arc * num;
				}
				if (val == null)
				{
					val = val2;
				}
				if (arc <= 0f)
				{
					break;
				}
			}
			note = "arc blocked by " + ((Object)val).name + ", flying it anyway";
			return arc;
		}

		private static Collider FindObstacle(Target target, Vector3 start, Vector3 end, Vector3 pathGravity, float time, float radius, float clearance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (migh