Decompiled source of ConveyorBelt v1.0.0

CompanyConveyor.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CompanyConveyor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CompanyConveyor")]
[assembly: AssemblyTitle("CompanyConveyor")]
[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 CompanyConveyor
{
	[BepInPlugin("companyconveyor", "CompanyConveyor", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal const string UpgradeName = "Conveyor Belt";

		internal static ConfigEntry<float> Speed;

		internal static ConfigEntry<string> LandedShip;

		private void Awake()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0066: 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_0074: 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_008d: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Speed = ((BaseUnityPlugin)this).Config.Bind<float>("Belt", "Speed", 2.75f, "Belt speed in meters per second. Every player should use the same value.");
			LandedShip = ((BaseUnityPlugin)this).Config.Bind<string>("Belt", "LandedShip", "1,0,0,0,0,1,0,0,0,0,1,0,1.27146339,0.278438568,-7.5,1", "Saved automatically: where the ship sits once landed at the Company, so the belt can appear before landing.");
			Unlockables.RegisterUnlockable(new UnlockableItem
			{
				unlockableName = "Conveyor Belt",
				unlockableType = 1,
				spawnPrefab = false,
				alwaysInStock = true,
				IsPlaceable = false,
				canBeStored = false,
				maxNumber = 1
			}, 249, (StoreType)1);
			new Harmony("companyconveyor").PatchAll();
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Update")]
	internal static class StartOfRoundPatch
	{
		private static void Postfix(StartOfRound __instance)
		{
			Belt.Tick(__instance);
		}
	}
	[HarmonyPatch(typeof(Terminal), "Start")]
	internal static class TerminalAliasPatch
	{
		private static void Postfix(Terminal __instance)
		{
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			TerminalKeyword[] allKeywords = __instance.terminalNodes.allKeywords;
			TerminalKeyword orig = ((IEnumerable<TerminalKeyword>)allKeywords).FirstOrDefault((Func<TerminalKeyword, bool>)((TerminalKeyword k) => k.word == "conveyor-belt"));
			if ((Object)(object)orig == (Object)null || allKeywords.Any((TerminalKeyword k) => k.word == "conveyor"))
			{
				return;
			}
			TerminalKeyword val = Object.Instantiate<TerminalKeyword>(orig);
			string word = (((Object)val).name = "conveyor");
			val.word = word;
			foreach (TerminalKeyword item in allKeywords.Where((TerminalKeyword k) => k.compatibleNouns != null))
			{
				foreach (CompatibleNoun item2 in item.compatibleNouns.Where((CompatibleNoun c) => (Object)(object)c.noun == (Object)(object)orig).ToList())
				{
					item.compatibleNouns = item.compatibleNouns.Append(new CompatibleNoun(val, item2.result)).ToArray();
				}
			}
			__instance.terminalNodes.allKeywords = allKeywords.Append(val).ToArray();
		}
	}
	internal static class Belt
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<AudioSource, AudioMixerGroup> <>9__22_0;

			public static Func<AudioMixerGroup, bool> <>9__22_1;

			public static Predicate<UnlockableItem> <>9__27_0;

			public static HandleNamedMessageDelegate <>9__30_0;

			public static HandleNamedMessageDelegate <>9__30_1;

			public static Func<GameObject, float> <>9__34_1;

			public static Func<GameObject, bool> <>9__34_3;

			public static UnityAction<PlayerControllerB> <>9__34_6;

			public static Func<(MeshFilter m, float size, float dist), bool> <>9__36_2;

			public static Func<(MeshFilter m, float size, float dist), GameObject> <>9__36_3;

			internal AudioMixerGroup <MixerGroup>b__22_0(AudioSource s)
			{
				return s.outputAudioMixerGroup;
			}

			internal bool <MixerGroup>b__22_1(AudioMixerGroup g)
			{
				return (Object)(object)g != (Object)null;
			}

			internal bool <Tick>b__27_0(UnlockableItem u)
			{
				if (u.unlockableName == "Conveyor Belt")
				{
					return u.hasBeenUnlockedByPlayer;
				}
				return false;
			}

			internal void <RegisterMessages>b__30_0(ulong sender, FastBufferReader r)
			{
				if (NetworkManager.Singleton.IsServer)
				{
					SetAndBroadcast(!on);
				}
			}

			internal void <RegisterMessages>b__30_1(ulong sender, FastBufferReader r)
			{
				//IL_0006: 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)
				bool flag = default(bool);
				((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				SetOn(flag);
			}

			internal float <BuildSwitch>b__34_1(GameObject p)
			{
				//IL_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Bounds bounds = p.GetComponent<MeshFilter>().sharedMesh.bounds;
				Vector3 val = Vector3.Scale(((Bounds)(ref bounds)).size, p.transform.lossyScale);
				return ((Vector3)(ref val)).magnitude;
			}

			internal bool <BuildSwitch>b__34_3(GameObject p)
			{
				return ((Object)p).name.ToLowerInvariant().Contains("button");
			}

			internal void <BuildSwitch>b__34_6(PlayerControllerB _)
			{
				RequestToggle();
			}

			internal bool <FindPanelParts>b__36_2((MeshFilter m, float size, float dist) c)
			{
				if (c.size < 1f)
				{
					return c.dist < 0.6f;
				}
				return false;
			}

			internal GameObject <FindPanelParts>b__36_3((MeshFilter m, float size, float dist) c)
			{
				return ((Component)c.m).gameObject;
			}
		}

		private const float Width = 1.5f;

		private const float Raise = 0.2f;

		private const float BedThick = 0.1f;

		private const float RailHeight = 0.2f;

		private const float LegSpacing = 1.5f;

		private static readonly Vector3[] PathLocal = (Vector3[])(object)new Vector3[3]
		{
			new Vector3(-10.57f, -2.9f, -1.97f),
			new Vector3(-10.59f, -2.9f, -10.71f),
			new Vector3(-25.65f, -2.9f, -20.33f)
		};

		private static readonly Vector3 SwitchLocal = new Vector3(-13.04f, -2.9f, -2.74f);

		private const float SwitchTurn = 270f;

		private const float PanelYaw = -6f;

		private const float PanelRoll = 0f;

		private static GameObject root;

		private static Vector3[] pts;

		private static readonly List<Material> bedMats = new List<Material>();

		private static GrabbableObject[] items = (GrabbableObject[])(object)new GrabbableObject[0];

		private static float nextScan;

		private static bool shipSaved;

		private static bool on = true;

		private static CustomMessagingManager registeredFor;

		private static readonly List<AudioSource> hums = new List<AudioSource>();

		private static AudioClip humClip;

		private static AudioClip clickClip;

		private static AudioSource clickSrc;

		private static AudioMixerGroup MixerGroup(StartOfRound sor)
		{
			return (from s in ((Component)sor.elevatorTransform).GetComponentsInChildren<AudioSource>(true)
				select s.outputAudioMixerGroup).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup g) => (Object)(object)g != (Object)null));
		}

		private static AudioClip Click()
		{
			if (Object.op_Implicit((Object)(object)clickClip))
			{
				return clickClip;
			}
			float[] array = new float[4410];
			Random random = new Random(2);
			for (int i = 0; i < 4410; i++)
			{
				float num = (float)i / 44100f;
				array[i] = ((float)random.NextDouble() * 2f - 1f) * Mathf.Exp((0f - num) * 90f) * 0.6f + Mathf.Sin(MathF.PI * 3600f * num) * Mathf.Exp((0f - num) * 60f) * 0.4f;
			}
			clickClip = AudioClip.Create("ConveyorClick", 4410, 1, 44100, false);
			clickClip.SetData(array, 0);
			return clickClip;
		}

		private static void SetOn(bool v)
		{
			if (v != on && Object.op_Implicit((Object)(object)clickSrc))
			{
				clickSrc.PlayOneShot(Click());
			}
			on = v;
		}

		private static AudioClip Hum()
		{
			if (Object.op_Implicit((Object)(object)humClip))
			{
				return humClip;
			}
			float[] array = new float[88200];
			Random random = new Random(1);
			for (int i = 0; i < 88200; i++)
			{
				float num = (float)i / 44100f;
				float num2 = num % 0.25f;
				float num3 = 0.5f * Mathf.Sin(MathF.PI * 120f * num) + 0.25f * Mathf.Sin(MathF.PI * 240f * num) + 0.1f * Mathf.Sin(MathF.PI * 360f * num);
				float num4 = Mathf.Exp((0f - num2) * 60f) * ((float)random.NextDouble() * 2f - 1f) * 0.6f;
				float num5 = ((float)random.NextDouble() * 2f - 1f) * 0.05f;
				array[i] = (num3 * 0.5f + num4 + num5) * 0.5f;
			}
			humClip = AudioClip.Create("ConveyorHum", 88200, 1, 44100, false);
			humClip.SetData(array, 0);
			return humClip;
		}

		private static void AddHum(StartOfRound sor, Vector3 pos)
		{
			//IL_0005: 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)
			AudioSource val = new GameObject("Hum").AddComponent<AudioSource>();
			((Component)val).transform.SetParent(root.transform);
			((Component)val).transform.position = pos;
			val.clip = Hum();
			val.loop = true;
			val.spatialBlend = 1f;
			val.volume = 0.3f;
			val.rolloffMode = (AudioRolloffMode)1;
			val.minDistance = 2f;
			val.maxDistance = 16f;
			val.outputAudioMixerGroup = MixerGroup(sor);
			hums.Add(val);
		}

		public static void Tick(StartOfRound sor)
		{
			//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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			if (sor.unlockablesList.unlockables.Exists((UnlockableItem u) => u.unlockableName == "Conveyor Belt" && u.hasBeenUnlockedByPlayer) && (Object)(object)sor.currentLevel != (Object)null && sor.currentLevel.sceneName == "CompanyBuilding" && !sor.inShipPhase)
			{
				Scene sceneByName = SceneManager.GetSceneByName("CompanyBuilding");
				if (((Scene)(ref sceneByName)).isLoaded)
				{
					RegisterMessages();
					if (sor.shipHasLanded && !shipSaved)
					{
						Plugin.LandedShip.Value = Floats(sor.elevatorTransform.localToWorldMatrix);
						shipSaved = true;
					}
					if (!Object.op_Implicit((Object)(object)root) && !Build(sor))
					{
						return;
					}
					foreach (AudioSource hum in hums)
					{
						if (Object.op_Implicit((Object)(object)hum) && on != hum.isPlaying)
						{
							if (on)
							{
								hum.Play();
							}
							else
							{
								hum.Stop();
							}
						}
					}
					if (!on)
					{
						return;
					}
					foreach (Material bedMat in bedMats)
					{
						bedMat.SetTextureOffset("_BaseColorMap", bedMat.GetTextureOffset("_BaseColorMap") + new Vector2(0f, Plugin.Speed.Value / 0.5f * Time.deltaTime));
					}
					MoveItems(sor);
					MovePlayer(sor);
					return;
				}
			}
			if (Object.op_Implicit((Object)(object)root))
			{
				Object.Destroy((Object)(object)root);
			}
			on = true;
			shipSaved = false;
		}

		private static Matrix4x4? ShipMatrix(StartOfRound sor)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (sor.shipHasLanded)
			{
				return sor.elevatorTransform.localToWorldMatrix;
			}
			string[] array = Plugin.LandedShip.Value.Split(',');
			if (array.Length != 16)
			{
				return null;
			}
			Matrix4x4 value = default(Matrix4x4);
			for (int i = 0; i < 16; i++)
			{
				((Matrix4x4)(ref value))[i] = float.Parse(array[i], CultureInfo.InvariantCulture);
			}
			return value;
		}

		private static string Floats(Matrix4x4 m)
		{
			//IL_0007: 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)
			return string.Join(",", from i in Enumerable.Range(0, 16)
				select ((Matrix4x4)(ref m))[i].ToString("R", CultureInfo.InvariantCulture));
		}

		private static void RegisterMessages()
		{
			//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_0049: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			NetworkManager singleton = NetworkManager.Singleton;
			CustomMessagingManager val = ((singleton != null) ? singleton.CustomMessagingManager : null);
			if (val == null || val == registeredFor)
			{
				return;
			}
			registeredFor = val;
			object obj = <>c.<>9__30_0;
			if (obj == null)
			{
				HandleNamedMessageDelegate val2 = delegate
				{
					if (NetworkManager.Singleton.IsServer)
					{
						SetAndBroadcast(!on);
					}
				};
				<>c.<>9__30_0 = val2;
				obj = (object)val2;
			}
			val.RegisterNamedMessageHandler("CompanyConveyor.Toggle", (HandleNamedMessageDelegate)obj);
			object obj2 = <>c.<>9__30_1;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val3 = delegate(ulong sender, FastBufferReader r)
				{
					//IL_0006: 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)
					bool flag = default(bool);
					((FastBufferReader)(ref r)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
					SetOn(flag);
				};
				<>c.<>9__30_1 = val3;
				obj2 = (object)val3;
			}
			val.RegisterNamedMessageHandler("CompanyConveyor.State", (HandleNamedMessageDelegate)obj2);
		}

		private unsafe static void RequestToggle()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton == (Object)null)
			{
				return;
			}
			if (singleton.IsServer)
			{
				SetAndBroadcast(!on);
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1);
			try
			{
				singleton.CustomMessagingManager.SendNamedMessage("CompanyConveyor.Toggle", 0uL, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose();
			}
		}

		private unsafe static void SetAndBroadcast(bool v)
		{
			//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)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			SetOn(v);
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(1, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref v, default(ForPrimitives));
				NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll("CompanyConveyor.State", val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose();
			}
		}

		private static void MovePlayer(StartOfRound sor)
		{
			//IL_0037: 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_0042: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00ad: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = sor.localPlayerController;
			if (!((Object)(object)localPlayerController == (Object)null) && localPlayerController.isPlayerControlled && !localPlayerController.isPlayerDead && !localPlayerController.inSpecialInteractAnimation && !localPlayerController.isClimbingLadder)
			{
				Vector3 position = ((Component)localPlayerController).transform.position;
				if (FindSegment(pts, position, 0.75f, out var seg, out var _) && !(Mathf.Abs(position.y - pts[seg].y) > 0.3f))
				{
					CharacterController thisController = localPlayerController.thisController;
					Vector3 val = pts[seg + 1] - pts[seg];
					thisController.Move(((Vector3)(ref val)).normalized * Plugin.Speed.Value * Time.deltaTime);
				}
			}
		}

		private static void BuildSwitch(StartOfRound sor, Matrix4x4 ship)
		{
			//IL_003b: 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_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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_0179: 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_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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: 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_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: 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_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Expected O, but got Unknown
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0681: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Expected O, but got Unknown
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_0710: Expected O, but got Unknown
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Expected O, but got Unknown
			//IL_071c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Expected O, but got Unknown
			//IL_0727: Unknown result type (might be due to invalid IL or missing references)
			//IL_0731: Expected O, but got Unknown
			//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			InteractTrigger[] source = Resources.FindObjectsOfTypeAll<InteractTrigger>();
			InteractTrigger val = ((IEnumerable<InteractTrigger>)source).FirstOrDefault((Func<InteractTrigger, bool>)Targets<MineshaftElevatorController>) ?? ((IEnumerable<InteractTrigger>)source).FirstOrDefault((Func<InteractTrigger, bool>)Targets<ShipLights>);
			Vector3 val2 = Flat(pts[1] - pts[0]);
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			Vector3 val3 = ((Matrix4x4)(ref ship)).MultiplyPoint3x4(SwitchLocal);
			Quaternion val4 = Quaternion.LookRotation(-normalized);
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
			obj.transform.SetParent(root.transform);
			obj.transform.position = val3 + Vector3.up * 1.2f / 2f;
			obj.transform.localScale = new Vector3(0.15f, 0.6f, 0.15f);
			obj.GetComponent<Renderer>().sharedMaterial = NewMat(new Color(0.6f, 0.55f, 0.1f), null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)"CompanyConveyor: no button found");
				return;
			}
			List<GameObject> parts = FindPanelParts(val);
			GameObject val5 = parts.OrderByDescending(delegate(GameObject p)
			{
				//IL_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Bounds bounds3 = p.GetComponent<MeshFilter>().sharedMesh.bounds;
				Vector3 val14 = Vector3.Scale(((Bounds)(ref bounds3)).size, p.transform.lossyScale);
				return ((Vector3)(ref val14)).magnitude;
			}).FirstOrDefault();
			if ((Object)(object)val5 == (Object)null)
			{
				Debug.LogWarning((object)"CompanyConveyor: elevator panel model not found");
				return;
			}
			Transform pT = val5.transform;
			Vector3 pScale = pT.lossyScale;
			Mesh sharedMesh = val5.GetComponent<MeshFilter>().sharedMesh;
			Bounds bounds = sharedMesh.bounds;
			Vector3 val6 = Abs(Vector3.Scale(((Bounds)(ref bounds)).size, pScale));
			bounds = sharedMesh.bounds;
			Vector3 mid = Vector3.Scale(((Bounds)(ref bounds)).center, pScale);
			int num = ((!(val6.x <= val6.y) || !(val6.x <= val6.z)) ? ((val6.y <= val6.z) ? 1 : 2) : 0);
			GameObject val7 = ((IEnumerable<GameObject>)parts).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => ((Object)p).name.ToLowerInvariant().Contains("button"))) ?? ((Component)val).gameObject;
			val2 = Local(val7.transform);
			float num2 = ((((Vector3)(ref val2))[num] >= ((Vector3)(ref mid))[num]) ? 1 : (-1));
			Vector3 zero = Vector3.zero;
			((Vector3)(ref zero))[num] = num2;
			Vector3 val8 = pT.InverseTransformDirection(Vector3.up);
			((Vector3)(ref val8))[num] = 0f;
			if (((Vector3)(ref val8)).sqrMagnitude < 0.01f)
			{
				val8 = ((num == 1) ? Vector3.forward : Vector3.up);
			}
			Transform A = new GameObject("Switch").transform;
			A.SetParent(root.transform);
			A.position = val3 + Vector3.up * 1.2f;
			A.rotation = val4 * Quaternion.Euler(0f, 270f, 0f) * Quaternion.Inverse(Quaternion.LookRotation(zero, ((Vector3)(ref val8)).normalized));
			Transform P = new GameObject("Panel").transform;
			P.SetParent(A, false);
			P.localPosition = mid;
			P.localRotation = Quaternion.AngleAxis(-6f, ((Vector3)(ref val8)).normalized) * Quaternion.AngleAxis(0f, zero);
			clickSrc = ((Component)A).gameObject.AddComponent<AudioSource>();
			clickSrc.spatialBlend = 1f;
			clickSrc.rolloffMode = (AudioRolloffMode)1;
			clickSrc.minDistance = 1f;
			clickSrc.maxDistance = 12f;
			clickSrc.outputAudioMixerGroup = MixerGroup(sor);
			GameObject holder = new GameObject("holder");
			holder.SetActive(false);
			foreach (GameObject item in parts.Where((GameObject p) => !parts.Any((GameObject q) => (Object)(object)q != (Object)(object)p && p.transform.IsChildOf(q.transform))))
			{
				Clone(item, clickZone: false);
			}
			GameObject val9 = Clone(((Component)val).gameObject, clickZone: true);
			Material black = NewMat(new Color(0.02f, 0.02f, 0.02f), null);
			Vector3 val10 = val6 + Vector3.one * 2f * 0.03f;
			((Vector3)(ref val10))[num] = ((Vector3)(ref val6))[num] + 0.12f;
			Vector3 val11 = mid;
			((Vector3)(ref val11))[num] = ((Vector3)(ref mid))[num] - num2 * ((Vector3)(ref val6))[num] / 2f + num2 * ((Vector3)(ref val10))[num] / 2f;
			Vector3 val12 = val10 + Vector3.one * 2f * 0.02f;
			Vector3 pos = val11;
			ref Vector3 reference = ref pos;
			int num3 = num;
			((Vector3)(ref reference))[num3] = ((Vector3)(ref reference))[num3] - num2 * (((Vector3)(ref val10))[num] / 2f + 0.01f);
			Vector3 scale = val12;
			((Vector3)(ref scale))[num] = 0.02f;
			Wall(pos, scale);
			for (int num4 = 0; num4 < 3; num4++)
			{
				if (num4 != num)
				{
					int[] array = new int[2] { -1, 1 };
					foreach (int num5 in array)
					{
						Vector3 pos2 = val11;
						reference = ref pos2;
						int num6 = num4;
						((Vector3)(ref reference))[num6] = ((Vector3)(ref reference))[num6] + (float)num5 * (((Vector3)(ref val10))[num4] / 2f + 0.01f);
						Vector3 scale2 = val12;
						((Vector3)(ref scale2))[num4] = 0.02f;
						((Vector3)(ref scale2))[num] = ((Vector3)(ref val10))[num];
						Wall(pos2, scale2);
					}
				}
			}
			Renderer[] componentsInChildren = ((Component)A).GetComponentsInChildren<Renderer>();
			Bounds bounds2 = componentsInChildren[0].bounds;
			Renderer[] array2 = componentsInChildren;
			foreach (Renderer val13 in array2)
			{
				((Bounds)(ref bounds2)).Encapsulate(val13.bounds);
			}
			Transform obj2 = A;
			obj2.position += new Vector3(val3.x - ((Bounds)(ref bounds2)).center.x, val3.y + 1.2f - ((Bounds)(ref bounds2)).min.y, val3.z - ((Bounds)(ref bounds2)).center.z);
			InteractTrigger component = val9.GetComponent<InteractTrigger>();
			component.onInteract = new InteractEvent();
			component.onInteractEarly = new InteractEvent();
			component.onInteractEarlyOtherClients = new InteractEvent();
			component.onStopInteract = new InteractEvent();
			component.onCancelAnimation = new InteractEvent();
			((UnityEvent<PlayerControllerB>)(object)component.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate
			{
				RequestToggle();
			});
			int num7 = val.hoverTip.IndexOf(" :");
			component.hoverTip = "Switch conveyor belt" + ((num7 >= 0) ? val.hoverTip.Substring(num7) : "");
			component.interactable = true;
			component.holdInteraction = false;
			Object.Destroy((Object)(object)holder);
			GameObject Clone(GameObject o, bool clickZone)
			{
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_011e: 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_0139: Unknown result type (might be due to invalid IL or missing references)
				GameObject val14 = Object.Instantiate<GameObject>(o, holder.transform);
				val14.SetActive(true);
				NetworkBehaviour[] componentsInChildren2 = val14.GetComponentsInChildren<NetworkBehaviour>(true);
				foreach (NetworkBehaviour val15 in componentsInChildren2)
				{
					if (!clickZone || !(val15 is InteractTrigger))
					{
						Object.DestroyImmediate((Object)(object)val15);
					}
				}
				NetworkObject[] componentsInChildren3 = val14.GetComponentsInChildren<NetworkObject>(true);
				for (int i = 0; i < componentsInChildren3.Length; i++)
				{
					Object.DestroyImmediate((Object)(object)componentsInChildren3[i]);
				}
				if (clickZone)
				{
					MeshRenderer[] componentsInChildren4 = val14.GetComponentsInChildren<MeshRenderer>(true);
					for (int i = 0; i < componentsInChildren4.Length; i++)
					{
						Object.DestroyImmediate((Object)(object)componentsInChildren4[i]);
					}
				}
				else
				{
					Collider[] componentsInChildren5 = val14.GetComponentsInChildren<Collider>(true);
					for (int i = 0; i < componentsInChildren5.Length; i++)
					{
						Object.DestroyImmediate((Object)(object)componentsInChildren5[i]);
					}
				}
				Renderer[] componentsInChildren6 = val14.GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren6.Length; i++)
				{
					componentsInChildren6[i].enabled = true;
				}
				val14.transform.SetParent(P, false);
				val14.transform.localPosition = Local(o.transform) - mid;
				val14.transform.localRotation = Quaternion.Inverse(pT.rotation) * o.transform.rotation;
				val14.transform.localScale = o.transform.lossyScale;
				return val14;
			}
			Vector3 Local(Transform t)
			{
				//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_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)
				return Vector3.Scale(pT.InverseTransformPoint(t.position), pScale);
			}
			static bool Targets<T>(InteractTrigger t)
			{
				return Enumerable.Range(0, ((UnityEventBase)t.onInteract).GetPersistentEventCount()).Any((int i) => ((UnityEventBase)t.onInteract).GetPersistentTarget(i) is T);
			}
			void Wall(Vector3 localPosition, Vector3 localScale)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)3);
				Object.Destroy((Object)(object)obj3.GetComponent<Collider>());
				obj3.transform.SetParent(A, false);
				obj3.transform.localPosition = localPosition;
				obj3.transform.localScale = localScale;
				obj3.GetComponent<Renderer>().sharedMaterial = black;
			}
		}

		private static Vector3 Abs(Vector3 v)
		{
			//IL_0000: 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_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)
			return new Vector3(Mathf.Abs(v.x), Mathf.Abs(v.y), Mathf.Abs(v.z));
		}

		private static List<GameObject> FindPanelParts(InteractTrigger trig)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 origin = ((Component)trig).transform.position;
			return (from c in (from c in (from m in ((Component)((Component)trig).transform.root).GetComponentsInChildren<MeshFilter>(true)
						where (Object)(object)m.sharedMesh != (Object)null && (Object)(object)((Component)m).GetComponent<MeshRenderer>() != (Object)null && !((Component)m).transform.IsChildOf(((Component)trig).transform)
						select m).Select(delegate(MeshFilter m)
					{
						//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_000f: 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_0024: 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_0038: Unknown result type (might be due to invalid IL or missing references)
						Bounds bounds = m.sharedMesh.bounds;
						Vector3 val = Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)m).transform.lossyScale);
						return (m: m, size: ((Vector3)(ref val)).magnitude, dist: Vector3.Distance(((Component)m).transform.position, origin));
					})
					where c.size < 1f && c.dist < 0.6f
					select c).ToList()
				select ((Component)c.m).gameObject).ToList();
		}

		private static bool Build(StartOfRound sor)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00aa: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//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_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_012b: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: 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_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: 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_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: 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)
			Matrix4x4? ship = ShipMatrix(sor);
			if (!ship.HasValue)
			{
				return false;
			}
			pts = PathLocal.Select(delegate(Vector3 p)
			{
				//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)
				//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_001e: 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)
				Matrix4x4 value = ship.Value;
				return ((Matrix4x4)(ref value)).MultiplyPoint3x4(p) + Vector3.up * 0.2f;
			}).ToArray();
			for (int num = 1; num < pts.Length; num++)
			{
				pts[num].y = pts[0].y;
			}
			root = new GameObject("CompanyConveyor");
			bedMats.Clear();
			hums.Clear();
			Material mat = NewMat(new Color(0.15f, 0.15f, 0.15f), null);
			Texture2D val = new Texture2D(1, 2)
			{
				filterMode = (FilterMode)0,
				wrapMode = (TextureWrapMode)0
			};
			val.SetPixels((Color[])(object)new Color[2]
			{
				new Color(0.12f, 0.12f, 0.12f),
				new Color(0.3f, 0.3f, 0.3f)
			});
			val.Apply();
			Vector3[] obj = (Vector3[])pts.Clone();
			ref Vector3 reference = ref obj[0];
			Vector3 val2 = reference;
			Vector3 val3 = pts[1] - pts[0];
			reference = val2 - ((Vector3)(ref val3)).normalized * 1.5f / 2f;
			Material val4 = NewMat(Color.white, (Texture)(object)val);
			bedMats.Add(val4);
			Strip(obj, val4, 0f, 0.75f, -0.1f, 0f);
			int[] array = new int[2] { -1, 1 };
			foreach (int num3 in array)
			{
				Strip(pts, mat, (float)num3 * 1.5f / 2f, 0.025f, -0.1f, 0.2f);
			}
			for (int num4 = 0; num4 < pts.Length - 1; num4++)
			{
				Vector3 val5 = pts[num4];
				Vector3 val6 = pts[num4 + 1];
				float num5 = Vector3.Distance(val5, val6);
				Vector3 val7 = Quaternion.LookRotation(val6 - val5) * Vector3.right;
				bool flag = num4 == pts.Length - 2;
				AddHum(sor, (val5 + val6) / 2f);
				for (float num6 = 0.3f; num6 < num5; num6 += 1.5f)
				{
					array = new int[2] { -1, 1 };
					foreach (int num7 in array)
					{
						Leg(mat, val5 + (val6 - val5) * (num6 / num5) + val7 * (float)num7 * 1.5f * 0.4f);
					}
				}
				if (flag)
				{
					array = new int[2] { -1, 1 };
					foreach (int num8 in array)
					{
						Vector3 val8 = val6 + val7 * (float)num8 * 1.5f * 0.4f;
						val3 = val6 - val5;
						Leg(mat, val8 - ((Vector3)(ref val3)).normalized * 0.1f);
					}
				}
			}
			BuildSwitch(sor, ship.Value);
			return true;
		}

		private static void Leg(Material mat, Vector3 top)
		{
			//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_000b: 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_0015: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0056: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			top += Vector3.down * 0.1f;
			RaycastHit val = default(RaycastHit);
			float num = (Physics.Raycast(top + Vector3.down * 0.01f, Vector3.down, ref val, 5f) ? (((RaycastHit)(ref val)).distance + 0.01f) : 0.2f);
			Object.Destroy((Object)(object)Cube(mat, top + Vector3.down * num / 2f, Quaternion.identity, new Vector3(0.06f, num, 0.06f)).GetComponent<Collider>());
		}

		private static void Strip(Vector3[] path, Material mat, float offset, float half, float bottom, float top)
		{
			//IL_0147: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: 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)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: 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_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: 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_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: 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_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: 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)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: 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_03a2: Expected O, but got Unknown
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00a0: 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_00b4: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00ff: 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)
			int num = path.Length;
			Vector3[] array = (Vector3[])(object)new Vector3[num];
			Vector3[] array2 = (Vector3[])(object)new Vector3[num];
			float[] array3 = new float[num];
			for (int i = 0; i < num; i++)
			{
				Vector3 val = ((i > 0) ? Side(path[i] - path[i - 1]) : Side(path[1] - path[0]));
				Vector3 val2 = ((i < num - 1) ? Side(path[i + 1] - path[i]) : val);
				Vector3 val3 = val + val2;
				Vector3 normalized = ((Vector3)(ref val3)).normalized;
				normalized /= Vector3.Dot(normalized, val);
				array[i] = path[i] + normalized * (offset - half);
				array2[i] = path[i] + normalized * (offset + half);
				if (i > 0)
				{
					array3[i] = array3[i - 1] + Vector3.Distance(path[i], path[i - 1]);
				}
			}
			List<Vector3> verts = new List<Vector3>();
			List<Vector2> uvs = new List<Vector2>();
			List<int> tris = new List<int>();
			Vector3 val4 = Vector3.up * top;
			Vector3 val5 = Vector3.up * bottom;
			for (int j = 0; j < num - 1; j++)
			{
				int num2 = j + 1;
				float num3 = (0f - array3[j]) / 0.5f;
				float num4 = (0f - array3[num2]) / 0.5f;
				Quad(array[j] + val4, array[num2] + val4, array2[num2] + val4, array2[j] + val4, num3, num4, num4, num3);
				Quad(array2[j] + val5, array2[num2] + val5, array[num2] + val5, array[j] + val5);
				Quad(array2[j] + val5, array2[j] + val4, array2[num2] + val4, array2[num2] + val5);
				Quad(array[num2] + val5, array[num2] + val4, array[j] + val4, array[j] + val5);
			}
			Quad(array[0] + val5, array[0] + val4, array2[0] + val4, array2[0] + val5);
			Quad(array2[num - 1] + val5, array2[num - 1] + val4, array[num - 1] + val4, array[num - 1] + val5);
			Mesh val6 = new Mesh();
			val6.SetVertices(verts);
			val6.SetUVs(0, uvs);
			val6.SetTriangles(tris, 0);
			val6.RecalculateNormals();
			val6.RecalculateBounds();
			GameObject val7 = new GameObject("Strip");
			val7.transform.SetParent(root.transform, false);
			val7.AddComponent<MeshFilter>().sharedMesh = val6;
			((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterial = mat;
			val7.AddComponent<MeshCollider>().sharedMesh = val6;
			void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, float va = 0f, float vb = 0f, float vc = 0f, float vd = 0f)
			{
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_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_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: 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)
				int count = verts.Count;
				verts.AddRange((IEnumerable<Vector3>)(object)new Vector3[4] { a, b, c, d });
				uvs.AddRange((IEnumerable<Vector2>)(object)new Vector2[4]
				{
					new Vector2(0f, va),
					new Vector2(0f, vb),
					new Vector2(1f, vc),
					new Vector2(1f, vd)
				});
				tris.AddRange(new int[6]
				{
					count,
					count + 1,
					count + 2,
					count,
					count + 2,
					count + 3
				});
			}
		}

		private static Vector3 Side(Vector3 dir)
		{
			//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_000b: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.Cross(Vector3.up, Flat(dir));
			return ((Vector3)(ref val)).normalized;
		}

		private static GameObject Cube(Material mat, Vector3 pos, Quaternion rot, Vector3 scale)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3);
			obj.transform.SetParent(root.transform);
			obj.transform.SetPositionAndRotation(pos, rot);
			obj.transform.localScale = scale;
			obj.GetComponent<Renderer>().sharedMaterial = mat;
			return obj;
		}

		private static Material NewMat(Color color, Texture tex)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0044: Expected O, but got Unknown
			Shader val = Shader.Find("HDRP/Lit");
			Material val2 = (((Object)(object)val != (Object)null) ? new Material(val) : new Material(((Renderer)Object.FindObjectOfType<MeshRenderer>()).sharedMaterial));
			val2.SetColor("_BaseColor", color);
			val2.SetTexture("_BaseColorMap", tex);
			return val2;
		}

		private static void MoveItems(StartOfRound sor)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0102: 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_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_0111: 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)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: 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_022d: 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_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_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time > nextScan)
			{
				items = Object.FindObjectsOfType<GrabbableObject>();
				nextScan = Time.time + 1f;
			}
			float num = Plugin.Speed.Value * Time.deltaTime;
			GrabbableObject[] array = items;
			foreach (GrabbableObject val in array)
			{
				if (!Object.op_Implicit((Object)(object)val) || val.isHeld || val.isHeldByEnemy || val.isPocketed || val.fallTime < 1f)
				{
					continue;
				}
				Vector3 position = ((Component)val).transform.position;
				if (!FindSegment(pts, position, 0.85f, out var seg, out var t))
				{
					continue;
				}
				Vector3 val2 = pts[seg];
				Vector3 val3 = pts[seg + 1];
				Vector3 val4 = val3 - val2;
				Vector3 normalized = ((Vector3)(ref val4)).normalized;
				Vector3 val5 = Flat(position - (val2 + (val3 - val2) * t));
				Vector3 val6 = position + normalized * num - val5 * Mathf.Min(1f, 3f * Time.deltaTime);
				float num2 = Vector3.Dot(Flat(val6 - val2), Flat(val3 - val2));
				val4 = Flat(val3 - val2);
				float num3 = num2 / ((Vector3)(ref val4)).sqrMagnitude;
				if (seg == pts.Length - 2 && num3 > 1f)
				{
					((Component)val).transform.position = val3 + normalized * 1.05f + Vector3.up * 0.2f;
					val4 = default(Vector3);
					val.FallToGround(false, false, val4);
					continue;
				}
				val6.y = Mathf.Lerp(val2.y, val3.y, Mathf.Clamp01(num3)) + val.itemProperties.verticalOffset;
				((Component)val).transform.position = val6;
				if ((Object)(object)((Component)val).transform.parent != (Object)null)
				{
					val4 = (val.targetFloorPosition = (val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(val6)));
				}
			}
		}

		internal static bool FindSegment(Vector3[] path, Vector3 p, float halfWidth, out int seg, out float t)
		{
			//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_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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008f: 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_00bf: 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)
			for (seg = path.Length - 2; seg >= 0; seg--)
			{
				Vector3 val = path[seg];
				Vector3 val2 = Flat(path[seg + 1] - val);
				float magnitude = ((Vector3)(ref val2)).magnitude;
				float num = halfWidth / magnitude;
				t = Vector3.Dot(Flat(p - val), val2) / (magnitude * magnitude);
				if (!(t < 0f - num) && !(t > 1f + num))
				{
					Vector3 val3 = Flat(p - (val + (path[seg + 1] - val) * t));
					if (!(((Vector3)(ref val3)).magnitude > halfWidth))
					{
						float num2 = Mathf.Lerp(val.y, path[seg + 1].y, Mathf.Clamp01(t));
						if (!(p.y < num2 - 0.3f) && !(p.y > num2 + 1.2f))
						{
							return true;
						}
					}
				}
			}
			t = 0f;
			return false;
		}

		private static Vector3 Flat(Vector3 v)
		{
			//IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(v.x, 0f, v.z);
		}
	}
}