Decompiled source of 48 Contingency v1.0.0

48contingency.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using 48contingency.NetcodePatcher;
using BepInEx;
using BepInEx.Logging;
using Dawn;
using GameNetcodeStuff;
using HarmonyLib;
using JLL.Components;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[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: AssemblyCompany("48contingency")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d44cc4d98c55e08eb1f2ac40ff65493bbc4acd02")]
[assembly: AssemblyProduct("48contingency")]
[assembly: AssemblyTitle("48contingency")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 OpaliteMoonMod
{
	public class ApparatusDockHandler : NetworkBehaviour
	{
		public bool isPowered;

		public RoundManager roundManager;

		public Animator thisDockAnimator;

		public AudioSource dockingPointAudio;

		private Coroutine connectAnimation;

		private Coroutine roomPowerAnimation;

		private Coroutine roomFlickerAnimation;

		public AudioClip[] dockingAudios;

		public Transform apparatusPoint;

		private LungProp dockedApparatus;

		public Animator DockLightAnimator;

		public float timeAtLastUse;

		public GameObject[] poweredRoomObjects;

		public List<Animator> poweredRoomLightAnimators = new List<Animator>();

		private InteractTrigger triggerScript;

		private float playbackTime;

		private void Awake()
		{
			isPowered = false;
			triggerScript = ((Component)this).gameObject.GetComponent<InteractTrigger>();
			GameObject[] array = poweredRoomObjects;
			foreach (GameObject val in array)
			{
				Animator component = val.GetComponent<Animator>();
				if ((Object)(object)component != (Object)null)
				{
					poweredRoomLightAnimators.Add(component);
					component.SetBool("On", false);
				}
			}
		}

		private void Start()
		{
			roundManager = Object.FindObjectOfType<RoundManager>();
		}

		public void FinishOpening()
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!GetDockAnimators())
			{
				return;
			}
			thisDockAnimator.SetBool("Open", false);
			NetworkObject apparatusFromInteractingPlayer = GetApparatusFromInteractingPlayer();
			if ((Object)(object)apparatusFromInteractingPlayer == (Object)null)
			{
				CancelOpening();
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController != (Object)null && (Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null)
			{
				NetworkObject val = GetApparatusParentNetworkObject();
				if ((Object)(object)val == (Object)null)
				{
					val = ((NetworkBehaviour)this).NetworkObject;
				}
				if ((Object)(object)val != (Object)null)
				{
					localPlayerController.DiscardHeldObject(true, val, Vector3.zero, true);
				}
				else
				{
					localPlayerController.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
				}
			}
			PlaceApparatusServerRpc(new NetworkObjectReference(apparatusFromInteractingPlayer));
		}

		public void CancelOpening()
		{
			if (GetDockAnimators())
			{
				thisDockAnimator.SetBool("Open", false);
				SyncCancelOpeningRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SyncCancelOpeningRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2969337566u, val3, val, (SendTo)5, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2969337566u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (GetDockAnimators())
				{
					thisDockAnimator.SetBool("Open", false);
				}
			}
		}

		private NetworkObject? GetApparatusFromInteractingPlayer()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isHoldingObject || (Object)(object)localPlayerController.currentlyHeldObjectServer == (Object)null)
			{
				return null;
			}
			GrabbableObject currentlyHeldObjectServer = localPlayerController.currentlyHeldObjectServer;
			if (!(currentlyHeldObjectServer is LungProp))
			{
				return null;
			}
			return ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject;
		}

		private bool LocalPlayerHoldingApparatus()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isHoldingObject)
			{
				return false;
			}
			return localPlayerController.currentlyHeldObjectServer is LungProp;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void PlaceApparatusServerRpc(NetworkObjectReference apparatusRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2430895006u, val3, val, (SendTo)2, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref apparatusRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2430895006u, val3, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			if (isPowered || !((NetworkObjectReference)(ref apparatusRef)).TryGet(ref val4, (NetworkManager)null))
			{
				return;
			}
			LungProp component = ((Component)val4).GetComponent<LungProp>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			NetworkObject apparatusParentNetworkObject = GetApparatusParentNetworkObject();
			if ((Object)(object)apparatusParentNetworkObject == (Object)null)
			{
				OpaliteMoonPlugin.Log.LogDebug((object)"[ApparatusDock] apparatusPoint has no NetworkObject");
				return;
			}
			isPowered = true;
			if (val4.IsSpawned && val4.OwnerClientId != 0)
			{
				val4.ChangeOwnership(0uL);
			}
			DockApparatusLocal(component, val4, stripHolder: true);
			PlaceApparatusClientRpc(apparatusRef);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void PlaceApparatusClientRpc(NetworkObjectReference apparatusRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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 != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2400349129u, val3, val, (SendTo)7, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref apparatusRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2400349129u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val4 = default(NetworkObject);
			if (!((NetworkObjectReference)(ref apparatusRef)).TryGet(ref val4, (NetworkManager)null))
			{
				return;
			}
			LungProp component = ((Component)val4).GetComponent<LungProp>();
			if (!((Object)(object)component == (Object)null))
			{
				isPowered = true;
				dockedApparatus = component;
				DockApparatusLocal(component, val4, stripHolder: true);
				if (GetDockAnimators())
				{
					thisDockAnimator.SetBool("Open", false);
					thisDockAnimator.SetBool("Powered", true);
				}
				if ((Object)(object)triggerScript != (Object)null)
				{
					triggerScript.interactable = false;
					triggerScript.hoverTip = "[Locked]";
					triggerScript.disabledHoverTip = "[Locked]";
				}
				if (connectAnimation == null)
				{
					connectAnimation = ((MonoBehaviour)this).StartCoroutine(ConnectToMachinery());
				}
				TurnOnRoomLights();
			}
		}

		private void DockApparatusLocal(LungProp prop, NetworkObject apparatus, bool stripHolder)
		{
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)prop == (Object)null || (Object)(object)apparatus == (Object)null)
			{
				return;
			}
			NetworkObject apparatusParentNetworkObject = GetApparatusParentNetworkObject();
			Transform val = (Transform)(((Object)(object)apparatusPoint != (Object)null) ? ((object)apparatusPoint) : ((object)(((Object)(object)apparatusParentNetworkObject != (Object)null) ? ((Component)apparatusParentNetworkObject).transform : null)));
			if (stripHolder)
			{
				PlayerControllerB val2 = ((GrabbableObject)prop).playerHeldBy;
				PlayerControllerB val3 = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null);
				if ((Object)(object)val2 == (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val3.currentlyHeldObjectServer == (Object)(object)prop)
				{
					val2 = val3;
				}
				if ((Object)(object)val2 != (Object)null && (Object)(object)val2 == (Object)(object)val3)
				{
					NetworkObject apparatusParentNetworkObject2 = GetApparatusParentNetworkObject();
					val2.DiscardHeldObject(true, apparatusParentNetworkObject2, Vector3.zero, true);
				}
				if ((Object)(object)val2 != (Object)null)
				{
					val2.currentlyHeldObjectServer = null;
					val2.isHoldingObject = false;
					val2.twoHanded = false;
				}
			}
			if ((Object)(object)apparatusParentNetworkObject != (Object)null)
			{
				if ((Object)(object)((Component)apparatus).transform.parent != (Object)(object)((Component)apparatusParentNetworkObject).transform)
				{
					apparatus.TrySetParent(apparatusParentNetworkObject, false);
				}
			}
			else if ((Object)(object)val != (Object)null)
			{
				((Component)apparatus).transform.SetParent(val, false);
			}
			((Component)apparatus).transform.localPosition = Vector3.zero;
			((Component)apparatus).transform.localEulerAngles = new Vector3(0f, 180f, 0f);
			BoxCollider component = ((Component)prop).GetComponent<BoxCollider>();
			if ((Object)(object)component != (Object)null && (Object)(object)triggerScript != (Object)null)
			{
				((Collider)component).enabled = false;
				BoxCollider val4 = ((Component)triggerScript).gameObject.AddComponent<BoxCollider>();
				val4.center = ((Component)triggerScript).transform.InverseTransformPoint(((Component)component).transform.TransformPoint(component.center));
				val4.size = ((Component)triggerScript).transform.InverseTransformVector(((Component)component).transform.TransformVector(component.size));
				val4.size = new Vector3(Mathf.Abs(val4.size.x), Mathf.Abs(val4.size.y), Mathf.Abs(val4.size.z));
				((Collider)val4).isTrigger = false;
			}
			if ((Object)(object)val != (Object)null)
			{
				((GrabbableObject)prop).parentObject = val;
			}
			else if ((Object)(object)apparatusParentNetworkObject != (Object)null)
			{
				((GrabbableObject)prop).parentObject = ((Component)apparatusParentNetworkObject).transform;
			}
			((GrabbableObject)prop).isHeld = false;
			((GrabbableObject)prop).playerHeldBy = null;
			((GrabbableObject)prop).hasHitGround = true;
			((GrabbableObject)prop).grabbable = false;
			((GrabbableObject)prop).grabbableToEnemies = false;
			((GrabbableObject)prop).fallTime = 1f;
		}

		private NetworkObject GetApparatusParentNetworkObject()
		{
			if ((Object)(object)apparatusPoint != (Object)null)
			{
				NetworkObject component = ((Component)apparatusPoint).GetComponent<NetworkObject>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
				component = ((Component)apparatusPoint).GetComponentInParent<NetworkObject>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
			return ((NetworkBehaviour)this).NetworkObject;
		}

		public void FlickerRoomLights()
		{
			if (roomFlickerAnimation == null)
			{
				roomFlickerAnimation = ((MonoBehaviour)this).StartCoroutine(FlickerPoweredLightsControlRoom());
			}
		}

		public void TurnOnRoomLights()
		{
			if (roomPowerAnimation == null)
			{
				roomPowerAnimation = ((MonoBehaviour)this).StartCoroutine(RoomPowerAnimation());
			}
		}

		private IEnumerator RoomPowerAnimation()
		{
			_ = new float[poweredRoomObjects.Length];
			float propogationSpeed = 7f;
			List<GameObject> sortedObjects = poweredRoomObjects.OrderBy((GameObject val) => Vector3.Distance(val.transform.position, apparatusPoint.position)).ToList();
			float timeSpent = 0f;
			foreach (GameObject obj in sortedObjects)
			{
				float delay = Vector3.Distance(obj.transform.position, apparatusPoint.position) / propogationSpeed;
				float wait = delay - timeSpent;
				if (wait > 0f)
				{
					yield return (object)new WaitForSeconds(wait);
					timeSpent = delay;
				}
				obj.SetActive(true);
				Animator animator = obj.GetComponent<Animator>();
				if ((Object)(object)animator != (Object)null)
				{
					animator.SetBool("on", true);
				}
			}
			yield return (object)new WaitForSeconds(0.2f);
			FlickerRoomLights();
			yield return null;
		}

		private IEnumerator FlickerPoweredLightsControlRoom(bool flickerFlashlights = false, bool disableFlashlights = false)
		{
			OpaliteMoonPlugin.Log.LogDebug((object)"Flickering Control Room lights");
			if (poweredRoomLightAnimators.Count <= 0 || !((Object)(object)poweredRoomLightAnimators[0] != (Object)null))
			{
				yield break;
			}
			int loopCount = 0;
			int b = 4;
			while (b > 0 && b != 0)
			{
				for (int j = loopCount; j < poweredRoomLightAnimators.Count / b; j++)
				{
					loopCount++;
					poweredRoomLightAnimators[j].SetTrigger("Flicker");
				}
				yield return (object)new WaitForSeconds(0.05f);
				b--;
			}
		}

		private IEnumerator ConnectToMachinery()
		{
			GameObject newSparkParticle = null;
			if ((Object)(object)dockedApparatus != (Object)null && (Object)(object)dockedApparatus.sparkParticle != (Object)null)
			{
				newSparkParticle = Object.Instantiate<GameObject>(dockedApparatus.sparkParticle, ((Component)dockedApparatus).transform.position, Quaternion.identity, ((Component)dockedApparatus).transform);
			}
			dockingPointAudio.PlayOneShot(dockingAudios[0], 0.7f);
			yield return (object)new WaitForSeconds(0.1f);
			if ((Object)(object)newSparkParticle != (Object)null)
			{
				newSparkParticle.SetActive(true);
			}
			yield return (object)new WaitForSeconds(0.3f);
			if ((Object)(object)roundManager != (Object)null)
			{
				roundManager.FlickerLights(false, false);
			}
			yield return (object)new WaitForSeconds(1f);
			if ((Object)(object)newSparkParticle != (Object)null)
			{
				Object.Destroy((Object)(object)newSparkParticle, 2f);
			}
			connectAnimation = null;
			yield return null;
		}

		public void StartOpening()
		{
			if (!isPowered && LocalPlayerHoldingApparatus() && GetDockAnimators() && !(Time.realtimeSinceStartup - timeAtLastUse < 0.5f))
			{
				timeAtLastUse = Time.realtimeSinceStartup;
				thisDockAnimator.SetBool("Open", true);
				SyncStartOpeningRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SyncStartOpeningRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1126231677u, val3, val, (SendTo)5, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1126231677u, val3, val, (SendTo)5, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (GetDockAnimators())
				{
					thisDockAnimator.SetBool("Open", true);
				}
			}
		}

		private bool GetDockAnimators()
		{
			return (Object)(object)thisDockAnimator != (Object)null;
		}

		private void LateUpdate()
		{
			if (!((Object)(object)triggerScript == (Object)null))
			{
				if (!isPowered)
				{
					thisDockAnimator.SetBool("Powered", false);
				}
				bool flag = LocalPlayerHoldingApparatus() && !isPowered;
				triggerScript.interactable = flag;
				triggerScript.hoverTip = (flag ? "Insert Apparatus : [LMB]" : "");
				triggerScript.disabledHoverTip = (isPowered ? "[Locked]" : "[Requires Apparatus]");
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2969337566u, new RpcReceiveHandler(__rpc_handler_2969337566), "SyncCancelOpeningRpc");
			((NetworkBehaviour)this).__registerRpc(2430895006u, new RpcReceiveHandler(__rpc_handler_2430895006), "PlaceApparatusServerRpc");
			((NetworkBehaviour)this).__registerRpc(2400349129u, new RpcReceiveHandler(__rpc_handler_2400349129), "PlaceApparatusClientRpc");
			((NetworkBehaviour)this).__registerRpc(1126231677u, new RpcReceiveHandler(__rpc_handler_1126231677), "SyncStartOpeningRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2969337566(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;
				((ApparatusDockHandler)(object)target).SyncCancelOpeningRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2430895006(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference apparatusRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref apparatusRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ApparatusDockHandler)(object)target).PlaceApparatusServerRpc(apparatusRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2400349129(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference apparatusRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref apparatusRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ApparatusDockHandler)(object)target).PlaceApparatusClientRpc(apparatusRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1126231677(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;
				((ApparatusDockHandler)(object)target).SyncStartOpeningRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ApparatusDockHandler";
		}
	}
	public enum DockingInteractions
	{
		Early,
		Late,
		Cancel
	}
	public class ContingencyWaterTrigger : MonoBehaviour
	{
		public bool isWater;

		public bool isInsideWater;

		public int audioClipIndex;

		[Space(5f)]
		public bool sinkingLocalPlayer;

		public float movementHinderance = 1.6f;

		public float sinkingSpeedMultiplier = 0.15f;

		private void OnTriggerStay(Collider other)
		{
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			if (isWater)
			{
				if (!((Component)other).gameObject.CompareTag("Player"))
				{
					return;
				}
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)component != (Object)null && (Object)(object)component.underwaterCollider != (Object)(object)this)
				{
					component.underwaterCollider = ((Component)this).gameObject.GetComponent<Collider>();
					return;
				}
			}
			if (!isWater && !((Component)other).gameObject.CompareTag("Player"))
			{
				return;
			}
			PlayerControllerB component2 = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component2 != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return;
			}
			if ((isWater && component2.isInsideFactory != isInsideWater) || component2.isInElevator)
			{
				if (sinkingLocalPlayer)
				{
					StopSinkingLocalPlayer(component2);
				}
				return;
			}
			if (isWater && !component2.isUnderwater)
			{
				component2.underwaterCollider = ((Component)this).gameObject.GetComponent<Collider>();
				component2.isUnderwater = true;
				if (!isInsideWater && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)component2 && (component2.isFallingFromJump || component2.isFallingNoJump) && component2.fallValue < -4f)
				{
					TimeOfDay.Instance.WaterSplashEffect(((Component)component2).transform.position, component2.fallValue > -17f, true);
				}
			}
			component2.statusEffectAudioIndex = audioClipIndex;
			if (component2.isSinking)
			{
				return;
			}
			if (sinkingLocalPlayer)
			{
				if (!component2.CheckConditionsForSinkingInQuicksand())
				{
					StopSinkingLocalPlayer(component2);
				}
			}
			else if (component2.CheckConditionsForSinkingInQuicksand())
			{
				sinkingLocalPlayer = true;
				component2.sourcesCausingSinking++;
				component2.isMovementHindered++;
				component2.hinderedMultiplier *= movementHinderance;
				if (isWater)
				{
					component2.sinkingSpeedMultiplier = 0f;
				}
				else
				{
					component2.sinkingSpeedMultiplier = sinkingSpeedMultiplier;
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			OnExit(other);
		}

		public void OnExit(Collider other)
		{
			PlayerControllerB val = null;
			if (!sinkingLocalPlayer)
			{
				if (isWater && ((Component)other).CompareTag("Player"))
				{
					val = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
					if (!((Object)(object)val != (Object)null) || !((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController))
					{
						val.isUnderwater = false;
					}
				}
			}
			else if (((Component)other).CompareTag("Player"))
			{
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				}
				if (!((Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					StopSinkingLocalPlayer(val);
				}
			}
		}

		public void StopSinkingLocalPlayer(PlayerControllerB playerScript)
		{
			if (sinkingLocalPlayer)
			{
				sinkingLocalPlayer = false;
				playerScript.sourcesCausingSinking = Mathf.Clamp(playerScript.sourcesCausingSinking - 1, 0, 100);
				playerScript.isMovementHindered = Mathf.Clamp(playerScript.isMovementHindered - 1, 0, 100);
				playerScript.hinderedMultiplier = Mathf.Clamp(playerScript.hinderedMultiplier / movementHinderance, 1f, 100f);
				if (playerScript.isMovementHindered == 0 && isWater)
				{
					playerScript.isUnderwater = false;
				}
			}
		}
	}
	public class ControlRoomManager : NetworkBehaviour
	{
		public static ControlRoomManager Instance;

		public ApparatusDockHandler dockHandler;

		public bool isRainingInside;

		public Random LockersRandom;

		public Random BasinRandom;

		public Random KyvidRandom;

		public AudioSource[] MiscAudios;

		public AudioClip[] miscClips;

		public GameObject[] controlRoomLights;

		public GameObject[] controlRoomLights2;

		public AudioSource MonitorAudio;

		public AudioClip monitorAlarmBeep;

		public AudioSource DoorAudio;

		public AudioClip doorOpeningSfx;

		public NetworkObject[] lockers;

		public List<PlayerControllerB> playersInsideControlRoom = new List<PlayerControllerB>();

		public ControlRoomTeleport controlRoomTeleport;

		public ControlRoomTeleport outdoorControlRoomTeleport;

		public EntranceTeleport controlRoomFireTeleport;

		public EntranceTeleport indoorFireTeleport;

		public Animator garageDoorAnimator;

		public bool hasBeenPowered;

		private bool isPoweredOld;

		private InteractTrigger controlRoomDoorTrigger;

		private InteractTrigger indoorDoorTrigger;

		private InteractTrigger controlRoomFireTrigger;

		private InteractTrigger indoorFireTrigger;

		private Renderer[] roomRenderers;

		public AudioSource AmbienceAudio;

		public AudioClip ambienceClip;

		public AudioSource DelugePumpAudio;

		public AudioClip delugePumpWhir;

		public AudioClip delugeFlow;

		public Animator reservoirWaterAnimator;

		public bool isDraining;

		private float drainTimer;

		private List<ItemSpawner> basinSpawners;

		private List<Renderer> renderers;

		private List<ItemSpawner> basinScrapSpawners = new List<ItemSpawner>();

		public Animator kyividAnimator;

		public int kyividState = 1;

		public ControlRoomSteamValve valve;

		public Animator PCAnimator;

		public WeightedItemRefrence[] customBasinScrapList;

		public void Awake()
		{
			renderers = GetActiveRenderers();
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			if ((Object)(object)dockHandler == (Object)null)
			{
				dockHandler = Object.FindObjectOfType<ApparatusDockHandler>();
			}
			SetExitReferences();
			AmbienceAudio.clip = ambienceClip;
			AmbienceAudio.Play();
			AmbienceAudio.loop = true;
			AmbienceAudio.volume = 0f;
		}

		public void StartUpPC()
		{
			PCAnimator.SetBool("On", true);
			if (MiscAudios.Length != 0 && (Object)(object)MiscAudios[0] != (Object)null)
			{
				MiscAudios[0].volume = 0.8f;
				MiscAudios[0].pitch = 0.5f;
				((MonoBehaviour)this).StartCoroutine(StopAudioAfterFade(MiscAudios[0], 0.5f));
			}
			((MonoBehaviour)this).StartCoroutine(PCAudiosCoroutine());
		}

		public IEnumerator PCAudiosCoroutine()
		{
			MonitorAudio.volume = 1f;
			if ((Object)(object)miscClips[1] != (Object)null)
			{
				MonitorAudio.PlayOneShot(miscClips[1]);
			}
			yield return (object)new WaitForSeconds(1f);
			yield return null;
		}

		public IEnumerator StopAudioAfterFade(AudioSource audioSource, float fadeSeconds)
		{
			float startingVolume = audioSource.volume;
			float currentTime = 0f;
			while (currentTime < fadeSeconds)
			{
				currentTime += Time.deltaTime;
				audioSource.volume = Mathf.Lerp(startingVolume, 0f, currentTime / fadeSeconds);
				yield return null;
			}
			audioSource.volume = 0f;
			audioSource.Stop();
			audioSource.volume = startingVolume;
		}

		public IEnumerator StartAudioWithFade(AudioSource audioSource, float fadeSeconds)
		{
			float targetVolume = audioSource.volume;
			float currentTime = 0f;
			audioSource.volume = 0f;
			audioSource.Play();
			while (currentTime < fadeSeconds)
			{
				currentTime += Time.deltaTime;
				audioSource.volume = Mathf.Lerp(0f, targetVolume, currentTime / fadeSeconds);
				yield return null;
			}
			audioSource.volume = targetVolume;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartDelugeServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1399946006u, val3, val, (SendTo)2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1399946006u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					OpaliteMoonPlugin.Log.LogDebug((object)"Starting Deluge On Server");
					StartDelugeClientRpc();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartDelugeClientRpc()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(545389115u, val3, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 545389115u, val3, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					OpaliteMoonPlugin.Log.LogDebug((object)"Starting Deluge On Client");
					((MonoBehaviour)this).StartCoroutine(DelugeFloodEvent());
					isDraining = true;
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnBeginPowerServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2799117281u, val3, val, (SendTo)2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 2799117281u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					OnBeginPowerClientRpc();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnBeginPowerClientRpc()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(565277397u, val3, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 565277397u, val3, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					AmbienceAudio.Stop();
					((MonoBehaviour)this).StartCoroutine(BigDoorOpen());
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void OnEndPowerClientRpc()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1133039509u, val3, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1133039509u, val3, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(BigDoorClose());
				}
			}
		}

		private void SetExitReferences()
		{
			InitExitListeners();
		}

		public void BeforeLoadNewLevel(int currentSeed)
		{
			if (!RoundManager.Instance.hasInitializedLevelRandomSeed)
			{
				OpaliteMoonPlugin.Log.LogDebug((object)"[ControlRoomManager.BeforeLoadNewLevel] wtf.");
			}
			OpaliteMoonPlugin.Log.LogDebug((object)$"[ControlRoomManager.BeforeLoadNewLevel] setting up lockers with seed {currentSeed}.");
			KyvidRandom = new Random(StartOfRound.Instance.randomMapSeed + 2352);
			kyividAnimator.SetInteger("state", kyividState);
			SetupLockersServerRpc();
			SetupBasinScrap();
		}

		private void SetupBasinScrap()
		{
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: 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_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("BasinScrapSpawns");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"[ControlRoomManager] Could not find BasinScrapSpawns parent");
				return;
			}
			GameObject[] array = (from t in val.GetComponentsInChildren<Transform>(true)
				where ((Object)t).name.StartsWith("ScrapNode")
				select ((Component)t).gameObject).ToArray();
			int seed = StartOfRound.Instance.randomMapSeed + 393;
			BasinRandom = new Random(seed);
			int num = 6 + BasinRandom.Next(2);
			Debug.Log((object)$"[ControlRoomManager] setting up {num} basins scrap item spawners");
			Item item = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[NamespacedKey<DawnItemInfo>.From("opalite_moon", "sopping_zed_dog")].Item;
			WeightedItemRefrence[] customList = (WeightedItemRefrence[])(object)new WeightedItemRefrence[1]
			{
				new WeightedItemRefrence
				{
					Weight = 100,
					Item = item,
					ItemName = "",
					FindRegisteredItem = false
				}
			};
			RaycastHit val3 = default(RaycastHit);
			for (int num2 = 0; num2 < num; num2++)
			{
				int num3 = BasinRandom.Next(0, array.Length);
				ItemSpawner val2 = new GameObject().AddComponent<ItemSpawner>();
				Vector2 randomPointInCircleForBasin = GetRandomPointInCircleForBasin(5f);
				((Component)val2).transform.position = array[num3].transform.position + new Vector3(randomPointInCircleForBasin.x, 5f, randomPointInCircleForBasin.y);
				while (!Physics.Raycast(((Component)val2).transform.position, -Vector3.up, ref val3, 80f, 268437761, (QueryTriggerInteraction)1))
				{
					randomPointInCircleForBasin = GetRandomPointInCircleForBasin(5f);
					((Component)val2).transform.position = array[num3].transform.position + new Vector3(randomPointInCircleForBasin.x, 5f, randomPointInCircleForBasin.y);
				}
				((Behaviour)val2).enabled = false;
				val2.spawnOnEnabled = true;
				val2.SourcePool = (SpawnPoolSource)0;
				val2.CustomList = customList;
				val2.spawnRotation = (RotationType)1;
				((Component)val2).transform.localEulerAngles = new Vector3(0f, (float)BasinRandom.Next(0, 360), 0f);
				basinScrapSpawners.Add(val2);
				((Component)val2).gameObject.SetActive(false);
			}
			Debug.Log((object)$"[ControlRoomManager] added {basinScrapSpawners.Count} item spawners to list");
		}

		public Vector2 GetRandomPointInCircleForBasin(float radius)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)(BasinRandom.NextDouble() * 2.0 * 3.1415927410125732);
			float num2 = (float)Math.Sqrt(BasinRandom.NextDouble()) * radius;
			float num3 = num2 * Mathf.Cos(num);
			float num4 = num2 * Mathf.Sin(num);
			return new Vector2(num3, num4);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SetupLockersServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(228644649u, val3, val, (SendTo)2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 228644649u, val3, val, (SendTo)2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			LockersRandom = new Random(StartOfRound.Instance.randomMapSeed + 214);
			bool[] array = new bool[lockers.Length];
			for (int i = 0; i < lockers.Length; i++)
			{
				if (LockersRandom.Next() % 4 != 0)
				{
					array[i] = true;
				}
			}
			SetupLockersClientRpc(array);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void SetupLockersClientRpc(bool[] lockerStates)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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 != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1629913294u, val3, val, (SendTo)7, (RpcDelivery)0);
				bool flag = lockerStates != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(lockerStates, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1629913294u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				for (int i = 0; i < lockers.Length; i++)
				{
					((Component)lockers[i]).gameObject.SetActive(lockerStates[i]);
				}
			}
		}

		private IEnumerator DelugeFloodEvent()
		{
			if ((Object)(object)DelugePumpAudio != (Object)null)
			{
				if ((Object)(object)delugePumpWhir != (Object)null)
				{
					DelugePumpAudio.PlayOneShot(delugePumpWhir);
				}
				DelugePumpAudio.clip = delugeFlow;
				DelugePumpAudio.Play();
				DelugePumpAudio.loop = true;
			}
			if (controlRoomLights != null)
			{
				GameObject[] array = controlRoomLights;
				foreach (GameObject obj in array)
				{
					if ((Object)(object)obj != (Object)null)
					{
						obj.SetActive(false);
					}
				}
			}
			if (miscClips != null && miscClips.Length != 0 && (Object)(object)miscClips[0] != (Object)null && (Object)(object)AmbienceAudio != (Object)null)
			{
				AmbienceAudio.clip = miscClips[0];
				AmbienceAudio.Play();
				if (MiscAudios != null && MiscAudios.Length > 1 && (Object)(object)MiscAudios[1] != (Object)null)
				{
					MiscAudios[1].clip = miscClips[0];
					MiscAudios[1].volume = 1f;
					((MonoBehaviour)this).StartCoroutine(StartAudioWithFade(MiscAudios[1], 0.5f));
				}
			}
			if ((Object)(object)PCAnimator != (Object)null)
			{
				PCAnimator.SetBool("DamActive", true);
			}
			yield return (object)new WaitForSeconds(1f);
			isRainingInside = true;
			if ((Object)(object)MonitorAudio != (Object)null && (Object)(object)monitorAlarmBeep != (Object)null)
			{
				MonitorAudio.PlayOneShot(monitorAlarmBeep);
			}
			if (controlRoomLights2 != null)
			{
				GameObject[] array2 = controlRoomLights2;
				foreach (GameObject obj2 in array2)
				{
					if ((Object)(object)obj2 != (Object)null)
					{
						obj2.SetActive(true);
					}
				}
			}
			BurstValve();
			yield return (object)new WaitForSeconds(1f);
			if (basinScrapSpawners != null)
			{
				foreach (ItemSpawner spawner in basinScrapSpawners)
				{
					if (!((Object)(object)spawner == (Object)null))
					{
						Debug.Log((object)"[ControlRoomManager] enabling scrap spawner.");
						((Behaviour)spawner).enabled = true;
						if ((Object)(object)((Component)spawner).gameObject != (Object)null)
						{
							((Component)spawner).gameObject.SetActive(true);
						}
					}
				}
			}
			else
			{
				Debug.LogWarning((object)"[ControlRoomManager] basinScrapSpawners is null on this client!");
			}
			yield return (object)new WaitForSeconds(0.25f);
			NamespacedKey<DawnItemInfo> itemKey = NamespacedKey<DawnItemInfo>.From("opalite_moon", "sopping_zed_dog");
			Item soppyzedProperties = null;
			if (LethalContent.Items != null && ((Registry<DawnItemInfo>)(object)LethalContent.Items).ContainsKey(itemKey))
			{
				DawnItemInfo lookupResult = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[itemKey];
				if (lookupResult != null)
				{
					soppyzedProperties = lookupResult.Item;
				}
			}
			if ((Object)(object)soppyzedProperties != (Object)null)
			{
				GrabbableObject[] array3 = Object.FindObjectsByType<GrabbableObject>((FindObjectsInactive)1, (FindObjectsSortMode)0);
				foreach (GrabbableObject grabbableObject in array3)
				{
					if (!((Object)(object)grabbableObject == (Object)null) && !string.IsNullOrEmpty(((Object)grabbableObject).name) && ((Object)grabbableObject).name.Contains("SoppingZed"))
					{
						if (BasinRandom != null)
						{
							grabbableObject.floorYRot = BasinRandom.Next(360);
						}
						if ((Object)(object)grabbableObject.itemProperties != (Object)(object)soppyzedProperties)
						{
							grabbableObject.itemProperties = soppyzedProperties;
						}
					}
				}
			}
			drainTimer = 0f;
			if ((Object)(object)reservoirWaterAnimator != (Object)null)
			{
				reservoirWaterAnimator.SetBool("Drain", true);
				reservoirWaterAnimator.SetBool("Filled", false);
			}
			if ((Object)(object)HUDManager.Instance != (Object)null)
			{
				HUDManager.Instance.DisplayTip("???", "The dam's flood gate has opened.", false, false, "LC_Tip1");
			}
			yield return null;
		}

		public void BurstValve()
		{
			valve.valveHasBurst = true;
			valve.BurstValve();
		}

		private IEnumerator BigDoorOpen()
		{
			yield return (object)new WaitForSeconds(3f);
			garageDoorAnimator.SetBool("Open", true);
			DoorAudio.clip = doorOpeningSfx;
			DoorAudio.Play();
			yield return (object)new WaitForSeconds(2f);
			((MonoBehaviour)this).StartCoroutine(StopAudioAfterFade(DoorAudio, 0.5f));
		}

		private IEnumerator BigDoorClose()
		{
			yield return (object)new WaitForSeconds(1f);
			garageDoorAnimator.SetBool("Open", false);
		}

		public void InitExitListeners()
		{
			indoorDoorTrigger = ((Component)controlRoomTeleport).GetComponent<InteractTrigger>();
			controlRoomDoorTrigger = ((Component)outdoorControlRoomTeleport).GetComponent<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)controlRoomDoorTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)OutdoorControlRoomDoorTeleportPlayer);
			((UnityEvent<PlayerControllerB>)(object)indoorDoorTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)IndoorControlRoomDoorTeleportPlayer);
			OpaliteMoonPlugin.Log.LogDebug((object)"[ControlRoomManager] added event controlRoomTeleportAction to controlRoomFireTrigger.onInteract");
		}

		public void OutdoorControlRoomDoorTeleportPlayer(PlayerControllerB player)
		{
			OpaliteMoonPlugin.Log.LogDebug((object)$"[ControlRoomManager] Teleported from Outside -> ControlRoom. Teleport finished from local player {player.actualClientId}");
			UpdateControlRoomPresenceServerRpc(player.actualClientId, isEntering: true);
		}

		public void IndoorControlRoomDoorTeleportPlayer(PlayerControllerB player)
		{
			OpaliteMoonPlugin.Log.LogDebug((object)$"[ControlRoomManager] Teleported from ControlRoom -> Outside. Teleport finished from local player {player.actualClientId}");
			UpdateControlRoomPresenceServerRpc(player.actualClientId, isEntering: false);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void UpdateControlRoomPresenceServerRpc(ulong clientId, bool isEntering)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1116323371u, val3, val, (SendTo)2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEntering, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1116323371u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					UpdateControlRoomPresenceClientRpc(clientId, isEntering);
				}
			}
		}

		public void LateUpdate()
		{
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Invalid comparison between Unknown and I4
			hasBeenPowered = dockHandler.isPowered;
			if (!isPoweredOld && hasBeenPowered)
			{
				OnBeginPowerServerRpc();
			}
			isPoweredOld = dockHandler.isPowered;
			if (isDraining && drainTimer < 1f)
			{
				drainTimer += Time.deltaTime / 42f;
				if (drainTimer > 1f)
				{
					drainTimer = 1f;
					isRainingInside = false;
					((MonoBehaviour)this).StartCoroutine(StopAudioAfterFade(AmbienceAudio, 0.5f));
					((MonoBehaviour)this).StartCoroutine(StopAudioAfterFade(MiscAudios[1], 0.5f));
				}
				reservoirWaterAnimator.SetFloat("Time", drainTimer);
			}
			if ((Object)(object)kyividAnimator != (Object)null)
			{
				kyividAnimator.SetFloat("timeOfDay", TimeOfDay.Instance.normalizedTimeOfDay);
			}
			if (StartOfRound.Instance.localPlayerController.isInsideFactory && isRainingInside)
			{
				TimeOfDay.Instance.effects[1].effectEnabled = true;
			}
			else if (StartOfRound.Instance.localPlayerController.isInsideFactory)
			{
				TimeOfDay.Instance.effects[1].effectEnabled = false;
			}
			else
			{
				TimeOfDay.Instance.effects[1].effectEnabled = (int)TimeOfDay.Instance.currentLevelWeather == 1;
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void UpdateControlRoomPresenceClientRpc(ulong clientId, bool isEntering)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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 != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3542651060u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, clientId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isEntering, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3542651060u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			ulong clientId2 = clientId;
			PlayerControllerB val4 = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB p) => p.actualClientId == clientId2));
			if ((Object)(object)val4 == (Object)null)
			{
				return;
			}
			ControlRoomPlayerManager controlRoomPlayerManager = ((Component)val4).GetComponent<ControlRoomPlayerManager>();
			if ((Object)(object)controlRoomPlayerManager == (Object)null)
			{
				controlRoomPlayerManager = ((Component)val4).gameObject.AddComponent<ControlRoomPlayerManager>();
			}
			controlRoomPlayerManager.controlRoom = this;
			if (isEntering)
			{
				if (!playersInsideControlRoom.Contains(val4))
				{
					PlayerEnterControlRoom(val4);
					controlRoomPlayerManager.EnterControlRoom();
				}
			}
			else if (playersInsideControlRoom.Contains(val4))
			{
				PlayerExitControlRoom(val4);
				controlRoomPlayerManager.LeaveControlRoom();
			}
		}

		private void PlayerEnterControlRoom(PlayerControllerB player)
		{
			playersInsideControlRoom.Add(player);
			if ((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				AmbienceAudio.volume = 1f;
			}
			OpaliteMoonPlugin.Log.LogDebug((object)("[ControlRoomManager] Added " + player.playerUsername + " to Control Room"));
		}

		private void PlayerExitControlRoom(PlayerControllerB player)
		{
			playersInsideControlRoom.Remove(player);
			if ((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				AmbienceAudio.volume = 0f;
			}
			OpaliteMoonPlugin.Log.LogDebug((object)("[ControlRoomManager] Removed " + player.playerUsername + " from Control Room"));
		}

		public List<Renderer> GetActiveRenderers()
		{
			List<Renderer> list = ((Component)this).gameObject.GetComponentsInChildren<Renderer>().ToList();
			List<Renderer> list2 = new List<Renderer>();
			foreach (Renderer item in list)
			{
				if (item.enabled)
				{
					list2.Add(item);
				}
			}
			return list2;
		}

		public void CullControlRoom(bool cull)
		{
			foreach (Renderer renderer in renderers)
			{
				renderer.enabled = !cull;
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1399946006u, new RpcReceiveHandler(__rpc_handler_1399946006), "StartDelugeServerRpc");
			((NetworkBehaviour)this).__registerRpc(545389115u, new RpcReceiveHandler(__rpc_handler_545389115), "StartDelugeClientRpc");
			((NetworkBehaviour)this).__registerRpc(2799117281u, new RpcReceiveHandler(__rpc_handler_2799117281), "OnBeginPowerServerRpc");
			((NetworkBehaviour)this).__registerRpc(565277397u, new RpcReceiveHandler(__rpc_handler_565277397), "OnBeginPowerClientRpc");
			((NetworkBehaviour)this).__registerRpc(1133039509u, new RpcReceiveHandler(__rpc_handler_1133039509), "OnEndPowerClientRpc");
			((NetworkBehaviour)this).__registerRpc(228644649u, new RpcReceiveHandler(__rpc_handler_228644649), "SetupLockersServerRpc");
			((NetworkBehaviour)this).__registerRpc(1629913294u, new RpcReceiveHandler(__rpc_handler_1629913294), "SetupLockersClientRpc");
			((NetworkBehaviour)this).__registerRpc(1116323371u, new RpcReceiveHandler(__rpc_handler_1116323371), "UpdateControlRoomPresenceServerRpc");
			((NetworkBehaviour)this).__registerRpc(3542651060u, new RpcReceiveHandler(__rpc_handler_3542651060), "UpdateControlRoomPresenceClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1399946006(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;
				((ControlRoomManager)(object)target).StartDelugeServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_545389115(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;
				((ControlRoomManager)(object)target).StartDelugeClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2799117281(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;
				((ControlRoomManager)(object)target).OnBeginPowerServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_565277397(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;
				((ControlRoomManager)(object)target).OnBeginPowerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1133039509(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;
				((ControlRoomManager)(object)target).OnEndPowerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_228644649(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;
				((ControlRoomManager)(object)target).SetupLockersServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1629913294(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				bool[] lockerStates = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref lockerStates, default(ForPrimitives));
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).SetupLockersClientRpc(lockerStates);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1116323371(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool isEntering = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isEntering, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).UpdateControlRoomPresenceServerRpc(clientId, isEntering);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3542651060(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				bool isEntering = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isEntering, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).UpdateControlRoomPresenceClientRpc(clientId, isEntering);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ControlRoomManager";
		}
	}
	public class PlayerDetector : NetworkBehaviour
	{
		public bool triggerOnce = true;

		private bool triggeredOnce;

		public UnityEvent OnEnterTriggerEventsAllClients;

		public UnityEvent OnEnterTriggerEventsThisClient;

		public void OnTriggerEnter(Collider other)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			Debug.Log((object)"[PlayerDetector] something has collided at least...");
			if ((Object)(object)((Component)other).gameObject == (Object)(object)((Component)localPlayerController).gameObject && (!triggerOnce || !triggeredOnce))
			{
				TriggerEnteredServerRpc(localPlayerController.actualClientId);
				Debug.Log((object)("[PlayerDetector] Player " + ((Object)((Component)localPlayerController).gameObject).name + " has entered the trigger of " + ((Object)((Component)this).gameObject).name + " [ON CLIENT]"));
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TriggerEnteredServerRpc(ulong playerID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3793893011u, val3, val, (SendTo)2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerID);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 3793893011u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					TriggerEnteredClientRpc(playerID);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		protected virtual void TriggerEnteredClientRpc(ulong playerID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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 != 1)
			{
				RpcAttributeParams val = default(RpcAttributeParams);
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1260019935u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1260019935u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val4 = null;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val5 in allPlayerScripts)
			{
				if (val5.actualClientId == playerID)
				{
					val4 = val5;
					break;
				}
			}
			if ((Object)(object)val4 == (Object)null)
			{
				OpaliteMoonPlugin.Log.LogWarning((object)$"Could not find player with ID {playerID}");
				return;
			}
			triggeredOnce = true;
			Debug.Log((object)("Player " + ((Object)((Component)val4).gameObject).name + " has entered the trigger of " + ((Object)((Component)this).gameObject).name + " [ALL CLIENTS]"));
			OpaliteMoonPlugin.Log.LogDebug((object)("Player " + ((Object)((Component)val4).gameObject).name + " has entered the trigger of " + ((Object)((Component)this).gameObject).name + " [ALL CLIENTS]"));
			OnEnterTriggerEventsAllClients.Invoke();
			if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)val4)
			{
				OnEnterTriggerEventsThisClient.Invoke();
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3793893011u, new RpcReceiveHandler(__rpc_handler_3793893011), "TriggerEnteredServerRpc");
			((NetworkBehaviour)this).__registerRpc(1260019935u, new RpcReceiveHandler(__rpc_handler_1260019935), "TriggerEnteredClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_3793893011(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerID = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PlayerDetector)(object)target).TriggerEnteredServerRpc(playerID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1260019935(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong playerID = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PlayerDetector)(object)target).TriggerEnteredClientRpc(playerID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PlayerDetector";
		}
	}
	public class ControlRoomPlayerManager : MonoBehaviour
	{
		public PlayerControllerB player;

		public ControlRoomManager controlRoom;

		public void Awake()
		{
			PlayerExists();
		}

		public void EnterControlRoom()
		{
			if (PlayerExists() && !((Object)(object)player != (Object)(object)StartOfRound.Instance.localPlayerController))
			{
				player.isInsideFactory = true;
				if ((Object)(object)KyividManager.Instance != (Object)null && (Object)(object)KyividManager.Instance.kyividDirectionalLighting != (Object)null)
				{
					((Behaviour)KyividManager.Instance.kyividDirectionalLighting).enabled = false;
				}
			}
		}

		public void LeaveControlRoom()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (PlayerExists() && !((Object)(object)player != (Object)(object)StartOfRound.Instance.localPlayerController))
			{
				player.isInsideFactory = false;
				if ((int)TimeOfDay.Instance.currentLevelWeather >= 0)
				{
					TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectEnabled = true;
				}
				if ((Object)(object)KyividManager.Instance != (Object)null && (Object)(object)KyividManager.Instance.kyividDirectionalLighting != (Object)null)
				{
					((Behaviour)KyividManager.Instance.kyividDirectionalLighting).enabled = true;
				}
			}
		}

		private bool PlayerExists()
		{
			if ((Object)(object)player == (Object)null)
			{
				player = ((Component)this).GetComponent<PlayerControllerB>();
			}
			if ((Object)(object)player == (Object)null)
			{
				Object.Destroy((Object)(object)this);
				return false;
			}
			return true;
		}
	}
	public class ControlRoomSteamValve : MonoBehaviour
	{
		public float valveCrackTime;

		public float valveBurstTime;

		public bool valveHasBurst;

		private bool valveHasCracked;

		private bool valveHasBeenRepaired;

		public InteractTrigger triggerScript;

		[Header("Fog")]
		public Animator fogAnimator;

		public Animator valveAnimator;

		public float fogSizeMultiplier;

		public float currentFogSize;

		[Header("Other Effects")]
		public ParticleSystem valveSteamParticle;

		public AudioClip[] pipeFlowingSFX;

		public AudioClip valveTwistSFX;

		public AudioClip valveBurstSFX;

		public AudioClip valveCrackSFX;

		public AudioClip steamBlowSFX;

		public AudioSource valveAudio;

		public GameObject spawnParticleWhenCracked;

		public ControlRoomSteamValveFixInteraction fixInteract;

		private const string steamHUDWarningText = "VISIBILITY LOW!\n\nSteam leak detected in area";

		private void Start()
		{
			if (pipeFlowingSFX.Length != 0)
			{
				valveAudio.pitch = Random.Range(0.85f, 1.1f);
				valveAudio.clip = pipeFlowingSFX[Random.Range(0, pipeFlowingSFX.Length)];
				valveAudio.Play();
			}
		}

		private void Update()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			if (StartOfRound.Instance.allPlayersDead || (Object)(object)NetworkManager.Singleton == (Object)null || !GameNetworkManager.Instance.gameHasStarted)
			{
				return;
			}
			if (valveHasBeenRepaired)
			{
				currentFogSize = Mathf.Clamp(currentFogSize - Time.deltaTime / 4f, 0.01f, 1f * fogSizeMultiplier);
				fogAnimator.SetFloat("time", currentFogSize);
			}
			else if (!valveHasCracked && valveCrackTime > 0f && TimeOfDay.Instance.normalizedTimeOfDay > valveCrackTime)
			{
				valveHasCracked = true;
				CrackValve();
			}
			else if (valveHasBurst && (Object)(object)fogAnimator != (Object)null)
			{
				currentFogSize = Mathf.Clamp(currentFogSize + Time.deltaTime / 12f, 0f, 1f * fogSizeMultiplier);
				fogAnimator.SetFloat("time", currentFogSize);
				if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)valveAudio).transform.position) < 10f)
				{
					HUDManager.Instance.increaseHelmetCondensation = true;
					HUDManager.Instance.DisplayStatusEffect("VISIBILITY LOW!\n\nSteam leak detected in area");
				}
			}
		}

		private void CrackValve()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			valveAudio.PlayOneShot(valveCrackSFX);
			WalkieTalkie.TransmitOneShotAudio(valveAudio, valveCrackSFX, 1f);
			if ((Object)(object)valveSteamParticle != (Object)null)
			{
				MainModule main = valveSteamParticle.main;
				((MainModule)(ref main)).loop = false;
				valveSteamParticle.Play();
			}
		}

		public void BurstValve()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)spawnParticleWhenCracked != (Object)null)
			{
				Object.Instantiate<GameObject>(spawnParticleWhenCracked, ((Component)this).transform.position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			MainModule main = valveSteamParticle.main;
			((MainModule)(ref main)).loop = true;
			valveSteamParticle.Play();
			valveAudio.clip = steamBlowSFX;
			valveAudio.Play();
			valveAudio.PlayOneShot(valveBurstSFX);
			WalkieTalkie.TransmitOneShotAudio(valveAudio, valveBurstSFX, 1f);
			if ((Object)(object)triggerScript != (Object)null)
			{
				triggerScript.interactable = true;
			}
		}

		public void FixValveLocalClient()
		{
			if (valveHasBurst && !valveHasBeenRepaired)
			{
				valveSteamParticle.Stop(true, (ParticleSystemStopBehavior)1);
				valveAudio.clip = pipeFlowingSFX[Random.Range(0, pipeFlowingSFX.Length)];
				valveAudio.Play();
				valveAudio.PlayOneShot(valveTwistSFX, 1f);
				WalkieTalkie.TransmitOneShotAudio(valveAudio, valveTwistSFX, 1f);
				valveAnimator.SetTrigger("TwistValve");
				valveHasBeenRepaired = true;
				triggerScript.interactable = false;
			}
		}

		public void FixValve()
		{
			fixInteract.FixValve();
		}
	}
	public class ControlRoomSteamValveFixInteraction : NetworkBehaviour
	{
		public ControlRoomSteamValve steamValveMain;

		public void FixValve()
		{
			steamValveMain.FixValveLocalClient();
			if (((NetworkBehaviour)this).IsServer)
			{
				FixValveClientRpc();
			}
			else
			{
				FixValveServerRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void FixValveServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1910100652u, val3, val, (SendTo)2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1910100652u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					FixValveClientRpc();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void FixValveClientRpc()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1472984272u, val3, val, (SendTo)7, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1472984272u, val3, val, (SendTo)7, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					steamValveMain.FixValveLocalClient();
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1910100652u, new RpcReceiveHandler(__rpc_handler_1910100652), "FixValveServerRpc");
			((NetworkBehaviour)this).__registerRpc(1472984272u, new RpcReceiveHandler(__rpc_handler_1472984272), "FixValveClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1910100652(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;
				((ControlRoomSteamValveFixInteraction)(object)target).FixValveServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1472984272(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;
				((ControlRoomSteamValveFixInteraction)(object)target).FixValveClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ControlRoomSteamValveFixInteraction";
		}
	}
	public class ControlRoomTeleport : NetworkBehaviour
	{
		public bool isEntranceToControlRoom;

		private bool jinglePlayed;

		public Transform entrancePoint;

		public int entranceId;

		public StartOfRound playersManager;

		public AudioClip customFirstTimeAudio;

		public int audioReverbPreset = -1;

		public ControlRoomTeleport exitScript;

		public AudioSource entrancePointAudio;

		public AudioClip[] doorAudios;

		public InteractTrigger triggerScript;

		private float checkForEnemiesInterval;

		private bool enemyNearLastCheck;

		private bool gotExitPoint;

		private bool checkedForFirstTime;

		public float timeAtLastUse;

		public Animator thisEntranceAnimator;

		private bool exitPointDoesntExist;

		private bool playingCreakAudio;

		public List<Light> dayLights;

		private void Awake()
		{
			playersManager = Object.FindObjectOfType<StartOfRound>();
			triggerScript = ((Component)this).gameObject.GetComponent<InteractTrigger>();
			checkForEnemiesInterval = 10f;
		}

		private void PlayCreakSFX()
		{
			AudioClip[] creakOpenDoorMetal = StartOfRound.Instance.creakOpenDoorMetal;
			int num = Random.Range(0, creakOpenDoorMetal.Length);
			entrancePointAudio.clip = creakOpenDoorMetal[num];
			entrancePointAudio.pitch = Random.Range(0.94f, 1.06f);
			entrancePointAudio.Play();
			playingCreakAudio = true;
			if ((Object)(object)exitScript != (Object)null && (Object)(object)exitScript.thisEntranceAnimator != (Object)null)
			{
				creakOpenDoorMetal = StartOfRound.Instance.creakOpenDoorMetal;
				exitScript.entrancePointAudio.clip = creakOpenDoorMetal[num];
				exitScript.entrancePointAudio.pitch = Random.Range(0.94f, 1.06f);
				exitScript.entrancePointAudio.Play();
			}
		}

		public void StartOpeningEntrance()
		{
			if (!GetDoorAnimators() || Time.realtimeSinceStartup - timeAtLastUse < 0.5f)
			{
				return;
			}
			if ((Object)(object)exitScript == (Object)null && (exitPointDoesntExist || !FindExitPoint()))
			{
				exitPointDoesntExist = true;
				return;
			}
			thisEntranceAnimator.SetBool("Open", true);
			if (!playingCreakAudio)
			{
				PlayCreakSFX();
			}
			if ((Object)(object)exitScript.thisEntranceAnimator != (Object)null)
			{
				exitScript.thisEntranceAnimator.SetBool("Open", true);
			}
			SyncStartOpeningDoorRpc();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SyncStartOpenin