Decompiled source of Airport Remixed v1.0.0

tony4twentys-Airport_Remixed.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Airport Remixed")]
[assembly: AssemblyDescription("A BepInEx plugin for PEAK that remixes airport functionality")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("tony4twentys")]
[assembly: AssemblyProduct("Airport Remixed")]
[assembly: AssemblyCopyright("Copyright © tony4twentys 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d39d492-4184-4d83-8b4a-1227283ca458")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace tony4twentys.Airport_Remixed;

[BepInPlugin("tony4twentys.Airport_Remixed", "Airport Remixed", "1.0.0")]
[BepInProcess("PEAK.exe")]
public class AirportRemixedPlugin : BaseUnityPlugin
{
	public static ManualLogSource Logger;

	private bool triggeredProcessing = false;

	private bool mirrorCamToggled = false;

	private float mirrorCamToggleTime = 0f;

	private const float MIRROR_CAM_TOGGLE_DURATION = 20f;

	private ConfigEntry<KeyCode> muralModeModifierKey;

	private ConfigEntry<KeyCode> muralModeMainKey;

	private ConfigEntry<bool> muralModeRequireModifier;

	private void Awake()
	{
		Logger = ((BaseUnityPlugin)this).Logger;
		Logger.LogInfo((object)"Plugin tony4twentys.Airport_Remixed is loaded!");
		InitializeConfig();
	}

	private void InitializeConfig()
	{
		//IL_00ae: 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)
		muralModeRequireModifier = ((BaseUnityPlugin)this).Config.Bind<bool>("MuralMode", "RequireModifierKey", true, "Whether MuralMode requires a modifier key to be held down");
		muralModeModifierKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("MuralMode", "ModifierKey", (KeyCode)308, "The modifier key for MuralMode (only used if RequireModifierKey is true)");
		muralModeMainKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("MuralMode", "MainKey", (KeyCode)112, "The main key to trigger MuralMode");
		Logger.LogInfo((object)"MuralMode configuration loaded:");
		Logger.LogInfo((object)$"  Require Modifier: {muralModeRequireModifier.Value}");
		Logger.LogInfo((object)$"  Modifier Key: {muralModeModifierKey.Value}");
		Logger.LogInfo((object)$"  Main Key: {muralModeMainKey.Value}");
	}

	private void OnEnable()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnDisable()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}

	private void Update()
	{
		if (CheckMuralModeKeyCombination())
		{
			ToggleMirrorCam();
		}
		if (mirrorCamToggled && Time.time - mirrorCamToggleTime >= 20f)
		{
			RestoreMirrorCam();
		}
	}

	private bool CheckMuralModeKeyCombination()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		if (!Input.GetKeyDown(muralModeMainKey.Value))
		{
			return false;
		}
		if (muralModeRequireModifier.Value)
		{
			return Input.GetKey(muralModeModifierKey.Value);
		}
		return true;
	}

	private void ToggleMirrorCam()
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("Map/Mirror (1)/Mirror Cam");
		if ((Object)(object)val != (Object)null)
		{
			val.SetActive(false);
			mirrorCamToggled = true;
			mirrorCamToggleTime = Time.time;
			string text;
			if (!muralModeRequireModifier.Value)
			{
				KeyCode value = muralModeMainKey.Value;
				text = ((object)(KeyCode)(ref value)).ToString();
			}
			else
			{
				text = $"{muralModeModifierKey.Value} + {muralModeMainKey.Value}";
			}
			string text2 = text;
			Logger.LogInfo((object)("Mirror Cam turned OFF for 20 seconds (MuralMode triggered with " + text2 + ")"));
		}
		else
		{
			Logger.LogWarning((object)"Mirror Cam not found at path: Map/Mirror (1)/Mirror Cam");
		}
	}

	private void RestoreMirrorCam()
	{
		GameObject val = GameObject.Find("Map/Mirror (1)/Mirror Cam");
		if ((Object)(object)val != (Object)null)
		{
			val.SetActive(true);
			mirrorCamToggled = false;
			Logger.LogInfo((object)"Mirror Cam automatically restored after 20 seconds");
		}
		else
		{
			Logger.LogWarning((object)"Mirror Cam not found when trying to restore");
		}
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		if (((Scene)(ref scene)).name == "Airport")
		{
			Logger.LogInfo((object)"Airport scene loaded. Processing all airport objects immediately...");
			triggeredProcessing = false;
			ProcessAllAirportObjects();
		}
	}

	private void ProcessAllAirportObjects()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Logger.LogInfo((object)"=== COMPREHENSIVE AIRPORT PROCESSING STARTED ===");
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			ProcessRootObjects(rootGameObjects);
			ProcessMainMeshes(rootGameObjects);
			ProcessFences(rootGameObjects);
			ProcessVegetation(rootGameObjects);
			ProcessLights(rootGameObjects);
			ProcessDisplays(rootGameObjects);
			ProcessBakeData(rootGameObjects);
			ProcessLuggage(rootGameObjects);
			ProcessAdditionalObjects(rootGameObjects);
			ProcessSpecificRequests(rootGameObjects);
			Logger.LogInfo((object)"=== COMPREHENSIVE AIRPORT PROCESSING COMPLETED ===");
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("Error in comprehensive processing: " + ex.Message));
		}
	}

	private void ProcessRootObjects(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing root objects...");
		foreach (GameObject val in rootObjects)
		{
			string name = ((Object)val).name;
			switch (name)
			{
			default:
				if (!(name == "BL_Airport"))
				{
					if (name == "Mirror")
					{
						Logger.LogInfo((object)("Keeping OFF root object: " + name));
						val.SetActive(false);
					}
					break;
				}
				goto case "Ambience Escalator";
			case "Ambience Escalator":
			case "PassportSpawner":
			case "ReverbSettings":
			case "SpawnPoint":
			case "SpawnPoint (1)":
			case "Map":
				Logger.LogInfo((object)("Keeping ON root object: " + name));
				val.SetActive(true);
				break;
			}
		}
	}

	private void ProcessMainMeshes(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing main meshes...");
		foreach (GameObject val in rootObjects)
		{
			Transform val2 = FindDeepChild(val.transform, "Main Meshes");
			if (!((Object)(object)val2 != (Object)null))
			{
				continue;
			}
			Logger.LogInfo((object)("Found Main Meshes parent: " + ((Object)val2).name));
			for (int j = 0; j < val2.childCount; j++)
			{
				Transform child = val2.GetChild(j);
				string name = ((Object)child).name;
				switch (name)
				{
				default:
					if (!(name == "Windows"))
					{
						switch (name)
						{
						default:
							if (!(name == "Cube (1)"))
							{
								goto end_IL_0086;
							}
							break;
						case "Schaffold":
						case "Carpet":
						case "Desk":
						case "Outside grid":
						case "Outside grid (1)":
						case "Climbing wall blockers":
						case "Cube":
							break;
						}
						Logger.LogInfo((object)("Keeping OFF main mesh: " + name));
						((Component)child).gameObject.SetActive(false);
						break;
					}
					goto case "Airport";
				case "Airport":
				case "Airport (1)Roof":
				case "Airstrip":
					{
						Logger.LogInfo((object)("Keeping ON main mesh: " + name));
						((Component)child).gameObject.SetActive(true);
						break;
					}
					end_IL_0086:
					break;
				}
			}
		}
	}

	private void ProcessFences(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing fences...");
		foreach (GameObject val in rootObjects)
		{
			Transform val2 = FindDeepChild(val.transform, "Fences");
			if (!((Object)(object)val2 != (Object)null))
			{
				continue;
			}
			Logger.LogInfo((object)("Found Fences parent: " + ((Object)val2).name));
			((Component)val2).gameObject.SetActive(true);
			for (int j = 0; j < val2.childCount; j++)
			{
				Transform child = val2.GetChild(j);
				string name = ((Object)child).name;
				if (name.Contains("fence") && !name.Contains("Kiosk") && !name.Contains("Check"))
				{
					Logger.LogInfo((object)("Keeping OFF fence: " + name));
					((Component)child).gameObject.SetActive(false);
				}
				else if (name == "Check In desk" || name == "AirportGateKiosk")
				{
					Logger.LogInfo((object)("Keeping ON kiosk/desk: " + name));
					((Component)child).gameObject.SetActive(true);
					if (name == "Check In desk")
					{
						EnsureCheckInDeskChildrenOn(child);
					}
				}
			}
		}
	}

	private void EnsureCheckInDeskChildrenOn(Transform checkInDesk)
	{
		Logger.LogInfo((object)"Ensuring ALL children of Check In desk stay ON...");
		for (int i = 0; i < checkInDesk.childCount; i++)
		{
			Transform child = checkInDesk.GetChild(i);
			Logger.LogInfo((object)("Keeping ON Check In desk child: " + ((Object)child).name));
			((Component)child).gameObject.SetActive(true);
			for (int j = 0; j < child.childCount; j++)
			{
				Transform child2 = child.GetChild(j);
				Logger.LogInfo((object)("Keeping ON Check In desk grandchild: " + ((Object)child2).name));
				((Component)child2).gameObject.SetActive(true);
			}
		}
	}

	private void ProcessVegetation(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing vegetation...");
		foreach (GameObject val in rootObjects)
		{
			Transform val2 = FindDeepChild(val.transform, "Vegetation");
			if ((Object)(object)val2 != (Object)null)
			{
				Logger.LogInfo((object)("Found Vegetation parent: " + ((Object)val2).name + ", keeping OFF all children..."));
				((Component)val2).gameObject.SetActive(false);
			}
		}
	}

	private void ProcessLights(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing lights...");
		foreach (GameObject val in rootObjects)
		{
			Transform val2 = FindDeepChild(val.transform, "Lights");
			if ((Object)(object)val2 != (Object)null)
			{
				Logger.LogInfo((object)("Found Lights parent: " + ((Object)val2).name + ", keeping OFF all children..."));
				((Component)val2).gameObject.SetActive(false);
			}
		}
	}

	private void ProcessDisplays(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing displays...");
		foreach (GameObject val in rootObjects)
		{
			Transform val2 = FindDeepChild(val.transform, "Displays");
			if ((Object)(object)val2 != (Object)null)
			{
				Logger.LogInfo((object)("Found Displays parent: " + ((Object)val2).name + ", keeping OFF all children..."));
				((Component)val2).gameObject.SetActive(false);
			}
		}
	}

	private void ProcessBakeData(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing bake data...");
		foreach (GameObject val in rootObjects)
		{
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			Transform[] array = componentsInChildren;
			foreach (Transform val2 in array)
			{
				if (((Object)val2).name.ToLower().Contains("bakedata"))
				{
					Logger.LogInfo((object)("Found BakeData: " + ((Object)val2).name + ", keeping OFF all children..."));
					((Component)val2).gameObject.SetActive(false);
				}
			}
		}
	}

	private void ProcessLuggage(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing luggage...");
		foreach (GameObject val in rootObjects)
		{
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			Transform[] array = componentsInChildren;
			foreach (Transform val2 in array)
			{
				if (((Object)val2).name.ToLower().Contains("luggage"))
				{
					Logger.LogInfo((object)("Keeping OFF luggage: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
			}
		}
	}

	private void ProcessAdditionalObjects(GameObject[] rootObjects)
	{
		Logger.LogInfo((object)"Processing additional objects from images...");
		foreach (GameObject val in rootObjects)
		{
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			Transform[] array = componentsInChildren;
			foreach (Transform val2 in array)
			{
				string text = ((Object)val2).name.ToLower();
				if (text.Contains("glassfence"))
				{
					Logger.LogInfo((object)("Turning OFF GlassFence: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("flight board"))
				{
					Logger.LogInfo((object)("Turning OFF Flight Board: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("stanchion"))
				{
					Logger.LogInfo((object)("Turning OFF stanchion: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("climbing wall"))
				{
					Logger.LogInfo((object)("Turning OFF climbing wall: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("mat") && !text.Contains("airport") && !text.Contains("armature"))
				{
					Logger.LogInfo((object)("Turning OFF mat: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("ropeanchor") || text.Contains("ropebone") || text.Contains("ropemesh"))
				{
					Logger.LogInfo((object)("Turning OFF rope object: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("bakelight"))
				{
					Logger.LogInfo((object)("Turning OFF bake light: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("trash"))
				{
					Logger.LogInfo((object)("Turning OFF trash: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("outofboundsblocker"))
				{
					Logger.LogInfo((object)("Turning OFF out of bounds blocker: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("conveyor") || text.Contains("movezone"))
				{
					Logger.LogInfo((object)("Turning OFF conveyor: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("basic rail"))
				{
					Logger.LogInfo((object)("Turning OFF basic rail: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("ropesegment"))
				{
					Logger.LogInfo((object)("Turning OFF rope segment: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("post fog"))
				{
					Logger.LogInfo((object)("Turning OFF post fog: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("desk") && !text.Contains("check in") && !text.Contains("airportgate"))
				{
					Logger.LogInfo((object)("Turning OFF desk: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
				else if (text.Contains("gate") && !IsChildOfCheckInDesk(val2))
				{
					Logger.LogInfo((object)("Turning OFF gate: " + ((Object)val2).name));
					((Component)val2).gameObject.SetActive(false);
				}
			}
		}
	}

	private bool IsChildOfCheckInDesk(Transform transform)
	{
		Transform parent = transform.parent;
		while ((Object)(object)parent != (Object)null)
		{
			if (((Object)parent).name.Contains("Check In desk") || ((Object)parent).name.Contains("AirportGateKiosk"))
			{
				return true;
			}
			parent = parent.parent;
		}
		return false;
	}

	private void ProcessSpecificRequests(GameObject[] rootObjects)
	{
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		//IL_047a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ff: 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_0520: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Unknown result type (might be due to invalid IL or missing references)
		Logger.LogInfo((object)"Processing specific user requests...");
		foreach (GameObject val in rootObjects)
		{
			Transform val2 = FindDeepChild(val.transform, "Kiosk (2)");
			if ((Object)(object)val2 != (Object)null)
			{
				Logger.LogInfo((object)"Found Kiosk (2), turning ON as requested...");
				((Component)val2).gameObject.SetActive(true);
			}
		}
		foreach (GameObject val3 in rootObjects)
		{
			Transform val4 = FindDeepChild(val3.transform, "Cube (10)");
			if ((Object)(object)val4 != (Object)null)
			{
				Logger.LogInfo((object)"Found Cube (10), turning OFF as requested...");
				((Component)val4).gameObject.SetActive(false);
			}
		}
		Logger.LogInfo((object)"Using GameObject.Find to target specific Cube (2) under Mirror (1) → Details...");
		GameObject val5 = GameObject.Find("Map/Mirror (1)/Details/Cube (2)");
		if ((Object)(object)val5 != (Object)null)
		{
			Logger.LogInfo((object)"Found TARGET Cube (2) using GameObject.Find, turning OFF as requested...");
			val5.SetActive(false);
			if (val5.activeInHierarchy)
			{
				Logger.LogWarning((object)"TARGET Cube (2) is still active after SetActive(false), trying again...");
				val5.SetActive(false);
			}
			else
			{
				Logger.LogInfo((object)"TARGET Cube (2) successfully turned OFF");
			}
		}
		else
		{
			Logger.LogWarning((object)"TARGET Cube (2) not found using GameObject.Find path: Map/Mirror (1)/Details/Cube (2)");
		}
		Logger.LogInfo((object)"Using GameObject.Find to target Mirror under Mirror (1) and remove texture...");
		GameObject val6 = GameObject.Find("Map/Mirror (1)/Mirror");
		if ((Object)(object)val6 != (Object)null)
		{
			Logger.LogInfo((object)"Found Mirror using GameObject.Find, removing texture to make it clean...");
			MeshRenderer component = val6.GetComponent<MeshRenderer>();
			if ((Object)(object)component != (Object)null && (Object)(object)((Renderer)component).material != (Object)null)
			{
				((Renderer)component).material.SetTexture("_TextureSample0", (Texture)null);
				Logger.LogInfo((object)"Successfully removed texture from Mirror, it should now appear clean");
			}
			else
			{
				Logger.LogWarning((object)"Mirror found but no MeshRenderer or material component");
			}
		}
		else
		{
			Logger.LogWarning((object)"Mirror not found using GameObject.Find path: Map/Mirror (1)/Mirror");
		}
		Logger.LogInfo((object)"Using GameObject.Find to target Map/Cube and turn it OFF...");
		GameObject val7 = GameObject.Find("Map/Cube");
		if ((Object)(object)val7 != (Object)null)
		{
			Logger.LogInfo((object)"Found Map/Cube using GameObject.Find, turning OFF as requested...");
			val7.SetActive(false);
		}
		else
		{
			Logger.LogWarning((object)"Map/Cube not found using GameObject.Find path: Map/Cube");
		}
		Logger.LogInfo((object)"Using GameObject.Find to target Map/BL_Airport/Fences/Check In desk/Desk and turn it ON...");
		GameObject val8 = GameObject.Find("Map/BL_Airport/Fences/Check In desk/Desk");
		if ((Object)(object)val8 != (Object)null)
		{
			Logger.LogInfo((object)"Found Map/BL_Airport/Fences/Check In desk/Desk using GameObject.Find, turning ON as requested...");
			val8.SetActive(true);
		}
		else
		{
			Logger.LogWarning((object)"Map/BL_Airport/Fences/Check In desk/Desk not found using GameObject.Find path: Map/BL_Airport/Fences/Check In Desk/Desk");
		}
		Logger.LogInfo((object)"Using GameObject.Find to target Map/BL_Airport/Fences/Check In desk/Desk (1) and turn it ON...");
		GameObject val9 = GameObject.Find("Map/BL_Airport/Fences/Check In desk/Desk (1)");
		if ((Object)(object)val9 != (Object)null)
		{
			Logger.LogInfo((object)"Found Map/BL_Airport/Fences/Check In desk/Desk (1) using GameObject.Find, turning ON as requested...");
			val9.SetActive(true);
		}
		else
		{
			Logger.LogWarning((object)"Map/BL_Airport/Fences/Check In desk/Desk (1) not found using GameObject.Find path: Map/BL_Airport/Fences/Check In Desk/Desk (1)");
		}
		Logger.LogInfo((object)"Using GameObject.Find to target specific seating children and turn them OFF...");
		GameObject val10 = GameObject.Find("Map/BL_Airport/Seats");
		if ((Object)(object)val10 != (Object)null)
		{
			int[] array = new int[8] { 1, 3, 4, 5, 6, 7, 8, 12 };
			int[] array2 = array;
			foreach (int num in array2)
			{
				if (num < val10.transform.childCount)
				{
					Transform child = val10.transform.GetChild(num);
					Logger.LogInfo((object)$"Turning OFF seating child {num}: {((Object)child).name}");
					((Component)child).gameObject.SetActive(false);
				}
				else
				{
					Logger.LogWarning((object)$"Seating child index {num} not found (parent only has {val10.transform.childCount} children)");
				}
			}
		}
		else
		{
			Logger.LogWarning((object)"Seating parent not found using GameObject.Find path: Map/BL_Airport/Seats");
		}
		Logger.LogInfo((object)"Setting AirportGateKiosk position to -0.83 1.6 101.5...");
		GameObject val11 = GameObject.Find("Map/BL_Airport/Fences/Check In desk/AirportGateKiosk");
		if ((Object)(object)val11 != (Object)null)
		{
			Vector3 val12 = default(Vector3);
			((Vector3)(ref val12))..ctor(-0.83f, 1.6f, 101.5f);
			val11.transform.position = val12;
			Logger.LogInfo((object)$"Successfully set AirportGateKiosk position to {val12}");
		}
		else
		{
			Logger.LogWarning((object)"AirportGateKiosk not found using GameObject.Find path: Map/BL_Airport/Fences/Check In desk/AirportGateKiosk");
		}
		Logger.LogInfo((object)"Setting Kiosk (2) position to -6.8 1.5 54.0999 and rotation to 270.0969 90.1463 0...");
		GameObject val13 = GameObject.Find("Map/BL_Airport/Fences/Kiosk (2)");
		if ((Object)(object)val13 != (Object)null)
		{
			Vector3 val14 = default(Vector3);
			((Vector3)(ref val14))..ctor(-6.8f, 1.5f, 54.0999f);
			Vector3 val15 = default(Vector3);
			((Vector3)(ref val15))..ctor(270f, 270f, 0f);
			val13.transform.position = val14;
			val13.transform.eulerAngles = val15;
			Logger.LogInfo((object)$"Successfully set Kiosk (2) position to {val14} and rotation to {val15}");
		}
		else
		{
			Logger.LogWarning((object)"Kiosk (2) not found using GameObject.Find path: Map/BL_Airport/Fences/Kiosk (2)");
		}
		Logger.LogInfo((object)"Setting up synchronized gates with interactable functionality...");
		SetupSynchronizedGates();
	}

	private void SetupSynchronizedGates()
	{
		//IL_0054: 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)
		GameObject val = GameObject.Find("Map/BL_Airport/Fences/Check In desk/Desk/Gate");
		GameObject val2 = GameObject.Find("Map/BL_Airport/Fences/Check In desk/Desk (1)/Gate");
		if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
		{
			Logger.LogInfo((object)"Found both gates, setting up synchronized interaction...");
			val.transform.eulerAngles = new Vector3(270f, 180f, 0f);
			val2.transform.eulerAngles = new Vector3(270f, 180f, 0f);
			GateController gateController = val.AddComponent<GateController>();
			gateController.Initialize(val, val2);
			Logger.LogInfo((object)"Successfully set up synchronized gates with interactable functionality");
		}
		else
		{
			Logger.LogWarning((object)("Gates not found - Gate1: " + (((Object)(object)val != (Object)null) ? "Found" : "Not Found") + ", Gate2: " + (((Object)(object)val2 != (Object)null) ? "Found" : "Not Found")));
		}
	}

	private Transform FindDeepChild(Transform parent, string name)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		foreach (Transform item in parent)
		{
			Transform val = item;
			if (((Object)val).name == name)
			{
				return val;
			}
			Transform val2 = FindDeepChild(val, name);
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
		}
		return null;
	}
}
public interface IInteractible
{
	bool IsInteractible(Character interactor);

	void Interact(Character interactor);

	void HoverEnter();

	void HoverExit();

	Vector3 Center();

	Transform GetTransform();

	string GetInteractionText();

	string GetName();
}
public class GateController : MonoBehaviour, IInteractible
{
	private GameObject gate1;

	private GameObject gate2;

	private bool isOpen = false;

	private MaterialPropertyBlock mpb;

	private MeshRenderer[] meshRenderers;

	private Vector3 gate1Closed = new Vector3(270f, 180f, 0f);

	private Vector3 gate2Closed = new Vector3(270f, 180f, 0f);

	private Vector3 gate1Open = new Vector3(270f, 90f, 0f);

	private Vector3 gate2Open = new Vector3(270f, 270f, 0f);

	private float proximityThreshold = 2f;

	private float checkInterval = 0.1f;

	private float lastCheckTime = 0f;

	public void Initialize(GameObject g1, GameObject g2)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		gate1 = g1;
		gate2 = g2;
		mpb = new MaterialPropertyBlock();
		meshRenderers = ((Component)this).GetComponentsInChildren<MeshRenderer>();
	}

	private void Update()
	{
		if (Time.time - lastCheckTime >= checkInterval)
		{
			lastCheckTime = Time.time;
			CheckPlayerProximityAndControlGates();
		}
	}

	private void CheckPlayerProximityAndControlGates()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		Character[] array = Object.FindObjectsOfType<Character>();
		bool flag = false;
		Character[] array2 = array;
		foreach (Character val in array2)
		{
			if ((Object)(object)val != (Object)null && (Object)(object)val.data != (Object)null)
			{
				Vector3 groundPos = val.data.groundPos;
				float num = Vector3.Distance(groundPos, gate1.transform.position);
				if (num <= proximityThreshold)
				{
					flag = true;
					break;
				}
			}
		}
		if (flag && !isOpen)
		{
			OpenGates();
		}
		else if (!flag && isOpen)
		{
			CloseGates();
		}
	}

	private void OpenGates()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		gate1.transform.eulerAngles = gate1Open;
		gate2.transform.eulerAngles = gate2Open;
		isOpen = true;
		Debug.Log((object)"Gates automatically opened due to player proximity");
	}

	private void CloseGates()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		gate1.transform.eulerAngles = gate1Closed;
		gate2.transform.eulerAngles = gate2Closed;
		isOpen = false;
		Debug.Log((object)"Gates automatically closed - player no longer nearby");
	}

	public bool IsInteractible(Character interactor)
	{
		return true;
	}

	public void Interact(Character interactor)
	{
		if (isOpen)
		{
			CloseGates();
		}
		else
		{
			OpenGates();
		}
	}

	public void SetProximityThreshold(float newThreshold)
	{
		proximityThreshold = newThreshold;
		Debug.Log((object)$"Gate proximity threshold set to: {proximityThreshold}");
	}

	public void HoverEnter()
	{
		if (mpb == null || meshRenderers == null)
		{
			return;
		}
		mpb.SetFloat("_Interactable", 1f);
		MeshRenderer[] array = meshRenderers;
		foreach (MeshRenderer val in array)
		{
			if ((Object)(object)val != (Object)null)
			{
				((Renderer)val).SetPropertyBlock(mpb);
			}
		}
	}

	public void HoverExit()
	{
		if (mpb == null || meshRenderers == null)
		{
			return;
		}
		mpb.SetFloat("_Interactable", 0f);
		MeshRenderer[] array = meshRenderers;
		foreach (MeshRenderer val in array)
		{
			if ((Object)(object)val != (Object)null)
			{
				((Renderer)val).SetPropertyBlock(mpb);
			}
		}
	}

	public Vector3 Center()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		return ((Component)this).transform.position;
	}

	public Transform GetTransform()
	{
		return ((Component)this).transform;
	}

	public string GetInteractionText()
	{
		return isOpen ? "Gates are open (automatic)" : "Gates are closed (automatic)";
	}

	public string GetName()
	{
		return "Airport Gates";
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "tony4twentys.Airport_Remixed";

	public const string PLUGIN_NAME = "Airport Remixed";

	public const string PLUGIN_VERSION = "1.0.0";
}