Decompiled source of LongerBelts v1.4.4

plugins/shisang_makuwa/LongerBelts.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LongerBelts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP Inc.")]
[assembly: AssemblyProduct("LongerBelts")]
[assembly: AssemblyCopyright("Copyright © HP Inc. 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d20c6a87-29e6-41cd-88de-8d808362c85c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LongerBelts;

[BepInPlugin("shisang_LongerBelts", "LongerBelts", "1.4.4")]
public class LongerBelts : BaseUnityPlugin
{
	private bool DisplayingWindow = false;

	private Rect windowRect = new Rect(200f, 200f, 600f, 400f);

	public static bool shortest_unlimit = false;

	public static float current_distance = 1.9f;

	public static float longitudeDistance = 1.75f;

	public static float latitudeDistance = 1.5f;

	private readonly float minimumGridDistance = 1f;

	private readonly float maxmumGridDistance = 3f;

	public static float minimum_distance = 0.400001f;

	private readonly float maxmum_distance = 2.302172f;

	public static int pathMode = 0;

	public static bool longerOnGrid = false;

	private int distance_units = 0;

	private Translate UItexture;

	public static float test;

	private ConfigEntry<KeyboardShortcut> SettingWindow { get; set; }

	private void Awake()
	{
		Harmony.CreateAndPatchAll(typeof(LongerBelts), (string)null);
		Debug.Log((object)"Add LongerBelts");
	}

	private void Start()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		SettingWindow = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("打开窗口快捷键/HotKey", "Key", new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)114 }), (ConfigDescription)null);
		Debug.Log((object)"快捷键已启用");
	}

	private void Update()
	{
		//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)
		KeyboardShortcut value = SettingWindow.Value;
		if (((KeyboardShortcut)(ref value)).IsDown())
		{
			DisplayingWindow = !DisplayingWindow;
		}
	}

	private void OnGUI()
	{
		//IL_000c: 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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_003f: 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)
		if (DisplayingWindow)
		{
			GUI.backgroundColor = Color.gray;
			UItexture = Translate.NewTexture();
			windowRect = GUI.Window(20231008, windowRect, new WindowFunction(SetLongerBelts), "LongerBelts");
		}
	}

	public void SetLongerBelts(int winId)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0477: Unknown result type (might be due to invalid IL or missing references)
		GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 20f));
		GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
		longerOnGrid = GUILayout.Toggle(longerOnGrid, UItexture.ifLongerOnGrid, Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(UItexture.longitudeDistance, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
		longitudeDistance = GUILayout.HorizontalSlider(longitudeDistance, minimumGridDistance, maxmumGridDistance, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
		string s = GUILayout.TextField(longitudeDistance.ToString("0.000"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		if (float.TryParse(s, out var result) && result < maxmumGridDistance && result > minimumGridDistance)
		{
			longitudeDistance = result;
		}
		GUILayout.Label(UItexture.latitudeDistance, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
		latitudeDistance = GUILayout.HorizontalSlider(latitudeDistance, minimumGridDistance, maxmumGridDistance, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
		s = GUILayout.TextField(latitudeDistance.ToString("0.000"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		if (float.TryParse(s, out result) && result < maxmumGridDistance && result > minimumGridDistance)
		{
			latitudeDistance = result;
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(UItexture.distance_setting, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
		current_distance = GUILayout.HorizontalSlider(current_distance, minimum_distance, maxmum_distance, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
		s = GUILayout.TextField(((distance_units == 1) ? (current_distance / 1.256637f) : current_distance).ToString("0.000000"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
		if (float.TryParse(s, out result))
		{
			if (distance_units == 1)
			{
				result *= 1.256637f;
			}
			if (result < maxmum_distance && result > minimum_distance)
			{
				current_distance = result;
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(UItexture.distance_units, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		distance_units = GUILayout.SelectionGrid(distance_units, UItexture.distance_unitsStrings, 2, GUIStyle.op_Implicit("toggle"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) });
		GUILayout.EndHorizontal();
		GUILayout.Label(UItexture.pathMode, Array.Empty<GUILayoutOption>());
		pathMode = GUILayout.SelectionGrid(pathMode, UItexture.pathModeStrings, 1, GUIStyle.op_Implicit("toggle"), Array.Empty<GUILayoutOption>());
		GUILayout.Label("", Array.Empty<GUILayoutOption>());
		GUILayout.Label(UItexture.WarningNotice, Array.Empty<GUILayoutOption>());
		shortest_unlimit = GUILayout.Toggle(shortest_unlimit, UItexture.unlimit_distance_instruction, Array.Empty<GUILayoutOption>());
		GUILayout.EndVertical();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(UItexture.unlimit_distance_setting, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(400f) });
		string s2 = GUILayout.TextField(((distance_units == 1) ? (current_distance / 1.256637f) : current_distance).ToString("0.000000"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
		if (float.TryParse(s2, out result) && shortest_unlimit)
		{
			if (distance_units == 1)
			{
				result *= 1.256637f;
			}
			if (result < 0.001f)
			{
				result = 0.001f;
			}
			if (result > 999f)
			{
				result = 999f;
			}
			current_distance = result;
		}
		GUILayout.EndHorizontal();
		EatInputInRect(windowRect);
	}

	public static void EatInputInRect(Rect eatRect)
	{
		//IL_001d: 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_0038: Unknown result type (might be due to invalid IL or missing references)
		if ((Input.GetMouseButton(0) || Input.GetMouseButtonDown(0)) && ((Rect)(ref eatRect)).Contains(new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y)))
		{
			Input.ResetInputAxes();
		}
	}

	[HarmonyPatch(typeof(PlanetGrid))]
	public static int LongerSnapLineNonAlloc(PlanetGrid __instance, Vector3 begin, Vector3 end, int path, Vector3[] snaps)
	{
		//IL_002e: 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_0040: 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_0059: 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_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_009b: 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_00ae: 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_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: 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_0252: 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_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: 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_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		int num = snaps.Length - 10;
		if (num <= 0)
		{
			return 0;
		}
		((Vector3)(ref begin)).Normalize();
		((Vector3)(ref end)).Normalize();
		float num2 = Mathf.Asin(begin.y);
		float num3 = Mathf.Atan2(begin.x, 0f - begin.z);
		float num4 = Mathf.Asin(end.y);
		float num5 = Mathf.Atan2(end.x, 0f - end.z);
		float num6 = Mathf.Repeat(num5 - num3, 6.283185f);
		float num7 = Mathf.Max(Mathf.Abs(num2), Mathf.Abs(num4));
		Vector3 normalized = ((Vector3)(ref begin)).normalized;
		Vector3 normalized2 = ((Vector3)(ref end)).normalized;
		int result = 0;
		snaps[result++] = normalized;
		if ((double)num6 > 3.14159274101257)
		{
			num6 -= 6.283185f;
		}
		Vector3 val2;
		if (path == 1)
		{
			float num8 = PlanetGrid.DetermineLongitudeSegmentCount(Mathf.FloorToInt(Mathf.Max(0f, Mathf.Abs(num2 / 6.283185f * (float)__instance.segment) - 0.1f)), __instance.segment);
			if ((Mathf.Abs(num6) - (float)Math.PI / 2f) * num8 > ((float)Math.PI / 2f - num7) * 200f)
			{
				num6 = ((!(num6 > 0f)) ? (num6 + 3.141593f) : (num6 - 3.141593f));
				num4 = (((double)num4 < 0.0) ? (-3.141593f - num4) : (3.141593f - num4));
			}
			float num9 = num3 + num6;
			float num10 = num4 - num2;
			int num11 = (int)(Mathf.Abs(num6) / ((float)Math.PI * 2f / 5f) * num8 / latitudeDistance) + 1;
			test = num8;
			int num12 = (int)(Mathf.Abs(num10) / 0.0062831854f / longitudeDistance) + 1;
			float num13 = Mathf.Cos(num2);
			for (int i = 1; i <= num11; i++)
			{
				float num14 = num6 * (float)i / (float)num11;
				snaps[result++] = new Vector3(num13 * Mathf.Sin(num3 + num14), Mathf.Sin(num2), (0f - num13) * Mathf.Cos(num3 + num14));
			}
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(num13 * Mathf.Sin(num9), Mathf.Sin(num2), (0f - num13) * Mathf.Cos(num9));
			val2 = normalized2 - val;
			if (((Vector3)(ref val2)).magnitude < 0.00251f)
			{
				return result;
			}
			for (int j = 1; j <= num12; j++)
			{
				float num15 = (float)j / (float)num12;
				int num16 = result++;
				val2 = Vector3.Slerp(val, normalized2, num15);
				snaps[num16] = ((Vector3)(ref val2)).normalized;
			}
			return result;
		}
		float num17 = PlanetGrid.DetermineLongitudeSegmentCount(Mathf.FloorToInt(Mathf.Max(0f, Mathf.Abs(num4 / 6.283185f * (float)__instance.segment) - 0.1f)), __instance.segment);
		if ((Mathf.Abs(num6) - (float)Math.PI / 2f) * num17 > ((float)Math.PI / 2f - num7) * 200f)
		{
			num6 = ((!(num6 > 0f)) ? (num6 + 3.141593f) : (num6 - 3.141593f));
			num4 = (((double)num4 < 0.0) ? (-3.141593f - num4) : (3.141593f - num4));
		}
		float num18 = num4 - num2;
		int num19 = (int)(Mathf.Abs(num6) / ((float)Math.PI * 2f / 5f) * num17 / latitudeDistance) + 1;
		int num20 = (int)(Mathf.Abs(num18) / 0.0062831854f / longitudeDistance) + 1;
		float num21 = Mathf.Cos(num4);
		Vector3 val3 = default(Vector3);
		((Vector3)(ref val3))..ctor(num21 * Mathf.Sin(num3), Mathf.Sin(num4), (0f - num21) * Mathf.Cos(num3));
		for (int k = 1; k <= num20; k++)
		{
			float num22 = (float)k / (float)num20;
			int num23 = result++;
			val2 = Vector3.Slerp(normalized, val3, num22);
			snaps[num23] = ((Vector3)(ref val2)).normalized;
		}
		if (Mathf.Abs(num6) / ((float)Math.PI * 2f / 5f) * num17 < 0.4f)
		{
			return result;
		}
		for (int l = 1; l <= num19; l++)
		{
			float num24 = num3 + (float)l / (float)num19 * num6;
			snaps[result++] = new Vector3(num21 * Mathf.Sin(num24), Mathf.Sin(num4), (0f - num21) * Mathf.Cos(num24));
		}
		return result;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(PlanetAuxData), "SnapLineNonAlloc")]
	public static bool PlanetAuxData_SnapLineNonAlloc_Prefix(PlanetAuxData __instance, Vector3 begin, Vector3 end, int path, bool geodesic, bool begin_flat, Vector3[] snaps, ref int __result)
	{
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03db: Unknown result type (might be due to invalid IL or missing references)
		//IL_03df: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_005f: 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_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: 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_0408: 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_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_042a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_043a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0445: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_044f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_045d: Unknown result type (might be due to invalid IL or missing references)
		//IL_045f: 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_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0480: Unknown result type (might be due to invalid IL or missing references)
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0490: Unknown result type (might be due to invalid IL or missing references)
		//IL_049b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b5: 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_0677: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0683: Unknown result type (might be due to invalid IL or missing references)
		//IL_068e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Unknown result type (might be due to invalid IL or missing references)
		//IL_0699: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04db: Unknown result type (might be due to invalid IL or missing references)
		//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0531: Unknown result type (might be due to invalid IL or missing references)
		//IL_0533: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_0354: 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_01ac: 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_0555: Unknown result type (might be due to invalid IL or missing references)
		//IL_0557: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0585: Unknown result type (might be due to invalid IL or missing references)
		//IL_0587: Unknown result type (might be due to invalid IL or missing references)
		//IL_058c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0375: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: 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_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: 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_0220: 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_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0784: Unknown result type (might be due to invalid IL or missing references)
		//IL_078b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0790: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		int num2 = snaps.Length - 10;
		if (num2 == 0)
		{
			__result = 0;
			return false;
		}
		Array.Clear(snaps, 0, snaps.Length);
		if (__instance.activeGrid == null)
		{
			geodesic = true;
		}
		Vector3 val;
		if (!geodesic)
		{
			num = ((!longerOnGrid) ? __instance.activeGrid.SnapLineNonAlloc(begin, end, path, snaps) : LongerSnapLineNonAlloc(__instance.activeGrid, begin, end, path, snaps));
		}
		else if (path == 2)
		{
			float num3 = ((((Vector3)(ref begin)).magnitude > ((Vector3)(ref end)).magnitude) ? ((Vector3)(ref begin)).magnitude : ((Vector3)(ref end)).magnitude);
			Vector3 normalized = ((Vector3)(ref begin)).normalized;
			Vector3 normalized2 = ((Vector3)(ref end)).normalized;
			float num4 = Mathf.Acos(Mathf.Clamp(Vector3.Dot(normalized, normalized2), -1f, 1f)) * num3;
			float num6;
			int num7;
			if (pathMode == 1)
			{
				float magnitude = ((Vector3)(ref begin)).magnitude;
				float magnitude2 = ((Vector3)(ref end)).magnitude;
				float num5 = Mathf.Abs(magnitude2 - magnitude);
				num6 = Mathf.Sqrt(num4 * num4 + num5 * num5) / current_distance;
				if (!shortest_unlimit && Mathf.Sqrt(num4 * num4 + num5 * num5) / (float)((int)num6 + 1) < minimum_distance)
				{
					num6 = Mathf.Sqrt(num4 * num4 + num5 * num5) / minimum_distance - 1f;
				}
				num7 = (((double)num6 > 0.1) ? ((int)num6 + 1) : 0);
				if (num7 == 0)
				{
					snaps[num++] = normalized;
					if ((double)Mathf.Abs(magnitude - magnitude2) > 0.001)
					{
						snaps[num++] = snaps[0] * magnitude2;
						__result = num;
						return false;
					}
				}
				else
				{
					for (int i = 0; i <= num7; i++)
					{
						if (num >= num2)
						{
							break;
						}
						float num8 = (float)i / (float)num7;
						int num9 = num++;
						val = Vector3.Slerp(normalized, normalized2, num8);
						snaps[num9] = ((Vector3)(ref val)).normalized;
					}
				}
				for (int j = 0; j < num; j++)
				{
					ref Vector3 reference = ref snaps[j];
					reference *= magnitude * (float)(num - 1 - j) / (float)(num - 1) + magnitude2 * (float)j / (float)(num - 1);
				}
				__result = num;
				return false;
			}
			num6 = num4 / current_distance;
			if (!shortest_unlimit && Mathf.Acos(Vector3.Dot(normalized, normalized2)) * ((((Vector3)(ref begin)).magnitude < num3) ? ((Vector3)(ref begin)).magnitude : ((Vector3)(ref end)).magnitude) / (float)((int)num6 + 1) < minimum_distance)
			{
				num6 = Mathf.Acos(Vector3.Dot(normalized, normalized2)) * ((((Vector3)(ref begin)).magnitude < num3) ? ((Vector3)(ref begin)).magnitude : ((Vector3)(ref end)).magnitude) / minimum_distance - 1f;
			}
			num7 = (((double)num6 > 0.1) ? ((int)num6 + 1) : 0);
			if (num7 == 0)
			{
				snaps[num++] = normalized;
			}
			else
			{
				for (int k = 0; k <= num7; k++)
				{
					if (num >= num2)
					{
						break;
					}
					float num10 = (float)k / (float)num7;
					int num11 = num++;
					val = Vector3.Slerp(normalized, normalized2, num10);
					snaps[num11] = ((Vector3)(ref val)).normalized;
				}
			}
		}
		else
		{
			VectorLF3 val2 = VectorLF3.op_Implicit(begin);
			VectorLF3 val3 = VectorLF3.op_Implicit(end);
			VectorLF3 val4 = val3 - val2;
			VectorLF3 normalized3 = ((VectorLF3)(ref val2)).normalized;
			val3 = ((VectorLF3)(ref val3)).normalized;
			VectorLF3 normalized4 = ((VectorLF3)(ref val4)).normalized;
			double num12 = ((__instance.activeGrid != null) ? ((double)__instance.activeGrid.CalcLocalGridSize(VectorLF3.op_Implicit(normalized3), VectorLF3.op_Implicit(normalized4))) : (Math.PI / 500.0));
			float num13;
			VectorLF3 val5;
			if (__instance.activeGrid == null)
			{
				num13 = 0.0062831854f;
			}
			else
			{
				PlanetGrid activeGrid = __instance.activeGrid;
				val5 = normalized3 * 0.7 + val3 * 0.3;
				num13 = activeGrid.CalcLocalGridSize(VectorLF3.op_Implicit(((VectorLF3)(ref val5)).normalized), VectorLF3.op_Implicit(normalized4));
			}
			float num14 = num13;
			float num15;
			if (__instance.activeGrid == null)
			{
				num15 = 0.0062831854f;
			}
			else
			{
				PlanetGrid activeGrid2 = __instance.activeGrid;
				val5 = normalized3 * 0.3 + val3 * 0.7;
				num15 = activeGrid2.CalcLocalGridSize(VectorLF3.op_Implicit(((VectorLF3)(ref val5)).normalized), VectorLF3.op_Implicit(-normalized4));
			}
			float num16 = num15;
			float num17 = ((__instance.activeGrid != null) ? __instance.activeGrid.CalcLocalGridSize(VectorLF3.op_Implicit(val3), VectorLF3.op_Implicit(-normalized4)) : 0.0062831854f);
			double num18 = num14;
			float num19 = (float)((num12 + num18 + (double)num16 + (double)num17) / 4.0);
			if ((double)num19 < 0.00400000018998981)
			{
				num19 = 0.004f;
			}
			VectorLF3 val6 = val3 - normalized3;
			double num20;
			if ((num20 = ((VectorLF3)(ref val6)).magnitude) > 0.01)
			{
				num20 = Math.Acos(VectorLF3.Dot(normalized3, val3));
			}
			int num21 = Mathf.RoundToInt((float)num20 / num19);
			if (num21 == 0)
			{
				snaps[num++] = VectorLF3.op_Implicit(normalized3);
			}
			else
			{
				for (int l = 0; l <= num21; l++)
				{
					if (num >= num2)
					{
						break;
					}
					float num22 = (float)l / (float)num21;
					int num23 = num++;
					val = Vector3.Slerp(VectorLF3.op_Implicit(normalized3), VectorLF3.op_Implicit(val3), num22);
					snaps[num23] = ((Vector3)(ref val)).normalized;
				}
			}
		}
		float magnitude3 = ((Vector3)(ref begin)).magnitude;
		float magnitude4 = ((Vector3)(ref end)).magnitude;
		if (num == 1 && (double)Mathf.Abs(magnitude3 - magnitude4) > 0.001)
		{
			float num24 = (float)((double)Mathf.Max(0f, Mathf.Floor((float)(((double)magnitude4 - (double)__instance.planet.radius) / 1.33333325386047))) * 1.33333325386047 + (double)__instance.planet.radius + 0.200000002980232);
			int num25 = 2;
			snaps[1] = snaps[0] * num24;
			snaps[0] = snaps[0] * magnitude3;
			__result = num25;
			return false;
		}
		int num26 = Mathf.RoundToInt((float)((double)Mathf.Abs(magnitude4 - magnitude3) / 1.33333325386047 * 2.0 + 1.0));
		int num27 = ((num26 < num) ? num26 : num) - 1;
		if (num27 <= 0)
		{
			num27 = 1;
		}
		int num28 = ((num > num27 + 1 && begin_flat) ? 1 : 0);
		for (int m = 0; m < num; m++)
		{
			float num29 = ((num27 > 0) ? ((float)(m - num28) / (float)num27) : 0f);
			if ((double)num29 < 0.0)
			{
				num29 = 0f;
			}
			if ((double)num29 > 1.0)
			{
				num29 = 1f;
			}
			float num30 = (float)((double)magnitude3 * (1.0 - (double)num29) + (double)magnitude4 * (double)num29);
			snaps[m] *= num30;
		}
		__result = num;
		return false;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(BuildTool_Path), "DeterminePreviews")]
	public static bool BuildTool_Path_DeterminePreviews_Prefix(BuildTool_Path __instance)
	{
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_2261: Unknown result type (might be due to invalid IL or missing references)
		//IL_2266: 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_019f: 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_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
		//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_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: 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_03f4: 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_03fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_1558: Unknown result type (might be due to invalid IL or missing references)
		//IL_155d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1582: Unknown result type (might be due to invalid IL or missing references)
		//IL_1584: Unknown result type (might be due to invalid IL or missing references)
		//IL_1589: Unknown result type (might be due to invalid IL or missing references)
		//IL_158b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1590: Unknown result type (might be due to invalid IL or missing references)
		//IL_1592: Unknown result type (might be due to invalid IL or missing references)
		//IL_1597: Unknown result type (might be due to invalid IL or missing references)
		//IL_159c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1574: Unknown result type (might be due to invalid IL or missing references)
		//IL_1579: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_046f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0474: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_0484: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_0497: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04af: Unknown result type (might be due to invalid IL or missing references)
		//IL_0936: Unknown result type (might be due to invalid IL or missing references)
		//IL_0938: Unknown result type (might be due to invalid IL or missing references)
		//IL_093d: Unknown result type (might be due to invalid IL or missing references)
		//IL_093f: Unknown result type (might be due to invalid IL or missing references)
		//IL_094d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0952: Unknown result type (might be due to invalid IL or missing references)
		//IL_0957: Unknown result type (might be due to invalid IL or missing references)
		//IL_095c: Unknown result type (might be due to invalid IL or missing references)
		//IL_095e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0960: Unknown result type (might be due to invalid IL or missing references)
		//IL_096e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0973: Unknown result type (might be due to invalid IL or missing references)
		//IL_0978: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0888: Unknown result type (might be due to invalid IL or missing references)
		//IL_088a: Unknown result type (might be due to invalid IL or missing references)
		//IL_19ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_19f6: Expected O, but got Unknown
		//IL_0d79: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d7d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d8e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d90: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d92: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
		//IL_0982: Unknown result type (might be due to invalid IL or missing references)
		//IL_0984: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d4c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d4e: Unknown result type (might be due to invalid IL or missing references)
		//IL_050c: Unknown result type (might be due to invalid IL or missing references)
		//IL_050e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0511: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_0532: Unknown result type (might be due to invalid IL or missing references)
		//IL_0537: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ec: 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_167b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1682: Unknown result type (might be due to invalid IL or missing references)
		//IL_1687: Unknown result type (might be due to invalid IL or missing references)
		//IL_168c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dad: Unknown result type (might be due to invalid IL or missing references)
		//IL_0daf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db4: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_09da: Unknown result type (might be due to invalid IL or missing references)
		//IL_09dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_09fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a00: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_099b: Unknown result type (might be due to invalid IL or missing references)
		//IL_099d: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0997: Unknown result type (might be due to invalid IL or missing references)
		//IL_053c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1723: Unknown result type (might be due to invalid IL or missing references)
		//IL_1725: Unknown result type (might be due to invalid IL or missing references)
		//IL_16be: Unknown result type (might be due to invalid IL or missing references)
		//IL_16c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a05: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0552: Unknown result type (might be due to invalid IL or missing references)
		//IL_0554: 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_0542: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_0546: Unknown result type (might be due to invalid IL or missing references)
		//IL_054b: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_175e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1760: Unknown result type (might be due to invalid IL or missing references)
		//IL_1773: Unknown result type (might be due to invalid IL or missing references)
		//IL_1775: Unknown result type (might be due to invalid IL or missing references)
		//IL_16f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_16fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_16fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_1702: Unknown result type (might be due to invalid IL or missing references)
		//IL_1704: Unknown result type (might be due to invalid IL or missing references)
		//IL_1709: Unknown result type (might be due to invalid IL or missing references)
		//IL_170b: Unknown result type (might be due to invalid IL or missing references)
		//IL_170d: Unknown result type (might be due to invalid IL or missing references)
		//IL_170f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1714: Unknown result type (might be due to invalid IL or missing references)
		//IL_0de5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0de7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0de9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a0d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a14: Unknown result type (might be due to invalid IL or missing references)
		//IL_055b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1a9b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aa0: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aa9: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aae: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a24: Unknown result type (might be due to invalid IL or missing references)
		//IL_056d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0564: Unknown result type (might be due to invalid IL or missing references)
		//IL_0566: Unknown result type (might be due to invalid IL or missing references)
		//IL_1834: Unknown result type (might be due to invalid IL or missing references)
		//IL_1836: Unknown result type (might be due to invalid IL or missing references)
		//IL_1796: Unknown result type (might be due to invalid IL or missing references)
		//IL_1798: Unknown result type (might be due to invalid IL or missing references)
		//IL_179a: Unknown result type (might be due to invalid IL or missing references)
		//IL_179f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e40: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e42: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a36: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2f: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_18e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_18e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1866: Unknown result type (might be due to invalid IL or missing references)
		//IL_1868: Unknown result type (might be due to invalid IL or missing references)
		//IL_186a: Unknown result type (might be due to invalid IL or missing references)
		//IL_186f: Unknown result type (might be due to invalid IL or missing references)
		//IL_17dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_17de: Unknown result type (might be due to invalid IL or missing references)
		//IL_17ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_17ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_17ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_17f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_17fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f1e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f20: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e6a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e6c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e6e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e7d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a6f: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05af: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1909: Unknown result type (might be due to invalid IL or missing references)
		//IL_190e: Unknown result type (might be due to invalid IL or missing references)
		//IL_191a: Unknown result type (might be due to invalid IL or missing references)
		//IL_191f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1921: Unknown result type (might be due to invalid IL or missing references)
		//IL_1923: Unknown result type (might be due to invalid IL or missing references)
		//IL_1925: Unknown result type (might be due to invalid IL or missing references)
		//IL_192a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1897: Unknown result type (might be due to invalid IL or missing references)
		//IL_1899: Unknown result type (might be due to invalid IL or missing references)
		//IL_189b: Unknown result type (might be due to invalid IL or missing references)
		//IL_18a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_18aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_18bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_18bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_102e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f7d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f7f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f8e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f48: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f4c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f56: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f5b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ed9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0edb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eaa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eb4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0eb9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a81: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1166: Unknown result type (might be due to invalid IL or missing references)
		//IL_1168: Unknown result type (might be due to invalid IL or missing references)
		//IL_108b: Unknown result type (might be due to invalid IL or missing references)
		//IL_108d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1094: Unknown result type (might be due to invalid IL or missing references)
		//IL_1099: Unknown result type (might be due to invalid IL or missing references)
		//IL_10b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_10ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_10c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_10c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1058: Unknown result type (might be due to invalid IL or missing references)
		//IL_105a: Unknown result type (might be due to invalid IL or missing references)
		//IL_105c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1066: Unknown result type (might be due to invalid IL or missing references)
		//IL_106b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fe9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0feb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fb6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fb8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a83: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a8c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a91: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_1286: Unknown result type (might be due to invalid IL or missing references)
		//IL_1288: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_11e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_11e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_1190: Unknown result type (might be due to invalid IL or missing references)
		//IL_1192: Unknown result type (might be due to invalid IL or missing references)
		//IL_1194: Unknown result type (might be due to invalid IL or missing references)
		//IL_119e: Unknown result type (might be due to invalid IL or missing references)
		//IL_11a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1121: Unknown result type (might be due to invalid IL or missing references)
		//IL_1123: Unknown result type (might be due to invalid IL or missing references)
		//IL_10ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_10f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_10f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_10fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_1101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0600: Unknown result type (might be due to invalid IL or missing references)
		//IL_1977: Unknown result type (might be due to invalid IL or missing references)
		//IL_1979: Unknown result type (might be due to invalid IL or missing references)
		//IL_1980: Unknown result type (might be due to invalid IL or missing references)
		//IL_1985: Unknown result type (might be due to invalid IL or missing references)
		//IL_198a: Unknown result type (might be due to invalid IL or missing references)
		//IL_13d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_13da: Unknown result type (might be due to invalid IL or missing references)
		//IL_12e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_12e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_1304: Unknown result type (might be due to invalid IL or missing references)
		//IL_1306: Unknown result type (might be due to invalid IL or missing references)
		//IL_1308: Unknown result type (might be due to invalid IL or missing references)
		//IL_1312: Unknown result type (might be due to invalid IL or missing references)
		//IL_1317: Unknown result type (might be due to invalid IL or missing references)
		//IL_1336: Unknown result type (might be due to invalid IL or missing references)
		//IL_1338: Unknown result type (might be due to invalid IL or missing references)
		//IL_12b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_12b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_12b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_12be: Unknown result type (might be due to invalid IL or missing references)
		//IL_12c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1241: Unknown result type (might be due to invalid IL or missing references)
		//IL_1243: Unknown result type (might be due to invalid IL or missing references)
		//IL_120e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1210: Unknown result type (might be due to invalid IL or missing references)
		//IL_1212: Unknown result type (might be due to invalid IL or missing references)
		//IL_121c: Unknown result type (might be due to invalid IL or missing references)
		//IL_1221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ac9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0622: Unknown result type (might be due to invalid IL or missing references)
		//IL_0614: Unknown result type (might be due to invalid IL or missing references)
		//IL_1435: Unknown result type (might be due to invalid IL or missing references)
		//IL_1437: Unknown result type (might be due to invalid IL or missing references)
		//IL_143e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1443: Unknown result type (might be due to invalid IL or missing references)
		//IL_1462: Unknown result type (might be due to invalid IL or missing references)
		//IL_1464: Unknown result type (might be due to invalid IL or missing references)
		//IL_1466: Unknown result type (might be due to invalid IL or missing references)
		//IL_1470: Unknown result type (might be due to invalid IL or missing references)
		//IL_1475: Unknown result type (might be due to invalid IL or missing references)
		//IL_1494: Unknown result type (might be due to invalid IL or missing references)
		//IL_1496: Unknown result type (might be due to invalid IL or missing references)
		//IL_149d: Unknown result type (might be due to invalid IL or missing references)
		//IL_14a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_1402: Unknown result type (might be due to invalid IL or missing references)
		//IL_1404: Unknown result type (might be due to invalid IL or missing references)
		//IL_1406: Unknown result type (might be due to invalid IL or missing references)
		//IL_1410: Unknown result type (might be due to invalid IL or missing references)
		//IL_1415: Unknown result type (might be due to invalid IL or missing references)
		//IL_1393: Unknown result type (might be due to invalid IL or missing references)
		//IL_1395: Unknown result type (might be due to invalid IL or missing references)
		//IL_1360: Unknown result type (might be due to invalid IL or missing references)
		//IL_1362: Unknown result type (might be due to invalid IL or missing references)
		//IL_1364: Unknown result type (might be due to invalid IL or missing references)
		//IL_136e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aeb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0add: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Unknown result type (might be due to invalid IL or missing references)
		//IL_14fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_14ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_14ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_14cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_14ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_14d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_14dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b02: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c4: 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_0b6d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b6f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b8d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b8f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		//IL_0768: Unknown result type (might be due to invalid IL or missing references)
		//IL_076d: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0776: Unknown result type (might be due to invalid IL or missing references)
		//IL_0778: Unknown result type (might be due to invalid IL or missing references)
		//IL_077d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0782: Unknown result type (might be due to invalid IL or missing references)
		//IL_0786: Unknown result type (might be due to invalid IL or missing references)
		//IL_078b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0797: Unknown result type (might be due to invalid IL or missing references)
		//IL_0799: Unknown result type (might be due to invalid IL or missing references)
		//IL_079e: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c2f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c31: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c36: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c38: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c3f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c41: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c46: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c4b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c4f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c60: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c62: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c67: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c6c: Unknown result type (might be due to invalid IL or missing references)
		//IL_07be: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c87: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c8c: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1c82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c98: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c9a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e58: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e74: Unknown result type (might be due to invalid IL or missing references)
		//IL_1e9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1cc0: Unknown result type (might be due to invalid IL or missing references)
		//IL_1f8a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d69: Unknown result type (might be due to invalid IL or missing references)
		//IL_1fa7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0854: Unknown result type (might be due to invalid IL or missing references)
		//IL_0856: Unknown result type (might be due to invalid IL or missing references)
		//IL_0858: Unknown result type (might be due to invalid IL or missing references)
		//IL_085a: Unknown result type (might be due to invalid IL or missing references)
		//IL_1fd4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d19: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d1d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d1f: Unknown result type (might be due to invalid IL or missing references)
		//IL_21dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_2206: Unknown result type (might be due to invalid IL or missing references)
		//IL_2230: Unknown result type (might be due to invalid IL or missing references)
		__instance.waitForConfirm = false;
		bool flag = false;
		if (VFInput._liftBeltsHeight)
		{
			__instance.altitude++;
		}
		if (VFInput._reduceBeltsHeight)
		{
			__instance.altitude--;
		}
		if (VFInput._beltsZeroKey)
		{
			__instance.altitude = 0;
		}
		if (__instance.altitude > 60)
		{
			__instance.altitude = 60;
		}
		else if (__instance.altitude < 0)
		{
			__instance.altitude = 0;
		}
		if (((BuildTool)__instance).factory.entityCount < 400 && ((BuildTool)__instance).gameData.factoryCount == 1)
		{
			((BuildTool)__instance).actionBuild.model.promptText = Localization.Translate("传送带建造提示0");
		}
		int castObjectId;
		bool flag4;
		bool flag5;
		bool flag6;
		bool flag7;
		bool flag9;
		bool flag10;
		Vector3 val2;
		Vector3 val3;
		Vector3 val4;
		int num3;
		Vector3 val5;
		Vector3 val6;
		int num4;
		Vector3 val7;
		Vector3 val8;
		int num5;
		int num6;
		Vector3 val25;
		if (((BuildTool)__instance).controller.cmd.stage == 0)
		{
			if (__instance.cursorValid)
			{
				while (((BuildTool)__instance).buildPreviews.Count < 1)
				{
					((BuildTool)__instance).buildPreviews.Add(new BuildPreview());
				}
				while (((BuildTool)__instance).buildPreviews.Count > 1)
				{
					((BuildTool)__instance).buildPreviews.RemoveAt(((BuildTool)__instance).buildPreviews.Count - 1);
				}
				BuildPreview val = ((BuildTool)__instance).buildPreviews[0];
				val.ResetAll();
				val.item = __instance.handItem;
				val.desc = __instance.handPrefabDesc;
				val.needModel = false;
				val.isConnNode = true;
				val.genNearColliderArea2 = 20f;
				val.inputObjId = __instance.castObjectId;
				val.lpos = __instance.cursorTarget;
				val.lpos2 = __instance.cursorTarget;
			}
			else
			{
				((BuildTool)__instance).buildPreviews.Clear();
			}
			((BuildTool)__instance).actionBuild.model.cursorText = Localization.Translate("选择起始位置");
			__instance.pathSuggest = 0;
		}
		else if (((BuildTool)__instance).controller.cmd.stage == 1 && __instance.cursorValid)
		{
			__instance.waitForConfirm = true;
			castObjectId = __instance.castObjectId;
			bool flag2 = __instance.startObjectId != 0 && !((BuildTool)__instance).ObjectIsBelt(__instance.startObjectId);
			bool flag3 = castObjectId != 0 && !((BuildTool)__instance).ObjectIsBelt(castObjectId);
			flag4 = __instance.startObjectId != 0 && ((BuildTool)__instance).ObjectIsAddonBuilding(__instance.startObjectId);
			flag5 = castObjectId != 0 && ((BuildTool)__instance).ObjectIsAddonBuilding(castObjectId);
			flag6 = __instance.startObjectId != 0 && ((BuildTool)__instance).ObjectIsBelt(__instance.startObjectId);
			flag7 = castObjectId != 0 && ((BuildTool)__instance).ObjectIsBelt(castObjectId);
			bool flag8 = __instance.startObjectId > 0;
			flag9 = castObjectId > 0;
			Pose[] array = ((!flag2) ? BuildTool.emptyPoseArr : (flag4 ? ((BuildTool)__instance).GetLocalAddonPose(__instance.startObjectId) : ((BuildTool)__instance).GetLocalPorts(__instance.startObjectId)));
			Pose[] array2 = ((!flag3) ? BuildTool.emptyPoseArr : (flag5 ? ((BuildTool)__instance).GetLocalAddonPose(castObjectId) : ((BuildTool)__instance).GetLocalPorts(castObjectId)));
			Vector3[] array3 = (flag4 ? ((BuildTool)__instance).GetLocalAddonExt(__instance.startObjectId) : BuildTool.emptyExtArr);
			Vector3[] array4 = (flag5 ? ((BuildTool)__instance).GetLocalAddonExt(castObjectId) : BuildTool.emptyExtArr);
			flag10 = array.Length != 0;
			bool flag11 = array2.Length != 0;
			int num = __instance.CalculateNearestAddonAreaIdx(castObjectId, __instance.castGroundPosSnapped);
			bool flag12 = __instance.startObjectId != 0 && __instance.startObjectId == castObjectId;
			int num2 = ((__instance.startObjectId != 0 || castObjectId != 0) ? ((__instance.startObjectId != castObjectId) ? 1 : 0) : 0);
			PrefabDesc prefabDesc = ((BuildTool)__instance).GetPrefabDesc(__instance.startObjectId);
			Pose objectPose = ((BuildTool)__instance).GetObjectPose(__instance.startObjectId);
			PrefabDesc prefabDesc2 = ((BuildTool)__instance).GetPrefabDesc(castObjectId);
			Pose objectPose2 = ((BuildTool)__instance).GetObjectPose(castObjectId);
			val2 = __instance.startTarget;
			val3 = __instance.cursorTarget;
			val4 = __instance.cursorTarget - __instance.startTarget;
			Vector3 normalized = ((Vector3)(ref val4)).normalized;
			num3 = -1;
			val5 = Vector3.zero;
			val6 = Vector3.zero;
			num4 = -1;
			val7 = Vector3.zero;
			val8 = Vector3.zero;
			if (num2 != 0)
			{
				num5 = 0;
				num6 = 0;
				if (flag10 || flag4)
				{
					float num7 = (float)((double)__instance.altitude * 1.33333325386047 + (double)((BuildTool)__instance).planet.realRadius + 0.200000002980232) - ((Vector3)(ref __instance.startTarget)).magnitude;
					float num8 = -100000f;
					for (int i = 0; i < array.Length; i++)
					{
						Vector3 val9 = objectPose.position + objectPose.rotation * array[i].position;
						Vector3 val10 = objectPose.rotation * ((Pose)(ref array[i])).forward;
						if (flag4)
						{
							val10 = (((double)Vector3.Dot(normalized, val10) < 0.0) ? (objectPose.rotation * -((Pose)(ref array[i])).forward) : val10);
						}
						Vector3 val11 = (flag4 ? (val9 + val10 * Mathf.Max(__instance.GetGridWidth(val9, val10), Mathf.Abs(array3[i].z))) : (val9 + val10 * 1.1f));
						Vector3 val12 = (flag4 ? (val11 - val9) : (val11 - objectPose.position));
						((BuildTool)__instance).VectorProjectN(ref val12, flag4 ? val9 : objectPose.position);
						float num9 = 0.04f - Mathf.Abs((float)(((double)num7 - (double)array[i].position.y) * 0.0399999991059303));
						Vector3 val13 = __instance.cursorTarget - (flag4 ? val9 : objectPose.position);
						Vector3 forward = ((Pose)(ref objectPose)).forward;
						Vector3 right = ((Pose)(ref objectPose)).right;
						Vector3 val14 = Maths.Forward(Maths.SphericalRotation(flag4 ? val9 : objectPose.position, 0f));
						float num10 = Vector3.Dot(forward, val14);
						float num11 = Vector3.Dot(right, val14);
						float num12 = Mathf.Asin(flag4 ? ((Vector3)(ref val9)).normalized.y : ((Vector3)(ref objectPose.position)).normalized.y);
						float num13 = (float)(((double)Mathf.Asin(((Vector3)(ref __instance.cursorTarget)).normalized.y) - (double)num12) * (flag4 ? ((double)((Vector3)(ref val9)).magnitude) : ((double)((Vector3)(ref objectPose.position)).magnitude)));
						if (__instance.geodesic || (double)Mathf.Abs(num12) > 1.4835000038147 || array.Length <= 4)
						{
							num10 = (num11 = 0f);
						}
						double num14 = Mathf.Lerp(Vector3.Dot(val13, forward), num13 * Mathf.Sign(num10), num10 * num10);
						float num15 = Mathf.Lerp(Vector3.Dot(val13, right), num13 * Mathf.Sign(num11), num11 * num11);
						float num16 = prefabDesc.buildCollider.ext.z + 1.25f;
						float num17 = prefabDesc.buildCollider.ext.x + 1.25f;
						if (array.Length >= 12)
						{
							num16 += 1.25f;
							num17 += 1.25f;
						}
						double num18 = 0.0 - (double)num16;
						double num19 = num16;
						double num20 = Mathf.Clamp((float)num14, (float)num18, (float)num19);
						float num21 = Mathf.Clamp(num15, 0f - num17, num17);
						Vector3 val15 = forward;
						val4 = (float)num20 * val15 + num21 * right;
						float num22 = Vector3.Dot(((Vector3)(ref val4)).normalized, val12) + num9;
						Vector3 val16 = Vector3.Cross(val9, Vector3.up);
						if ((double)((Vector3)(ref val16)).sqrMagnitude < 9.99999974737875E-05)
						{
							val16 = Vector3.zero;
						}
						else
						{
							((Vector3)(ref val16)).Normalize();
						}
						int num23 = (((double)Mathf.Abs(Vector3.Dot(val10, val16)) > 0.707000017166138) ? 1 : 2);
						float num24 = ((num23 != __instance.pathAlternative) ? (num22 - 0.08f) : (num22 + 0.08f));
						if (flag4)
						{
							num24 = ((i != __instance.startNearestAddonAreaIdx) ? (num24 - 0.16f) : (num24 + 0.16f));
						}
						if ((double)num24 > (double)num8)
						{
							num8 = num24;
							num3 = i;
							val5 = val9;
							val6 = val11;
							num5 = num23;
						}
					}
					if (num3 >= 0)
					{
						val2 = val6;
						if (flag8 && prefabDesc.isStation)
						{
							flag = true;
							UIBeltBuildTip beltBuildTip = __instance.uiGame.beltBuildTip;
							__instance.uiGame.OpenBeltBuildTip();
							beltBuildTip.SetOutputEntity(__instance.startObjectId, num3);
							beltBuildTip.position = val6;
							beltBuildTip.SetFilterToEntity();
						}
					}
				}
				if (flag11 || flag5)
				{
					float num25 = (float)((double)__instance.altitude * 1.33333325386047 + (double)((BuildTool)__instance).planet.realRadius + 0.200000002980232) - ((Vector3)(ref __instance.cursorTarget)).magnitude;
					float num26 = -100000f;
					for (int j = 0; j < array2.Length; j++)
					{
						Vector3 val17 = objectPose2.position + objectPose2.rotation * array2[j].position;
						Vector3 val18 = objectPose2.rotation * ((Pose)(ref array2[j])).forward;
						if (flag5)
						{
							val18 = (((double)Vector3.Dot(normalized, val18) > 0.0) ? (objectPose2.rotation * -((Pose)(ref array2[j])).forward) : val18);
						}
						Vector3 val19 = (flag5 ? (val17 + val18 * Mathf.Max(__instance.GetGridWidth(val17, val18), Mathf.Abs(array4[j].z))) : (val17 + val18 * 1.1f));
						Vector3 val20 = (flag5 ? (val19 - val17) : (val19 - objectPose2.position));
						((BuildTool)__instance).VectorProjectN(ref val20, flag5 ? val17 : objectPose2.position);
						float num27 = 0.04f - Mathf.Abs((float)(((double)num25 - (double)array2[j].position.y) * 0.0399999991059303));
						Vector3 val21 = __instance.startTarget - (flag5 ? val17 : objectPose2.position);
						Vector3 forward2 = ((Pose)(ref objectPose2)).forward;
						Vector3 right2 = ((Pose)(ref objectPose2)).right;
						Vector3 val22 = Maths.Forward(Maths.SphericalRotation(flag5 ? val17 : objectPose2.position, 0f));
						float num28 = Vector3.Dot(forward2, val22);
						float num29 = Vector3.Dot(right2, val22);
						float num30 = Mathf.Asin(flag5 ? ((Vector3)(ref val17)).normalized.y : ((Vector3)(ref objectPose2.position)).normalized.y);
						float num31 = (float)(((double)Mathf.Asin(((Vector3)(ref __instance.startTarget)).normalized.y) - (double)num30) * (flag5 ? ((double)((Vector3)(ref val17)).magnitude) : ((double)((Vector3)(ref objectPose2.position)).magnitude)));
						if (__instance.geodesic || (double)Mathf.Abs(num30) > 1.4835000038147 || array2.Length <= 4)
						{
							num28 = (num29 = 0f);
						}
						double num32 = Mathf.Lerp(Vector3.Dot(val21, forward2), num31 * Mathf.Sign(num28), num28 * num28);
						float num33 = Mathf.Lerp(Vector3.Dot(val21, right2), num31 * Mathf.Sign(num29), num29 * num29);
						float num34 = prefabDesc2.buildCollider.ext.z + 1.25f;
						float num35 = prefabDesc2.buildCollider.ext.x + 1.25f;
						if (array2.Length >= 12)
						{
							num34 += 1.25f;
							num35 += 1.25f;
						}
						double num36 = 0.0 - (double)num34;
						double num37 = num34;
						double num38 = Mathf.Clamp((float)num32, (float)num36, (float)num37);
						float num39 = Mathf.Clamp(num33, 0f - num35, num35);
						Vector3 val23 = forward2;
						val4 = (float)num38 * val23 + num39 * right2;
						float num40 = Vector3.Dot(((Vector3)(ref val4)).normalized, val20) + num27;
						Vector3 val24 = Vector3.Cross(val17, Vector3.up);
						if ((double)((Vector3)(ref val24)).sqrMagnitude < 9.99999974737875E-05)
						{
							val24 = Vector3.zero;
						}
						else
						{
							((Vector3)(ref val24)).Normalize();
						}
						int num41 = ((!((double)Mathf.Abs(Vector3.Dot(val18, val24)) > 0.707000017166138)) ? 1 : 2);
						float num42 = ((num41 != __instance.pathAlternative) ? (num40 - 0.08f) : (num40 + 0.08f));
						if (flag5)
						{
							num42 = ((j != num) ? (num42 - 0.16f) : (num42 + 0.16f));
						}
						if ((double)num42 > (double)num26)
						{
							num26 = num42;
							num4 = j;
							val7 = val17;
							val8 = val19;
							num6 = num41;
						}
					}
					if (num4 >= 0)
					{
						val3 = val8;
					}
				}
				if (!(flag10 || flag4) || !(flag11 || flag5) || num3 < 0 || num4 < 0)
				{
					goto IL_1518;
				}
				val25 = val5 - val7;
				double num43 = ((Vector3)(ref val25)).magnitude;
				val25 = val6 - val8;
				float magnitude = ((Vector3)(ref val25)).magnitude;
				int num44;
				if (flag4)
				{
					val25 = val5 - val6;
					num44 = (((double)((Vector3)(ref val25)).magnitude > 1.10000002384186) ? 1 : 0);
				}
				else
				{
					num44 = 0;
				}
				bool flag13 = num44 != 0;
				int num45;
				if (flag5)
				{
					val25 = val7 - val8;
					num45 = (((double)((Vector3)(ref val25)).magnitude > 1.10000002384186) ? 1 : 0);
				}
				else
				{
					num45 = 0;
				}
				bool flag14 = num45 != 0;
				if (num43 < 1.70000004768372)
				{
					__instance.pathPointCount = 0;
					__instance.pathPoints[__instance.pathPointCount] = val5;
					__instance.pathPointCount++;
					if (flag13)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val5 + val6) * 0.5f;
						__instance.pathPointCount++;
					}
					if (flag14)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val7;
					__instance.pathPointCount++;
				}
				else if ((double)magnitude < 0.600000023841858)
				{
					__instance.pathPointCount = 0;
					__instance.pathPoints[__instance.pathPointCount] = val5;
					__instance.pathPointCount++;
					if (flag13)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val5 + val6) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = (val6 + val8) * 0.5f;
					__instance.pathPointCount++;
					if (flag14)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val7;
					__instance.pathPointCount++;
				}
				else if ((double)magnitude < 1.04999995231628)
				{
					__instance.pathPointCount = 0;
					__instance.pathPoints[__instance.pathPointCount] = val5;
					__instance.pathPointCount++;
					if (flag13)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val5 + val6) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = Vector3.Lerp(val6, val5, 0.1f);
					__instance.pathPointCount++;
					__instance.pathPoints[__instance.pathPointCount] = Vector3.Lerp(val8, val7, 0.1f);
					__instance.pathPointCount++;
					if (flag14)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val7;
					__instance.pathPointCount++;
				}
				else if ((double)magnitude < 1.70000004768372)
				{
					__instance.pathPointCount = 0;
					__instance.pathPoints[__instance.pathPointCount] = val5;
					__instance.pathPointCount++;
					if (flag13)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val5 + val6) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val6;
					__instance.pathPointCount++;
					__instance.pathPoints[__instance.pathPointCount] = val8;
					__instance.pathPointCount++;
					if (flag14)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val7;
					__instance.pathPointCount++;
				}
				else if ((double)magnitude < 2.79999995231628)
				{
					__instance.pathPointCount = 0;
					__instance.pathPoints[__instance.pathPointCount] = val5;
					__instance.pathPointCount++;
					if (flag13)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val5 + val6) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val6;
					__instance.pathPointCount++;
					__instance.pathPoints[__instance.pathPointCount] = (val6 + val8) * 0.5f;
					__instance.pathPointCount++;
					__instance.pathPoints[__instance.pathPointCount] = val8;
					__instance.pathPointCount++;
					if (flag14)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val7;
					__instance.pathPointCount++;
				}
				else
				{
					if (!((double)magnitude < 3.20000004768372))
					{
						goto IL_1518;
					}
					__instance.pathPointCount = 0;
					__instance.pathPoints[__instance.pathPointCount] = val5;
					__instance.pathPointCount++;
					if (flag13)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val5 + val6) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = Vector3.LerpUnclamped(val6, val5, -0.15f);
					__instance.pathPointCount++;
					__instance.pathPoints[__instance.pathPointCount] = (val6 + val8) * 0.5f;
					__instance.pathPointCount++;
					__instance.pathPoints[__instance.pathPointCount] = Vector3.LerpUnclamped(val8, val7, -0.15f);
					__instance.pathPointCount++;
					if (flag14)
					{
						__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
						__instance.pathPointCount++;
					}
					__instance.pathPoints[__instance.pathPointCount] = val7;
					__instance.pathPointCount++;
				}
			}
			else
			{
				if (!flag12)
				{
					goto IL_15a6;
				}
				__instance.pathPointCount = 1;
				Vector3 val26 = Vector3.zero;
				if (array.Length == 1)
				{
					val26 = array[0].position;
				}
				__instance.pathPoints[0] = objectPose.position + objectPose.rotation * val26;
			}
			goto IL_19f7;
		}
		goto IL_2238;
		IL_1518:
		__instance.pathSuggest = ((num5 > 0 && (num6 == 0 || num5 == num6)) ? num5 : ((num6 > 0 && (num5 == 0 || num5 == num6)) ? num6 : 0));
		goto IL_15a6;
		IL_18f7:
		for (int k = 0; k < __instance.pathPointCount - 1; k++)
		{
			Vector3 val27 = __instance.pathPoints[k];
			Vector3 val28 = __instance.pathPoints[k + 1];
			Vector3 val29 = val28 - val27;
			if (((double)((Vector3)(ref val29)).sqrMagnitude < 0.5 && (__instance.pathPointCount == 2 || !__instance.geodesic)) || (double)((Vector3)(ref val29)).sqrMagnitude < 9.999999747378752E-06)
			{
				__instance.pathPoints[k + 1] = val27 + val29 * 0.5f;
				Array.Copy(__instance.pathPoints, k + 1, __instance.pathPoints, k, __instance.pathPointCount - k - 1);
				__instance.pathPointCount--;
				k--;
			}
		}
		goto IL_19f7;
		IL_2238:
		if (((BuildTool)__instance).controller.cmd.stage == 0)
		{
			__instance.startObjectId = 0;
			__instance.startNearestAddonAreaIdx = 0;
			__instance.startTarget = Vector3.zero;
			__instance.pathPointCount = 0;
		}
		if (flag)
		{
			return false;
		}
		__instance.uiGame.beltBuildTip.SetOutputEntity(0, -1);
		__instance.uiGame.CloseBeltBuildTip();
		return false;
		IL_19f7:
		while (((BuildTool)__instance).buildPreviews.Count < __instance.pathPointCount)
		{
			((BuildTool)__instance).buildPreviews.Add(new BuildPreview());
		}
		while (((BuildTool)__instance).buildPreviews.Count > __instance.pathPointCount)
		{
			((BuildTool)__instance).buildPreviews.RemoveAt(((BuildTool)__instance).buildPreviews.Count - 1);
		}
		int count = ((BuildTool)__instance).buildPreviews.Count;
		int num46 = count - 1;
		for (int l = 0; l < count; l++)
		{
			BuildPreview val30 = ((BuildTool)__instance).buildPreviews[l];
			val30.ResetAll();
			val30.item = __instance.handItem;
			val30.desc = __instance.handPrefabDesc;
			val30.lpos = __instance.pathPoints[l];
			val30.lpos2 = val30.lpos;
			val30.needModel = false;
			val30.isConnNode = true;
			val30.genNearColliderArea2 = ((l % 6 == 0 || l == __instance.pathPointCount - 1) ? 25f : 0f);
		}
		for (int m = 0; m < count - 1; m++)
		{
			((BuildTool)__instance).buildPreviews[m].output = ((BuildTool)__instance).buildPreviews[m + 1];
			((BuildTool)__instance).buildPreviews[m].outputObjId = 0;
			((BuildTool)__instance).buildPreviews[m].outputFromSlot = 0;
			((BuildTool)__instance).buildPreviews[m].outputToSlot = 1;
			((BuildTool)__instance).buildPreviews[m].outputOffset = 0;
		}
		if (count > 0)
		{
			bool flag15 = false;
			bool flag16 = false;
			bool flag17 = default(bool);
			int num47 = default(int);
			int num48 = default(int);
			if (num3 >= 0 && !flag4)
			{
				((BuildTool)__instance).factory.ReadObjectConn(__instance.startObjectId, num3, ref flag17, ref num47, ref num48);
				if (num47 != 0)
				{
					flag15 = true;
				}
			}
			if (num4 >= 0 && !flag5)
			{
				((BuildTool)__instance).factory.ReadObjectConn(castObjectId, num4, ref flag17, ref num47, ref num48);
				if (num47 != 0)
				{
					flag16 = true;
				}
			}
			if (num3 >= 0)
			{
				PrefabDesc prefabDesc3 = ((BuildTool)__instance).GetPrefabDesc(__instance.startObjectId);
				if (prefabDesc3 != null && prefabDesc3.isPiler)
				{
					((BuildTool)__instance).factory.ReadObjectConn(__instance.startObjectId, 0, ref flag17, ref num47, ref num48);
					if (flag17 && num47 != 0)
					{
						((BuildTool)__instance).buildPreviews[0].condition = (EBuildCondition)26;
					}
					((BuildTool)__instance).factory.ReadObjectConn(__instance.startObjectId, 1, ref flag17, ref num47, ref num48);
					if (flag17 && num47 != 0)
					{
						((BuildTool)__instance).buildPreviews[0].condition = (EBuildCondition)26;
					}
				}
			}
			if (num4 >= 0)
			{
				PrefabDesc prefabDesc4 = ((BuildTool)__instance).GetPrefabDesc(castObjectId);
				if (prefabDesc4 != null && prefabDesc4.isPiler)
				{
					((BuildTool)__instance).factory.ReadObjectConn(castObjectId, 0, ref flag17, ref num47, ref num48);
					if (!flag17 && num47 != 0)
					{
						((BuildTool)__instance).buildPreviews[num46].condition = (EBuildCondition)26;
					}
					((BuildTool)__instance).factory.ReadObjectConn(castObjectId, 1, ref flag17, ref num47, ref num48);
					if (!flag17 && num47 != 0)
					{
						((BuildTool)__instance).buildPreviews[num46].condition = (EBuildCondition)26;
					}
				}
			}
			if (__instance.startObjectId != 0 && num3 >= 0)
			{
				if (flag4)
				{
					((BuildTool)__instance).buildPreviews[0].addonbp = null;
					((BuildTool)__instance).buildPreviews[0].addonObjId = __instance.startObjectId;
					((BuildTool)__instance).buildPreviews[0].addonAreaIdx = num3;
				}
				else
				{
					((BuildTool)__instance).buildPreviews[0].input = null;
					((BuildTool)__instance).buildPreviews[0].inputObjId = __instance.startObjectId;
					((BuildTool)__instance).buildPreviews[0].inputFromSlot = num3;
					((BuildTool)__instance).buildPreviews[0].inputToSlot = 1;
					((BuildTool)__instance).buildPreviews[0].inputOffset = 0;
				}
				if (((BuildTool)__instance).buildPreviews.Count < 2)
				{
					((BuildTool)__instance).buildPreviews[0].condition = (EBuildCondition)4;
				}
				if (flag15)
				{
					((BuildTool)__instance).buildPreviews[0].condition = (EBuildCondition)33;
					if (((BuildTool)__instance).buildPreviews.Count >= 2)
					{
						((BuildTool)__instance).buildPreviews[1].condition = (EBuildCondition)33;
					}
				}
			}
			if (castObjectId != 0 && num4 >= 0)
			{
				if (flag5)
				{
					((BuildTool)__instance).buildPreviews[num46].addonbp = null;
					((BuildTool)__instance).buildPreviews[num46].addonObjId = castObjectId;
					((BuildTool)__instance).buildPreviews[num46].addonAreaIdx = num4;
				}
				else
				{
					((BuildTool)__instance).buildPreviews[num46].output = null;
					((BuildTool)__instance).buildPreviews[num46].outputObjId = castObjectId;
					((BuildTool)__instance).buildPreviews[num46].outputFromSlot = 0;
					((BuildTool)__instance).buildPreviews[num46].outputToSlot = num4;
					((BuildTool)__instance).buildPreviews[num46].outputOffset = 0;
				}
				if (((BuildTool)__instance).buildPreviews.Count < 2)
				{
					((BuildTool)__instance).buildPreviews[num46].condition = (EBuildCondition)4;
				}
				if (flag16)
				{
					((BuildTool)__instance).buildPreviews[num46].condition = (EBuildCondition)33;
					if (((BuildTool)__instance).buildPreviews.Count >= 2)
					{
						((BuildTool)__instance).buildPreviews[num46 - 1].condition = (EBuildCondition)33;
					}
				}
			}
			if (flag6)
			{
				int objectProtoId = ((BuildTool)__instance).GetObjectProtoId(__instance.startObjectId);
				((BuildTool)__instance).buildPreviews[0].coverObjId = __instance.startObjectId;
				((BuildTool)__instance).buildPreviews[0].willRemoveCover = objectProtoId != ((Proto)((BuildTool)__instance).buildPreviews[0].item).ID;
			}
			if (flag7)
			{
				((BuildTool)__instance).GetObjectProtoId(castObjectId);
				((BuildTool)__instance).buildPreviews[num46].coverObjId = castObjectId;
				((BuildTool)__instance).buildPreviews[num46].willRemoveCover = false;
				if (count > 1)
				{
					if (flag9)
					{
						Array.Copy(((BuildTool)__instance).factory.entityConnPool, castObjectId * 16, __instance.tmp_conn, 0, 16);
					}
					else
					{
						Array.Copy(((BuildTool)__instance).factory.prebuildConnPool, -castObjectId * 16, __instance.tmp_conn, 0, 16);
					}
					if (__instance.tmp_conn[1] == 0)
					{
						((BuildTool)__instance).buildPreviews[num46 - 1].outputToSlot = 1;
					}
					else if (__instance.tmp_conn[2] == 0)
					{
						((BuildTool)__instance).buildPreviews[num46 - 1].outputToSlot = 2;
					}
					else if (__instance.tmp_conn[3] == 0)
					{
						((BuildTool)__instance).buildPreviews[num46 - 1].outputToSlot = 3;
					}
					else
					{
						((BuildTool)__instance).buildPreviews[num46 - 1].outputToSlot = 14;
					}
				}
			}
			if (flag6 && flag7 && count <= 2)
			{
				((BuildTool)__instance).buildPreviews[0].willRemoveCover = true;
				((BuildTool)__instance).buildPreviews[num46].willRemoveCover = true;
			}
			if (castObjectId != 0 && !flag7 && (((BuildTool)__instance).ObjectIsAddonBuilding(castObjectId) ? ((BuildTool)__instance).GetLocalAddonPose(castObjectId) : ((BuildTool)__instance).GetLocalPorts(castObjectId)).Length == 0)
			{
				((BuildTool)__instance).buildPreviews[num46].condition = (EBuildCondition)31;
				if (((BuildTool)__instance).buildPreviews.Count > 1)
				{
					((BuildTool)__instance).buildPreviews[num46 - 1].condition = (EBuildCondition)31;
				}
				if (((BuildTool)__instance).buildPreviews.Count > 2)
				{
					((BuildTool)__instance).buildPreviews[num46 - 2].condition = (EBuildCondition)31;
				}
			}
		}
		goto IL_2238;
		IL_15a6:
		if (VFInput._switchBeltsPath)
		{
			if (!__instance.geodesic)
			{
				if (__instance.pathSuggest > 0)
				{
					__instance.geodesic = true;
				}
				if (__instance.pathAlternative == 1)
				{
					__instance.pathAlternative = 2;
				}
				else
				{
					__instance.pathAlternative = 1;
					__instance.geodesic = true;
				}
			}
			else
			{
				if (__instance.pathSuggest > 0)
				{
					__instance.geodesic = false;
				}
				if (__instance.pathAlternative == 1)
				{
					__instance.pathAlternative = 2;
				}
				else
				{
					__instance.pathAlternative = 1;
					__instance.geodesic = false;
				}
			}
		}
		int num49 = ((__instance.pathSuggest > 0) ? __instance.pathSuggest : ((__instance.pathAlternative <= 0) ? 1 : __instance.pathAlternative));
		if (__instance.geodesic && num49 == 2)
		{
			val4 = ((Vector3)(ref val2)).normalized - ((Vector3)(ref val3)).normalized;
			if (((Vector3)(ref val4)).magnitude < 0.0001f)
			{
				Vector3 val31 = default(Vector3);
				((Vector3)(ref val31))..ctor(0f, 0.001f, 0f);
				if (Mathf.Abs(Vector3.Dot(((Vector3)(ref val2)).normalized, ((Vector3)(ref val31)).normalized)) > 0.99f)
				{
					((Vector3)(ref val31))..ctor(0.001f, 0f, 0f);
				}
				val31 = Vector3.Cross(val3 - val2, val31);
				val3 += val31;
			}
		}
		__instance.pathPointCount = ((BuildTool)__instance).actionBuild.planetAux.SnapLineNonAlloc(val2, val3, num49, __instance.geodesic, !(flag10 || flag4), __instance.pathPoints);
		if (__instance.pathPointCount > 0)
		{
			__instance.pathPoints[0] = val2;
			__instance.pathPoints[__instance.pathPointCount - 1] = val3;
		}
		if (num3 >= 0)
		{
			if (flag4)
			{
				val25 = val5 - val6;
				if ((double)((Vector3)(ref val25)).magnitude > 1.70000004768372)
				{
					Array.Copy(__instance.pathPoints, 0, __instance.pathPoints, 2, __instance.pathPointCount);
					__instance.pathPoints[0] = val5;
					__instance.pathPoints[1] = (val5 + val6) * 0.5f;
					__instance.pathPointCount += 2;
					goto IL_184a;
				}
			}
			Array.Copy(__instance.pathPoints, 0, __instance.pathPoints, 1, __instance.pathPointCount);
			__instance.pathPoints[0] = val5;
			__instance.pathPointCount++;
		}
		goto IL_184a;
		IL_184a:
		if (num4 >= 0)
		{
			if (flag5)
			{
				val25 = val7 - val8;
				if ((double)((Vector3)(ref val25)).magnitude > 1.70000004768372)
				{
					__instance.pathPoints[__instance.pathPointCount] = (val7 + val8) * 0.5f;
					__instance.pathPoints[__instance.pathPointCount + 1] = val7;
					__instance.pathPointCount += 2;
					goto IL_18f7;
				}
			}
			__instance.pathPoints[__instance.pathPointCount] = val7;
			__instance.pathPointCount++;
		}
		goto IL_18f7;
	}
}
internal class Translate
{
	public string ifLongerOnGrid;

	public string longitudeDistance;

	public string latitudeDistance;

	public string distance_setting;

	public string distance_units;

	public string[] distance_unitsStrings = new string[2] { "米", "格(赤道)" };

	public string pathMode;

	public string[] pathModeStrings = new string[2] { "原版升降逻辑(水平移动一格后每节升降0.5层至目标高度)", "\"均匀\"升降(端点不水平,常规游戏需先在两端拉好水平带\n建议配合如建筑铺设无条件等放宽传送带铺设条件的功能使用)" };

	public string WarningNotice;

	public string unlimit_distance_instruction;

	public string unlimit_distance_setting;

	public static Translate NewTexture()
	{
		Translate translate = new Translate();
		if (Localization.isZHCN)
		{
			translate.ifLongerOnGrid = "更改经纬线模式默认跨度";
			translate.longitudeDistance = "沿经线时跨度";
			translate.latitudeDistance = "沿纬线时跨度";
			translate.distance_setting = "最大间距设置";
			translate.distance_units = "单位:";
			translate.distance_unitsStrings[0] = "米";
			translate.distance_unitsStrings[1] = "格(赤道)";
			translate.pathMode = "传送带路径";
			translate.pathModeStrings[0] = "原版升降逻辑(水平移动一格后每节升降0.5层至目标高度)";
			translate.pathModeStrings[1] = "垂直等距分割(端点不水平,常规游戏需先在两端拉好水平带\n建议配合如建筑铺设无条件等放宽传送带铺设条件的功能使用)";
			translate.WarningNotice = "下列功能慎用!";
			translate.unlimit_distance_instruction = "勾选以启用弱约束间距输入框(常规游戏中会出现传送带过短或过长等错误\n即使使用无条件铺设也可能触发特殊bug,造出的蓝图也未必能用)";
			translate.unlimit_distance_setting = "弱约束间距输入框(配合铺设无条件作弊、测试用):";
		}
		else
		{
			translate.ifLongerOnGrid = "Change default span in gridline mode";
			translate.longitudeDistance = "Latitude Span";
			translate.latitudeDistance = "Longitude Span";
			translate.distance_setting = "Maximum Spacing(unit: meters, not grid)";
			translate.distance_units = "Units:";
			translate.distance_unitsStrings[0] = "meters";
			translate.distance_unitsStrings[1] = "Grid(At equator)";
			translate.pathMode = "Belt Path Mode";
			translate.pathModeStrings[0] = "Original elevating logic(moving horizontally one grid and changing\nelevation by 0.5 units per segment to reach the target height)";
			translate.pathModeStrings[1] = "Vertical equidistant(horizontal conveyor belts at both ends \n or other auxiliary mods are required)";
			translate.WarningNotice = "Exercise caution when modifying the following settings!";
			translate.unlimit_distance_instruction = "Check to enable the following input box(certain numbers can lead\nto errors such as belts being too short or too long during vanilla game.)";
			translate.unlimit_distance_setting = "Maximum Spacing(less constraints)";
		}
		return translate;
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "LongerBelts";

	public const string PLUGIN_NAME = "";

	public const string PLUGIN_VERSION = "1.0.0.0";
}