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> PB100;
public static ConfigEntry<bool> PB101;
public static ConfigEntry<bool> PB102;
public static ConfigEntry<bool> PB103;
public static ConfigEntry<bool> PB104;
public static ConfigEntry<bool> PB105;
public static ConfigEntry<bool> PB106;
public static ConfigEntry<bool> PB107;
public static ConfigEntry<bool> PB108;
public static ConfigEntry<string> ParkingBayDesc2;
public static ConfigEntry<bool> PB200;
public static ConfigEntry<bool> PB201;
public static ConfigEntry<bool> PB202;
public static ConfigEntry<bool> PB203;
public static ConfigEntry<bool> PB204;
public static ConfigEntry<bool> PB205;
public static ConfigEntry<bool> PB206;
public static ConfigEntry<bool> PB207;
public static ConfigEntry<bool> PB208;
public static ConfigEntry<string> ParkingBayDesc3;
public static ConfigEntry<bool> PB300;
public static ConfigEntry<bool> PB301;
public static ConfigEntry<bool> PB302;
public static ConfigEntry<bool> PB303;
public static ConfigEntry<bool> DebugValue;
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>("Cat1 Parking Bays", "Description", "Toggle which extra parking bays you want active", "Description");
PB100 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 100", true, "Closest to Elevator 1");
PB101 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 101", true, "");
PB102 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 102", true, "");
PB103 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 103", true, "");
PB104 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 104", true, "");
PB105 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 105", true, "");
PB106 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 106", true, "");
PB107 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 107", true, "");
PB108 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat1 Parking Bays", "Parking Bay 108", true, "Furthest Forward");
ParkingBayDesc2 = ((BaseUnityPlugin)this).Config.Bind<string>("Cat2 Parking Bays", "Description", "Toggle which extra parking bays you want active", "Description");
PB200 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 200", true, "Front of Cat 2");
PB201 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 201", true, "");
PB202 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 202", true, "");
PB203 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 203", true, "");
PB204 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 204", true, "");
PB205 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 205", true, "Furthest Forward");
PB206 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 206", true, "");
PB207 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 207", true, "");
PB208 = ((BaseUnityPlugin)this).Config.Bind<bool>("Cat2 Parking Bays", "Parking Bay 208", true, "Next to Cat 2 Blast Shield");
ParkingBayDesc3 = ((BaseUnityPlugin)this).Config.Bind<string>("Other Parking Bays", "Description", "Toggle which extra parking bays you want active", "Description");
PB300 = ((BaseUnityPlugin)this).Config.Bind<bool>("Other Parking Bays", "Parking Bay 300", true, "Back Upper Right, Also shifts 2 other bays to fit");
PB301 = ((BaseUnityPlugin)this).Config.Bind<bool>("Other Parking Bays", "Parking Bay 301", true, "In front of Elevator 2");
PB302 = ((BaseUnityPlugin)this).Config.Bind<bool>("Other Parking Bays", "Parking Bay 302", true, "In front of Island, Left");
PB303 = ((BaseUnityPlugin)this).Config.Bind<bool>("Other Parking Bays", "Parking Bay 303", true, "In front of Island, Right");
DebugValue = ((BaseUnityPlugin)this).Config.Bind<bool>("Debugging", "Node Viewer", false, "");
}
}
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 CarrierGraphDebugPatch
{
private static void Postfix(CarrierLayout __instance)
{
if (Plugin.DebugValue.Value)
{
DrawGraph();
}
}
private static void DrawGraph()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: 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_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Expected O, but got Unknown
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("DEBUG_GRAPH_ROOT");
UnitMovementNode[] array = Object.FindObjectsOfType<UnitMovementNode>();
if (array == null || array.Length == 0)
{
Debug.LogWarning((object)"No UnitMovementNodes found for debug drawing.");
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(UnitMovementNode), "_targetNodes");
UnitMovementNode[] array2 = array;
foreach (UnitMovementNode val2 in array2)
{
GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)val3).name = "DEBUG_NODE_" + ((Object)val2).name;
val3.transform.position = ((Component)val2).transform.position;
val3.transform.localScale = Vector3.one * 0.75f;
Object.Destroy((Object)(object)val3.GetComponent<Collider>());
Renderer component = val3.GetComponent<Renderer>();
component.material = new Material(Shader.Find("Standard"));
component.material.color = Color.green;
val3.transform.SetParent(val.transform);
if ((object)fieldInfo == null || !(fieldInfo.GetValue(val2) is List<UnitMovementNode> list))
{
continue;
}
foreach (UnitMovementNode item in list)
{
if (!((Object)(object)item == (Object)null) && ((Object)val2).GetInstanceID() <= ((Object)item).GetInstanceID())
{
Vector3 position = ((Component)val2).transform.position;
Vector3 position2 = ((Component)item).transform.position;
Vector3 val4 = position2 - position;
float magnitude = ((Vector3)(ref val4)).magnitude;
GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)2);
((Object)val5).name = "DEBUG_LINE";
val5.transform.position = position + val4 * 0.5f;
val5.transform.up = ((Vector3)(ref val4)).normalized;
val5.transform.localScale = new Vector3(0.25f, magnitude * 0.5f, 0.25f);
Object.Destroy((Object)(object)val5.GetComponent<Collider>());
Renderer component2 = val5.GetComponent<Renderer>();
component2.material = new Material(Shader.Find("Standard"));
component2.material.color = Color.green;
val5.transform.SetParent(val.transform);
}
}
}
Debug.Log((object)$"Graph debug complete. Nodes found: {array.Length}");
}
}
[HarmonyPatch(typeof(CarrierLayout), "Start")]
public static class CarrierLayoutPatch
{
private class NodeDefinition
{
public string Name;
public Vector3 LocalPosition;
public Quaternion LocalRotation;
public NodeDefinition(string name, Vector3 pos, Quaternion rot)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
Name = name;
LocalPosition = pos;
LocalRotation = rot;
}
}
private class BayDefinition
{
public string Name;
public Vector3 LocalPosition;
public Quaternion LocalRotation;
public string OriginalName;
public bool ConfigEnabled;
public List<string> AttachToNodes;
public BayDefinition(string name, string originalName, Vector3 pos, Quaternion rot, bool enabled, List<string> attachTo)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
Name = name;
OriginalName = originalName;
LocalPosition = pos;
LocalRotation = rot;
ConfigEnabled = enabled;
AttachToNodes = attachTo;
}
}
private static readonly NodeDefinition[] CustomNodes = new NodeDefinition[7]
{
new NodeDefinition("JunctionNode (41)", new Vector3(-114f, 0f, 2.59f), Quaternion.identity),
new NodeDefinition("JunctionNode (42)", new Vector3(-125.2f, 0f, 2.43f), Quaternion.identity),
new NodeDefinition("JunctionNode (43)", new Vector3(-139.6f, 0f, 2.45f), Quaternion.identity),
new NodeDefinition("JunctionNode (44)", new Vector3(-152.5f, 0f, 2.87f), Quaternion.identity),
new NodeDefinition("JunctionNode (45)", new Vector3(54.4f, 0f, 2.87f), Quaternion.identity),
new NodeDefinition("JunctionNode (46)", new Vector3(66.48f, 0f, 2.87f), Quaternion.identity),
new NodeDefinition("JunctionNode (47)", new Vector3(-58f, 0f, 7.2f), Quaternion.identity)
};
private static readonly BayDefinition[] CustomBays = new BayDefinition[22]
{
new BayDefinition("ParkingBay (100)", "ParkingBay (0)", new Vector3(-68.88f, 0f, 30.32f), Quaternion.Euler(0f, -35.795f, 0f), Plugin.PB100.Value, new List<string> { "JunctionNode (23)" }),
new BayDefinition("ParkingBay (101)", "ParkingBay (0)", new Vector3(-77.48f, 0f, 24.127f), Quaternion.Euler(0f, -35.795f, 0f), Plugin.PB101.Value, new List<string> { "JunctionNode (3)" }),
new BayDefinition("ParkingBay (102)", "ParkingBay (0)", new Vector3(-85.76f, 0f, 18.07f), Quaternion.Euler(0f, -21.068f, 0f), Plugin.PB102.Value, new List<string> { "JunctionNode (2)" }),
new BayDefinition("ParkingBay (103)", "ParkingBay (0)", new Vector3(-100.5f, 0f, 17.1f), Quaternion.Euler(0f, -44.712f, 0f), Plugin.PB103.Value, new List<string> { "JunctionNode (2)" }),
new BayDefinition("ParkingBay (104)", "ParkingBay (0)", new Vector3(-112.9f, 0f, 16.1f), Quaternion.Euler(0f, -44.712f, 0f), Plugin.PB104.Value, new List<string> { "JunctionNode (1)" }),
new BayDefinition("ParkingBay (105)", "ParkingBay (0)", new Vector3(-124.92f, 0f, 14.98f), Quaternion.Euler(0f, -44.712f, 0f), Plugin.PB105.Value, new List<string> { "JunctionNode (41)" }),
new BayDefinition("ParkingBay (106)", "ParkingBay (0)", new Vector3(-136.93f, 0f, 14.17f), Quaternion.Euler(0f, -44.712f, 0f), Plugin.PB106.Value, new List<string> { "JunctionNode (42)" }),
new BayDefinition("ParkingBay (107)", "ParkingBay (0)", new Vector3(-149.4f, 0f, 13.25f), Quaternion.Euler(0f, -44.712f, 0f), Plugin.PB107.Value, new List<string> { "JunctionNode (43)" }),
new BayDefinition("ParkingBay (108)", "ParkingBay (0)", new Vector3(-161.18f, 0f, 11.92f), Quaternion.Euler(0f, -44.712f, 0f), Plugin.PB108.Value, new List<string> { "JunctionNode (44)" }),
new BayDefinition("ParkingBay (200)", "ParkingBay (0)", new Vector3(-99.99f, 0f, -11.27f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB200.Value, new List<string> { "JunctionNode (2)" }),
new BayDefinition("ParkingBay (201)", "ParkingBay (0)", new Vector3(-111.67f, 0f, -10.37f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB201.Value, new List<string> { "JunctionNode (1)" }),
new BayDefinition("ParkingBay (202)", "ParkingBay (0)", new Vector3(-123.82f, 0f, -9.75f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB202.Value, new List<string> { "JunctionNode (41)" }),
new BayDefinition("ParkingBay (203)", "ParkingBay (0)", new Vector3(-135.88f, 0f, -8.67f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB203.Value, new List<string> { "JunctionNode (42)" }),
new BayDefinition("ParkingBay (204)", "ParkingBay (0)", new Vector3(-149.02f, 0f, -8.58f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB204.Value, new List<string> { "JunctionNode (43)" }),
new BayDefinition("ParkingBay (205)", "ParkingBay (0)", new Vector3(-160.75f, 0f, -6.69f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB205.Value, new List<string> { "JunctionNode (44)" }),
new BayDefinition("ParkingBay (206)", "ParkingBay (0)", new Vector3(-84.1f, 0f, -8f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB206.Value, new List<string> { "JunctionNode (3)" }),
new BayDefinition("ParkingBay (207)", "ParkingBay (0)", new Vector3(-70.1f, 0f, -6.5f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB207.Value, new List<string> { "JunctionNode (47)" }),
new BayDefinition("ParkingBay (208)", "ParkingBay (0)", new Vector3(-55.2f, 0f, -4.2f), Quaternion.Euler(0f, 224.712f, 0f), Plugin.PB208.Value, new List<string> { "JunctionNode (5)" }),
new BayDefinition("ParkingBay (300)", "ParkingBay (0)", new Vector3(116.3f, 0f, 23.8f), Quaternion.Euler(0f, 48.962f, 0f), Plugin.PB300.Value, new List<string> { "JunctionNode (27)" }),
new BayDefinition("ParkingBay (301)", "ParkingBay (0)", new Vector3(18.61f, 0f, 5.11f), Quaternion.Euler(0f, 28f, 0f), Plugin.PB301.Value, new List<string> { "JunctionNode (11)", "JunctionNode (35)" }),
new BayDefinition("ParkingBay (302)", "ParkingBay (0)", new Vector3(54f, 0f, 14.03f), Quaternion.Euler(0f, 0f, 0f), Plugin.PB302.Value, new List<string> { "JunctionNode (45)" }),
new BayDefinition("ParkingBay (303)", "ParkingBay (0)", new Vector3(66.2f, 0f, 15.99f), Quaternion.Euler(0f, 0f, 0f), Plugin.PB303.Value, new List<string> { "JunctionNode (46)" })
};
private static readonly Dictionary<string, UnitMovementNode> NodeLookup = new Dictionary<string, UnitMovementNode>();
private static void Postfix(CarrierLayout __instance)
{
try
{
InitializeNodes(__instance);
InitializeConnections();
InitializeBays(__instance);
}
catch (Exception arg)
{
Debug.LogError((object)$"CarrierLayoutPatch failed: {arg}");
}
}
private static void InitializeNodes(CarrierLayout layout)
{
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
NodeLookup.Clear();
GameObject obj = GameObject.Find("UpperDeckNodes");
Transform val = ((obj != null) ? obj.transform : null);
if ((Object)(object)val == (Object)null)
{
return;
}
UnitMovementNode[] componentsInChildren = ((Component)val).GetComponentsInChildren<UnitMovementNode>();
foreach (UnitMovementNode val2 in componentsInChildren)
{
if (!NodeLookup.ContainsKey(((Object)val2).name))
{
NodeLookup.Add(((Object)val2).name, val2);
Debug.Log((object)("Vanilla node registered: " + ((Object)val2).name));
}
}
NodeDefinition[] customNodes = CustomNodes;
foreach (NodeDefinition nodeDefinition in customNodes)
{
GameObject obj2 = GameObject.Find("JunctionNode (1)");
UnitMovementNode val3 = ((obj2 != null) ? obj2.GetComponent<UnitMovementNode>() : null);
if (!((Object)(object)val3 == (Object)null))
{
UnitMovementNode val4 = Object.Instantiate<UnitMovementNode>(val3, val);
((Object)val4).name = nodeDefinition.Name;
((Component)val4).transform.localPosition = nodeDefinition.LocalPosition;
((Component)val4).transform.localRotation = nodeDefinition.LocalRotation;
NodeLookup[nodeDefinition.Name] = val4;
Debug.Log((object)("Custom Node " + nodeDefinition.Name + " added"));
}
}
}
private static void InitializeConnections()
{
if (NodeLookup != null)
{
((NavigationNode)NodeLookup["JunctionNode (41)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (1)"]);
((NavigationNode)NodeLookup["JunctionNode (41)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (42)"]);
((NavigationNode)NodeLookup["JunctionNode (42)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (43)"]);
((NavigationNode)NodeLookup["JunctionNode (43)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (44)"]);
((NavigationNode)NodeLookup["JunctionNode (45)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (20)"]);
((NavigationNode)NodeLookup["JunctionNode (45)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (21)"]);
((NavigationNode)NodeLookup["JunctionNode (46)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (21)"]);
((NavigationNode)NodeLookup["JunctionNode (46)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (22)"]);
((NavigationNode)NodeLookup["JunctionNode (47)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (3)"]);
((NavigationNode)NodeLookup["JunctionNode (47)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (5)"]);
((NavigationNode)NodeLookup["JunctionNode (1)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (41)"]);
((NavigationNode)NodeLookup["JunctionNode (42)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (41)"]);
((NavigationNode)NodeLookup["JunctionNode (43)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (42)"]);
((NavigationNode)NodeLookup["JunctionNode (44)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (43)"]);
((NavigationNode)NodeLookup["JunctionNode (20)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (45)"]);
((NavigationNode)NodeLookup["JunctionNode (21)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (45)"]);
((NavigationNode)NodeLookup["JunctionNode (21)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (46)"]);
((NavigationNode)NodeLookup["JunctionNode (22)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (46)"]);
((NavigationNode)NodeLookup["JunctionNode (3)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (47)"]);
((NavigationNode)NodeLookup["JunctionNode (5)"]).AddTargetNode((NavigationNode)(object)NodeLookup["JunctionNode (47)"]);
Debug.Log((object)"Custom nodes connected.");
}
}
private static void InitializeBays(CarrierLayout layout)
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = GameObject.Find("UpperDeckBays");
Transform val = ((obj != null) ? obj.transform : null);
if ((Object)(object)val == (Object)null)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
BayDefinition[] customBays = CustomBays;
foreach (BayDefinition bayDefinition in customBays)
{
if (!bayDefinition.ConfigEnabled)
{
continue;
}
GameObject obj2 = GameObject.Find(bayDefinition.OriginalName);
ParkingBay val2 = ((obj2 != null) ? obj2.GetComponent<ParkingBay>() : null);
if ((Object)(object)val2 == (Object)null)
{
continue;
}
ParkingBay val3 = Object.Instantiate<ParkingBay>(val2, val);
((Object)val3).name = bayDefinition.Name;
((Component)val3).transform.localPosition = bayDefinition.LocalPosition;
((Component)val3).transform.localRotation = bayDefinition.LocalRotation;
fieldInfo?.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
UnitMovementNode componentInChildren = ((Component)val3).GetComponentInChildren<UnitMovementNode>();
if ((Object)(object)componentInChildren != (Object)null)
{
foreach (string attachToNode in bayDefinition.AttachToNodes)
{
if (NodeLookup.TryGetValue(attachToNode, out var value))
{
((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)value);
((NavigationNode)value).AddTargetNode((NavigationNode)(object)componentInChildren);
continue;
}
GameObject val4 = GameObject.Find(attachToNode);
UnitMovementNode val5 = ((val4 != null) ? val4.GetComponent<UnitMovementNode>() : null);
if ((Object)(object)val5 != (Object)null)
{
((NavigationNode)componentInChildren).AddTargetNode((NavigationNode)(object)val5);
((NavigationNode)val5).AddTargetNode((NavigationNode)(object)componentInChildren);
}
}
}
Debug.Log((object)(bayDefinition.Name + " added and connected"));
}
if (Plugin.PB300.Value)
{
GameObject obj3 = GameObject.Find("ParkingBay (8)");
ParkingBay val6 = ((obj3 != null) ? obj3.GetComponent<ParkingBay>() : null);
GameObject obj4 = GameObject.Find("ParkingBay (9)");
ParkingBay val7 = ((obj4 != null) ? obj4.GetComponent<ParkingBay>() : null);
((Component)val6).transform.localPosition = new Vector3(128.2f, 0f, 21.4f);
((Component)val6).transform.localRotation = Quaternion.Euler(0f, 48.962f, 0f);
((Component)val7).transform.localPosition = new Vector3(142.64f, 0f, 23.18f);
((Component)val7).transform.localRotation = Quaternion.Euler(0f, 48.962f, 0f);
}
if (Plugin.PB302.Value || Plugin.PB303.Value)
{
GameObject obj5 = GameObject.Find("LargeParkingBay (2)");
ParkingBay val8 = ((obj5 != null) ? obj5.GetComponent<ParkingBay>() : null);
((Component)val8).transform.localPosition = new Vector3(41.76f, 0f, 12.27f);
((Component)val8).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
GameObject obj6 = GameObject.Find("ParkingBay (5)");
ParkingBay val9 = ((obj6 != null) ? obj6.GetComponent<ParkingBay>() : null);
GameObject obj7 = GameObject.Find("ParkingBay (6)");
ParkingBay val10 = ((obj7 != null) ? obj7.GetComponent<ParkingBay>() : null);
((Component)val9).transform.localPosition = new Vector3(-14.37f, 0f, 2.47f);
((Component)val9).transform.localRotation = Quaternion.Euler(0f, 28f, 0f);
((Component)val10).transform.localPosition = new Vector3(-3.67f, 0f, 4.01f);
((Component)val10).transform.localRotation = Quaternion.Euler(0f, 28f, 0f);
}
}
[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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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)
{
return;
}
GameObject obj2 = GameObject.Find("LowerDeckBays");
Transform val2 = ((obj2 != null) ? obj2.transform : null);
if ((Object)(object)val2 == (Object)null)
{
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)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
if ((object)fieldInfo != null)
{
fieldInfo.SetValue(val3, (object)new Vector3(-1f, 0f, -1f));
}
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)
{
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)(((Object)val3).name + " added"));
}
}
[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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: 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)
{
return;
}
GameObject obj2 = GameObject.Find("LowerDeckBays");
Transform val2 = ((obj2 != null) ? obj2.transform : null);
if ((Object)(object)val2 == (Object)null)
{
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)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
if ((object)fieldInfo != null)
{
fieldInfo.SetValue(val3, (object)new Vector3(1f, 0f, 1f));
}
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)
{
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)
{
if (fieldInfo2.GetValue(layout) is List<RepairBay> list2 && !list2.Contains(val3))
{
list2.Add(val3);
}
Debug.Log((object)(((Object)val3).name + " added"));
}
}
}
[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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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)
{
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)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(Region), "_orientationMultiplier");
if ((object)fieldInfo != null)
{
fieldInfo.SetValue(val3, (object)new Vector3(1f, 0f, 1f));
}
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)
{
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)(((Object)val3).name + " added"));
}
}
}