Decompiled source of Synthesis Moon v1.1.3

bauyrsaq.SynthesisAssembly.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SynthesisLift.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.UI;
using bauyrsaq.SynthesisAssembly.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("bauyrsaq.SynthesisAssembly")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-dev")]
[assembly: AssemblyProduct("SynthesisLift")]
[assembly: AssemblyTitle("bauyrsaq.SynthesisAssembly")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SynthesisLift
{
	[BepInPlugin("bauyrsaq.SynthesisAssembly", "SynthesisLift", "0.0.0")]
	public class SynthesisLift : BaseUnityPlugin
	{
		public static SynthesisLift Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			NetcodePatcher();
			Patch();
			Logger.LogInfo((object)"bauyrsaq.SynthesisAssembly v0.0.0 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("bauyrsaq.SynthesisAssembly");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(typeof(SynthesisLift));
			Harmony.PatchAll(typeof(PlayerControllerBPatch));
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
			Logger.LogDebug((object)"!!!! Lift Controller script is ready to use on Synthesis Moon !!!!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		private void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "bauyrsaq.SynthesisAssembly";

		public const string PLUGIN_NAME = "SynthesisLift";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace SynthesisLift.Patches
{
	public class MaskedLeverTrigger : MonoBehaviour
	{
		[Header("Trigger for Maskeds to open Big Door")]
		[Space]
		[SerializeField]
		private SynthesisController liftScript;

		private void OnTriggerEnter(Collider other)
		{
			MaskedPlayerEnemy val = default(MaskedPlayerEnemy);
			if (((Component)other).CompareTag("Player") && ((Component)other).TryGetComponent<MaskedPlayerEnemy>(ref val))
			{
				OpenBigDoor();
			}
		}

		public void OpenBigDoor()
		{
			if (!liftScript.isOpen)
			{
				liftScript.ToggleBigDoor();
				SynthesisLift.Logger.LogDebug((object)"Masked using big door inside entrance building.");
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void Start_Prefix(PlayerControllerB __instance, ref bool ___isCameraDisabled)
		{
			((Component)__instance).gameObject.AddComponent<PlayerElevatorManager>();
		}
	}
	public class PlayerElevatorManager : MonoBehaviour
	{
		private PlayerControllerB playerControllerB;

		private void Start()
		{
			playerControllerB = ((Component)this).GetComponent<PlayerControllerB>();
		}
	}
	public class SynthesisController : NetworkBehaviour
	{
		[Header("Lift Settings")]
		[SerializeField]
		private GameObject liftLightsObj;

		[SerializeField]
		private Animator liftSelf;

		[SerializeField]
		private Animator liftInterior;

		[Space]
		[SerializeField]
		private Animator liftDoorL;

		[SerializeField]
		private Animator liftDoorR;

		[HideInInspector]
		public bool isOnUp = true;

		[HideInInspector]
		public bool isMoving = false;

		private Transform defaultPlayerContainer;

		[SerializeField]
		private Text lift3dText;

		[SerializeField]
		private GameObject liftApparatus;

		[SerializeField]
		private Transform liftApparatusPos;

		[SerializeField]
		private GameObject apparatusTrigger;

		[SerializeField]
		private List<Transform> apparatusPositions = new List<Transform>();

		[SerializeField]
		private List<MeshRenderer> lights = new List<MeshRenderer>();

		[SerializeField]
		private Material lightsOffMat;

		[SerializeField]
		private Material lightsOnMat;

		public bool liftHasPower = false;

		public AudioSource liftSound;

		public AudioSource doorsSound;

		public AudioSource pffSound;

		public AudioSource slamSound;

		private PlayerControllerB player;

		[Space]
		[Header("Big Door Settings")]
		[SerializeField]
		private Animator bigDoorAnimator;

		[SerializeField]
		private GameObject killTrigger;

		[SerializeField]
		private Animator leverAnimator1;

		[SerializeField]
		private Animator leverAnimator2;

		[Space]
		[SerializeField]
		private MeshRenderer lightMesh;

		[SerializeField]
		private Material lightRed_Off;

		[SerializeField]
		private Material lightRed_On;

		[HideInInspector]
		public bool isOpen = false;

		[HideInInspector]
		public bool isBeingUsed = false;

		[SerializeField]
		private Transform spinLight;

		public AudioSource doorSound;

		private bool updateApparatusPos = false;

		private bool gameStarted = false;

		private bool startChecking = true;

		private GameObject liftHolder;

		public GameObject shelfSpawner;

		private GameObject shelfSelf;

		private InteractTrigger fireExitDoor;

		private AudioSource liftRadioSound;

		public void Awake()
		{
			SynthesisLift.Logger.LogDebug((object)"Flashing light. lights.. lights...");
			((MonoBehaviour)this).StartCoroutine(FlashingLights());
		}

		public IEnumerator FlashingLights()
		{
			SynthesisLift.Logger.LogDebug((object)"On coroutine");
			yield return (object)new WaitForSeconds(3f);
			SetStartCheck();
			SynthesisLift.Logger.LogDebug((object)"Start Checking!");
		}

		public void SetStartCheck()
		{
			startChecking = true;
		}

		private GameObject FindGameObjectStartingWith(string prefix)
		{
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (((Object)val).name.StartsWith(prefix))
				{
					return val;
				}
			}
			return null;
		}

		public void SynthStartLater()
		{
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			isOpen = false;
			if ((Object)(object)liftApparatus == (Object)null)
			{
				liftHolder = GameObject.Find("LiftLungApparatus");
				SynthesisLift.Logger.LogWarning((object)"Setting null apparatus");
			}
			((GrabbableObject)liftApparatus.GetComponent<LungProp>()).grabbable = true;
			((GrabbableObject)liftApparatus.GetComponent<LungProp>()).isHeld = false;
			((GrabbableObject)liftApparatus.GetComponent<LungProp>()).isHeldByEnemy = false;
			liftRadioSound = GameObject.Find("LiftSpeakerAudio").GetComponent<AudioSource>();
			liftRadioSound.Stop();
			liftHolder = GameObject.Find("_LHolder");
			if ((Object)(object)liftHolder == (Object)null)
			{
				SynthesisLift.Logger.LogError((object)"Lift Holder is null!");
			}
			shelfSelf = FindGameObjectStartingWith("LiftStorageShelf");
			if ((Object)(object)shelfSelf == (Object)null)
			{
				SynthesisLift.Logger.LogError((object)"Shelf is null!");
			}
			else
			{
				shelfSelf.transform.parent = liftHolder.transform.parent;
				shelfSelf.transform.position = shelfSpawner.transform.position;
				shelfSelf.transform.rotation = shelfSpawner.transform.rotation;
			}
			fireExitDoor = GameObject.Find("EntranceTeleportB").GetComponent<InteractTrigger>();
			if ((Object)(object)fireExitDoor == (Object)null)
			{
				SynthesisLift.Logger.LogError((object)"Fire exit is null!");
			}
			foreach (MeshRenderer light in lights)
			{
				((Renderer)light).material = lightsOffMat;
			}
			PlaceApparatusRandomPos();
			killTrigger.SetActive(false);
			liftLightsObj.SetActive(false);
			liftDoorL.SetTrigger("Open");
			liftDoorR.SetTrigger("Open");
			lift3dText.text = " ";
		}

		[ServerRpc(RequireOwnership = false)]
		public void StartGame_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3211725304u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3211725304u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					StartGame_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void StartGame_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1282339256u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1282339256u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			isOpen = false;
			apparatusTrigger = GameObject.Find("ApparatusTrigger");
			liftHolder = GameObject.Find("_!LHolder");
			shelfSpawner = GameObject.Find("LiftStorageShelfSpawn");
			shelfSelf = GameObject.Find("LiftStorageShelfContainer");
			fireExitDoor = GameObject.Find("EntranceTeleportB").GetComponent<InteractTrigger>();
			shelfSelf.transform.parent = liftHolder.transform.parent;
			shelfSelf.transform.position = shelfSpawner.transform.position;
			shelfSelf.transform.rotation = shelfSpawner.transform.rotation;
			foreach (MeshRenderer light in lights)
			{
				((Renderer)light).material = lightsOffMat;
			}
			PlaceApparatusRandomPos();
			killTrigger.SetActive(false);
			liftLightsObj.SetActive(false);
			liftDoorL.SetTrigger("Open");
			liftDoorR.SetTrigger("Open");
		}

		private void Update()
		{
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			if (startChecking && !gameStarted && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.fullyLoadedPlayers.Count >= GameNetworkManager.Instance.connectedPlayers)
			{
				((MonoBehaviour)this).Invoke("SynthStartLater", 4f);
				gameStarted = true;
			}
			if (updateApparatusPos && gameStarted && !((Object)(object)liftApparatus == (Object)null) && !((Object)(object)liftApparatus.GetComponent<LungProp>() == (Object)null))
			{
				lift3dText.text = "...";
				fireExitDoor.interactable = true;
				((GrabbableObject)liftApparatus.GetComponent<LungProp>()).isHeldByEnemy = false;
				((GrabbableObject)liftApparatus.GetComponent<LungProp>()).hasBeenHeld = true;
				liftApparatus.GetComponent<LungProp>().sparkParticle.SetActive(true);
				liftApparatus.GetComponent<LungProp>().isLungDockedInElevator = true;
				liftApparatus.GetComponentInChildren<Collider>().enabled = false;
				((Behaviour)liftApparatus.GetComponent<LungProp>()).enabled = false;
				liftApparatus.GetComponent<AudioSource>().Play();
				liftApparatus.transform.parent = ((Component)liftApparatusPos).transform;
				liftApparatus.transform.SetPositionAndRotation(((Component)liftApparatusPos).transform.position, ((Component)liftApparatusPos).transform.rotation);
			}
		}

		public void PlaceApparatusRandomPos()
		{
			int lastDigit = GetLastDigit(StartOfRound.Instance.randomMapSeed);
			int num = lastDigit;
		}

		private int GetLastDigit(int number)
		{
			return Mathf.Abs(number) % 10;
		}

		public void ToggleLift()
		{
			ToggleLiftServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleLiftServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(454021743u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 454021743u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SynthesisLift.Logger.LogDebug((object)"Tryna use Lift");
					ToggleLiftClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ToggleLiftClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3765726848u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3765726848u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !liftHasPower)
			{
				return;
			}
			if ((Object)(object)liftInterior != (Object)null && (Object)(object)liftSelf != (Object)null)
			{
				if (!isMoving)
				{
					if (!isOnUp)
					{
						((MonoBehaviour)this).StartCoroutine(MoveLift(moveDown: false));
						isOnUp = true;
						SynthesisLift.Logger.LogDebug((object)"Moving Up Lift");
					}
					else
					{
						((MonoBehaviour)this).StartCoroutine(MoveLift(moveDown: true));
						isOnUp = false;
						SynthesisLift.Logger.LogDebug((object)"Moving Down Lift");
					}
				}
			}
			else
			{
				SynthesisLift.Logger.LogDebug((object)"Animators are null!");
			}
		}

		public IEnumerator MoveLift(bool moveDown)
		{
			isMoving = true;
			liftRadioSound.Play();
			yield return (object)new WaitForSeconds(0.1f);
			doorsSound.Play();
			liftDoorL.SetTrigger("Close");
			liftDoorR.SetTrigger("Close");
			yield return (object)new WaitForSeconds(0.55f);
			slamSound.Play();
			lift3dText.text = "Moving";
			liftInterior.SetTrigger("start");
			yield return (object)new WaitForSeconds(0.47f);
			liftSound.Play();
			if (moveDown)
			{
				liftSelf.SetTrigger("goDown");
			}
			else
			{
				liftSelf.SetTrigger("goUp");
			}
			yield return (object)new WaitForSeconds(6.325f);
			liftSound.Stop();
			doorsSound.Play();
			liftDoorL.SetTrigger("Open");
			liftDoorR.SetTrigger("Open");
			yield return (object)new WaitForSeconds(0.1f);
			pffSound.Play();
			yield return (object)new WaitForSeconds(0.45f);
			lift3dText.text = "Free";
			liftRadioSound.Stop();
			isMoving = false;
		}

		public void PlaceApparatusLift()
		{
			if (!liftHasPower && ((GrabbableObject)liftApparatus.GetComponent<LungProp>()).isHeld && (Object)(object)((GrabbableObject)liftApparatus.GetComponent<LungProp>()).playerHeldBy == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				PlaceApparatusLiftServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlaceApparatusLiftServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3462126603u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3462126603u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlaceApparatusLiftClientRpc();
					PlaceApparatusLiftNoRpc();
				}
			}
		}

		[ClientRpc]
		private void PlaceApparatusLiftClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2332923323u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2332923323u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlaceApparatusLiftNoRpc();
				}
			}
		}

		public void PlaceApparatusLiftNoRpc()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			((Collider)liftApparatus.GetComponent<BoxCollider>()).enabled = false;
			apparatusTrigger.SetActive(false);
			((GrabbableObject)liftApparatus.GetComponent<LungProp>()).playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
			((GrabbableObject)liftApparatus.GetComponent<LungProp>()).isHeldByEnemy = false;
			((GrabbableObject)liftApparatus.GetComponent<LungProp>()).hasBeenHeld = true;
			liftApparatus.GetComponent<LungProp>().sparkParticle.SetActive(true);
			((MonoBehaviour)this).Invoke("DisableSparkleEffect", 0.3f);
			liftApparatus.GetComponent<LungProp>().isLungDockedInElevator = true;
			liftApparatus.GetComponentInChildren<Collider>().enabled = false;
			((Behaviour)liftApparatus.GetComponent<LungProp>()).enabled = false;
			liftApparatus.GetComponent<AudioSource>().Play();
			liftApparatus.transform.parent = ((Component)liftApparatusPos).transform;
			liftApparatus.transform.SetPositionAndRotation(((Component)liftApparatusPos).transform.position, ((Component)liftApparatusPos).transform.rotation);
			liftLightsObj.SetActive(true);
			foreach (MeshRenderer light in lights)
			{
				((Renderer)light).material = lightsOnMat;
			}
			updateApparatusPos = true;
			((MonoBehaviour)this).Invoke("ResetApparatus", 1.8f);
			liftHasPower = true;
		}

		private void DisableSparkleEffect()
		{
			liftApparatus.GetComponent<LungProp>().sparkParticle.SetActive(false);
		}

		private void ResetApparatus()
		{
			updateApparatusPos = false;
		}

		public void ToggleBigDoor()
		{
			ToggleBigDoorServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleBigDoorServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3809848559u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3809848559u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ToggleBigDoorClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ToggleBigDoorClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2764790813u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2764790813u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !isBeingUsed)
			{
				if (!isOpen)
				{
					((MonoBehaviour)this).StartCoroutine(UseBigDoorCoroutine(open: true));
					isOpen = true;
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(UseBigDoorCoroutine(open: false));
					isOpen = false;
				}
			}
		}

		public IEnumerator UseBigDoorCoroutine(bool open)
		{
			isBeingUsed = true;
			leverAnimator1.SetBool("Open", open);
			leverAnimator2.SetBool("Open", open);
			yield return (object)new WaitForSeconds(0.1f);
			((Renderer)lightMesh).material = lightRed_On;
			((Component)spinLight).gameObject.SetActive(true);
			yield return (object)new WaitForSeconds(0.3f);
			doorSound.Play();
			bigDoorAnimator.SetBool("Open", open);
			if (!open)
			{
				killTrigger.SetActive(true);
			}
			yield return (object)new WaitForSeconds(8f);
			((Renderer)lightMesh).material = lightRed_Off;
			((Component)spinLight).gameObject.SetActive(false);
			killTrigger.SetActive(false);
			isBeingUsed = false;
		}

		public void OnDestroy()
		{
			Object.Destroy((Object)(object)liftApparatus.gameObject);
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SynthesisController()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3211725304u, new RpcReceiveHandler(__rpc_handler_3211725304));
			NetworkManager.__rpc_func_table.Add(1282339256u, new RpcReceiveHandler(__rpc_handler_1282339256));
			NetworkManager.__rpc_func_table.Add(454021743u, new RpcReceiveHandler(__rpc_handler_454021743));
			NetworkManager.__rpc_func_table.Add(3765726848u, new RpcReceiveHandler(__rpc_handler_3765726848));
			NetworkManager.__rpc_func_table.Add(3462126603u, new RpcReceiveHandler(__rpc_handler_3462126603));
			NetworkManager.__rpc_func_table.Add(2332923323u, new RpcReceiveHandler(__rpc_handler_2332923323));
			NetworkManager.__rpc_func_table.Add(3809848559u, new RpcReceiveHandler(__rpc_handler_3809848559));
			NetworkManager.__rpc_func_table.Add(2764790813u, new RpcReceiveHandler(__rpc_handler_2764790813));
		}

		private static void __rpc_handler_3211725304(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SynthesisController)(object)target).StartGame_ServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1282339256(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SynthesisController)(object)target).StartGame_ClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_454021743(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SynthesisController)(object)target).ToggleLiftServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3765726848(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SynthesisController)(object)target).ToggleLiftClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3462126603(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SynthesisController)(object)target).PlaceApparatusLiftServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2332923323(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SynthesisController)(object)target).PlaceApparatusLiftClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3809848559(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SynthesisController)(object)target).ToggleBigDoorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2764790813(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SynthesisController)(object)target).ToggleBigDoorClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SynthesisController";
		}
	}
	public class SynthesisReplaceShip : MonoBehaviour
	{
		public AnimationClip customHangarShipLandClip;

		public AnimationClip customFlyingFromMoonClip;

		private Animator hangarShipAnimator;

		private AnimationClip originalHangarShipLandClip;

		private AnimationClip originalFlyingFromMoonClip;

		private RuntimeAnimatorController animatorController;

		private void Start()
		{
			GameObject val = GameObject.Find("HangarShip");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"HangarShip GameObject not found.");
				return;
			}
			hangarShipAnimator = val.GetComponent<Animator>();
			if ((Object)(object)hangarShipAnimator == (Object)null)
			{
				Debug.LogError((object)"Animator component not found on HangarShip.");
				return;
			}
			animatorController = hangarShipAnimator.runtimeAnimatorController;
			AnimationClip[] animationClips = animatorController.animationClips;
			foreach (AnimationClip val2 in animationClips)
			{
				if (((Object)val2).name == "HangarShipLandB")
				{
					originalHangarShipLandClip = val2;
				}
				else if (((Object)val2).name == "ShipLeave")
				{
					originalFlyingFromMoonClip = val2;
				}
			}
			if ((Object)(object)originalHangarShipLandClip == (Object)null)
			{
				Debug.LogError((object)"Animation clip HangarShipLand not found in the Animator.");
			}
			if ((Object)(object)originalFlyingFromMoonClip == (Object)null)
			{
				Debug.LogError((object)"Animation clip FlyingFromMoon not found in the Animator.");
			}
			ReplaceAnimationClips(customHangarShipLandClip, customFlyingFromMoonClip);
		}

		private void ReplaceAnimationClips(AnimationClip newHangarShipLandClip, AnimationClip newFlyingFromMoonClip)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)animatorController != (Object)null)
			{
				AnimatorOverrideController val = new AnimatorOverrideController(animatorController);
				if ((Object)(object)originalHangarShipLandClip != (Object)null && (Object)(object)newHangarShipLandClip != (Object)null)
				{
					val[originalHangarShipLandClip] = newHangarShipLandClip;
					Debug.Log((object)"Replaced HangarShipLand with the custom animation clip.");
				}
				hangarShipAnimator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val;
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)hangarShipAnimator != (Object)null && (Object)(object)animatorController != (Object)null)
			{
				hangarShipAnimator.runtimeAnimatorController = animatorController;
				Debug.Log((object)"Reverted to the original HangarShipLand and FlyingFromMoon animation clips.");
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace bauyrsaq.SynthesisAssembly.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}