Decompiled source of FrankysExtraSpaces v1.0.0

FrankysExtraSpaces.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInExPlugin;
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("FrankysExtraSpaces (FrankysExtraSpaces)")]
[assembly: AssemblyProduct("FrankysExtraSpaces")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BepInExPlugin
{
	[BepInPlugin("FrankysExtraSpaces", "FrankysExtraSpaces", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<string> RepairBayDesc;

		public static ConfigEntry<bool> RB11;

		public static ConfigEntry<bool> RB12;

		public static ConfigEntry<bool> RB13;

		public static ConfigEntry<string> ParkingBayDesc;

		public static ConfigEntry<bool> PB10;

		public static ConfigEntry<bool> PB11;

		public static ConfigEntry<bool> PB12;

		public static ConfigEntry<bool> PB13;

		public static ConfigEntry<bool> PB14;

		public static ConfigEntry<bool> PB15;

		public static ConfigEntry<bool> PB16;

		public static ConfigEntry<bool> PB17;

		public static ConfigEntry<bool> PB18;

		public static ConfigEntry<bool> PB19;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("FrankysExtraSpaces");
			val.PatchAll();
			Debug.Log((object)"FrankysExtraSpaces loaded");
			RepairBayDesc = ((BaseUnityPlugin)this).Config.Bind<string>("Repair Bays", "Description", "Toggle which extra repair bays you want active", "Description");
			RB11 = ((BaseUnityPlugin)this).Config.Bind<bool>("Repair Bays", "Repair Bay 11", true, "Right Upper");
			RB12 = ((BaseUnityPlugin)this).Config.Bind<bool>("Repair Bays", "Repair Bay 12", true, "Right Lower");
			RB13 = ((BaseUnityPlugin)this).Config.Bind<bool>("Repair Bays", "Repair Bay 13", true, "Left Upper");
			ParkingBayDesc = ((BaseUnityPlugin)this).Config.Bind<string>("Parking Bays", "Description", "Toggle which extra parking bays you want active", "Description");
			PB10 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 10", true, "Closest to Catapult 1");
			PB11 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 11", true, "Middle Right");
			PB12 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 12", true, "Middle Left");
			PB13 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 13", true, "Furthest Forward on Catapult 1 side");
			PB14 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 14", true, "Furthest Forward on Catapult 2 side");
			PB15 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 15", true, "Middle");
			PB16 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 16", true, "Closest to Catapult 2");
			PB17 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 17", true, "Back Upper Right");
			PB18 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 18", true, "Near Elevator 1");
			PB19 = ((BaseUnityPlugin)this).Config.Bind<bool>("Parking Bays", "Parking Bay 19", true, "Front of Elevator 2");
		}
	}
	internal static class PluginInfo
	{
		public const string PLUGIN_NAME = "FrankysExtraSpaces";

		public const string PLUGIN_ID = "FrankysExtraSpaces";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FrankysExtraSpaces
{
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay10
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB10.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (10)";
			((Component)val3).transform.localPosition = new Vector3(-77.48f, 0f, 24.12f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -35.795f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (10) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (3)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (3) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (10) to UpperDeckBays and connected to JunctionNode (3)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay11
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB11.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (11)";
			((Component)val3).transform.localPosition = new Vector3(-85.76f, 0f, 18.07f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -21.068f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (11) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (2)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (2) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (11) to UpperDeckBays and connected to JunctionNode (2)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay12
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB12.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (12)";
			((Component)val3).transform.localPosition = new Vector3(-96.79f, 0f, 15.82f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -4.69f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (12) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (2)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (2) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (12) to UpperDeckBays and connected to JunctionNode (2)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay13
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB13.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (13)";
			((Component)val3).transform.localPosition = new Vector3(-107.14f, 0f, 14.97f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -4.69f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (13) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (1)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (1) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (13) to UpperDeckBays and connected to JunctionNode (1)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay14
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB14.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (14)";
			((Component)val3).transform.localPosition = new Vector3(-112.03f, 0f, -9.61f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -148.761f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (14) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (1)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (1) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (14) to UpperDeckBays and connected to JunctionNode (1)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay15
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB15.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (15)";
			((Component)val3).transform.localPosition = new Vector3(-101.38f, 0f, -10.3f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -148.761f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (15) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (2)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (2) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (15) to UpperDeckBays and connected to JunctionNode (2)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay16
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB16.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (16)";
			((Component)val3).transform.localPosition = new Vector3(-91f, 0f, -11.29f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -148.761f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (16) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (2)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (2) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (16) to UpperDeckBays and connected to JunctionNode (2)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay17
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			bool value = Plugin.PB17.Value;
			GameObject obj = GameObject.Find("ParkingBay (8)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			GameObject obj2 = GameObject.Find("ParkingBay (9)");
			ParkingBay val2 = ((obj2 != null) ? obj2.GetComponent<ParkingBay>() : null);
			if (!value)
			{
				return;
			}
			GameObject obj3 = GameObject.Find("ParkingBay (0)");
			ParkingBay val3 = ((obj3 != null) ? obj3.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val3 == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj4 = GameObject.Find("UpperDeckBays");
			Transform val4 = ((obj4 != null) ? obj4.transform : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val5 = Object.Instantiate<ParkingBay>(val3, val4);
			((Object)val5).name = "ParkingBay (17)";
			((Component)val5).transform.localPosition = new Vector3(117.47f, 0f, 25.82f);
			((Component)val5).transform.localRotation = Quaternion.Euler(0f, 48.962f, 0f);
			UnitMovementNode componentInChildren = ((Component)val5).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val5, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (17) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj5 = GameObject.Find("UpperDeckNodes/JunctionNode (27)");
			UnitMovementNode val6 = ((obj5 != null) ? obj5.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val6 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (2) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val6);
			((NavigationNode)val6).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val5))
			{
				list2.Add(val5);
			}
			((Component)val).transform.localPosition = new Vector3(130.09f, 0f, 24.56f);
			((Component)val).transform.localRotation = Quaternion.Euler(0f, 48.962f, 0f);
			((Component)val2).transform.localPosition = new Vector3(142.64f, 0f, 23.18f);
			((Component)val2).transform.localRotation = Quaternion.Euler(0f, 48.962f, 0f);
			Debug.Log((object)"Successfully added ParkingBay (17) to UpperDeckBays and connected to JunctionNode (27)");
			Debug.Log((object)"Moved Parking Bay 8 ad 9");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay18
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB18.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (18)";
			((Component)val3).transform.localPosition = new Vector3(-68.88f, 0f, 30.32f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -35.795f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (16) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (23)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (23) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (18) to UpperDeckBays and connected to JunctionNode (23)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class ParkingBay19
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new ParkingBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.PB19.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("ParkingBay (0)");
			ParkingBay val = ((obj != null) ? obj.GetComponent<ParkingBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original ParkingBay (0) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("UpperDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"UpperDeckBays parent not found");
				return;
			}
			ParkingBay val3 = Object.Instantiate<ParkingBay>(val, val2);
			((Object)val3).name = "ParkingBay (19)";
			((Component)val3).transform.localPosition = new Vector3(18.61f, 0f, 5.11f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, 28f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned Bay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
				Debug.Log((object)"ParkingBay (16) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("UpperDeckNodes/JunctionNode (11)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (11) under UpperDeckNodes not found");
				return;
			}
			GameObject obj4 = GameObject.Find("UpperDeckNodes/JunctionNode (35)");
			UnitMovementNode val5 = ((obj4 != null) ? obj4.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (35) under UpperDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val5);
			((NavigationNode)val5).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_upperDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<ParkingBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added ParkingBay (19) to UpperDeckBays and connected to JunctionNode (11) and (35)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class RepairBay11
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new RepairBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.RB11.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("RepairBay (10)");
			RepairBay val = ((obj != null) ? obj.GetComponent<RepairBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original RepairBay (10) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("LowerDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"LowerDeckBays parent not found");
				return;
			}
			RepairBay val3 = Object.Instantiate<RepairBay>(val, val2);
			((Object)val3).name = "RepairBay (11)";
			((Component)val3).transform.localPosition = new Vector3(119.37f, 0f, 7.76f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -90f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned RepairBay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(1f, 0f, 1f));
				Debug.Log((object)"RepairBay (11) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("LowerDeckNodes/JunctionNode (13)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (13) under LowerDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_lowerDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<RepairBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added RepairBay (11) to LowerDeckBays and connected to JunctionNode (13)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class RepairBay12
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new RepairBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.RB12.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("RepairBay (10)");
			RepairBay val = ((obj != null) ? obj.GetComponent<RepairBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original RepairBay (10) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("LowerDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"LowerDeckBays parent not found");
				return;
			}
			RepairBay val3 = Object.Instantiate<RepairBay>(val, val2);
			((Object)val3).name = "RepairBay (12)";
			((Component)val3).transform.localPosition = new Vector3(122.11f, 0f, -2.23f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, -90f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned RepairBay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(1f, 0f, 1f));
				Debug.Log((object)"RepairBay (12) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("LowerDeckNodes/JunctionNode (15)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (15) under LowerDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_lowerDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<RepairBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added RepairBay (12) to LowerDeckBays and connected to JunctionNode (15)");
		}
	}
	[HarmonyPatch(typeof(CarrierLayout), "Start")]
	public static class RepairBay13
	{
		private static void Postfix(CarrierLayout __instance)
		{
			try
			{
				AddNewRepairBay(__instance);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Failed to add new RepairBay: {arg}");
			}
		}

		private static void AddNewRepairBay(CarrierLayout layout)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.RB13.Value)
			{
				return;
			}
			GameObject obj = GameObject.Find("RepairBay (10)");
			RepairBay val = ((obj != null) ? obj.GetComponent<RepairBay>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"Original RepairBay (10) not found");
				return;
			}
			GameObject obj2 = GameObject.Find("LowerDeckBays");
			Transform val2 = ((obj2 != null) ? obj2.transform : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Debug.LogError((object)"LowerDeckBays parent not found");
				return;
			}
			RepairBay val3 = Object.Instantiate<RepairBay>(val, val2);
			((Object)val3).name = "RepairBay (13)";
			((Component)val3).transform.localPosition = new Vector3(-42.42f, 0f, 9.07f);
			((Component)val3).transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
			UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
			if ((Object)(object)componentInChildren == (Object)null)
			{
				Debug.LogError((object)"Cloned RepairBay missing UnitMovementNode");
				return;
			}
			FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
			if ((object)fieldInfo != null)
			{
				fieldInfo.SetValue(val3, (object)new Vector3(1f, 0f, 1f));
				Debug.Log((object)"RepairBay (13) orientation multiplier updated");
			}
			else
			{
				Debug.LogError((object)"_orientationMultiplier field not found on Region");
			}
			GameObject obj3 = GameObject.Find("LowerDeckNodes/JunctionNode (21)");
			UnitMovementNode val4 = ((obj3 != null) ? obj3.GetComponent<UnitMovementNode>() : null);
			if ((Object)(object)val4 == (Object)null)
			{
				Debug.LogError((object)"JunctionNode (21) under LowerDeckNodes not found");
				return;
			}
			List<NavigationConnection> list = new List<NavigationConnection>();
			((NavigationNode)componentInChildren).GetConnections(list);
			foreach (NavigationConnection item in list)
			{
				((NavigationNode)componentInChildren).RemoveTargetNode(item.TargetNode);
			}
			((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val4);
			((NavigationNode)val4).AddTargetNode((NavigationNode)(object)componentInChildren);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(CarrierLayout), "_lowerDeckBays");
			if ((object)fieldInfo2 != null && fieldInfo2.GetValue(layout) is List<RepairBay> list2 && !list2.Contains(val3))
			{
				list2.Add(val3);
			}
			Debug.Log((object)"Successfully added RepairBay (13) to LowerDeckBays and connected to JunctionNode (21)");
		}
	}
}