Decompiled source of 48 Contingency v1.3.4

48contingency.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using 48contingency.NetcodePatcher;
using BepInEx;
using BepInEx.Logging;
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+0c6a387b28a86f096003bfe634b0c50ff073cb78")]
[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;

		private int muddyItemBaseCount = 12;

		private int muddyItemMaxExtra = 4;

		public bool OriginalLevelHasIndoorFog;

		public bool fogEnabled;

		public float initialFogDistance;

		private bool hasShownFlashlightTip = false;

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TriggerCrackleServerRpc(ulong networkObjectId, ulong senderClientId)
		{
			//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_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_0083: 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)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2241185517u, val3, val, (SendTo)2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, networkObjectId);
					BytePacker.WriteValueBitPacked(val2, senderClientId);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 2241185517u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					TriggerCrackleClientRpc(networkObjectId, senderClientId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void TriggerCrackleClientRpc(ulong networkObjectId, ulong senderClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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(229690131u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, networkObjectId);
				BytePacker.WriteValueBitPacked(val2, senderClientId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 229690131u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if ((!((Object)(object)NetworkManager.Singleton != (Object)null) || NetworkManager.Singleton.LocalClientId != senderClientId) && (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(networkObjectId, out var value))
			{
				MuddyItem component = ((Component)value).GetComponent<MuddyItem>();
				if ((Object)(object)component != (Object)null)
				{
					component.DoLocalCrackle();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void UpdateMudValueServerRpc(ulong networkObjectId, float newMudValue)
		{
			//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(4188246363u, val3, val, (SendTo)2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, networkObjectId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newMudValue, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val2, 4188246363u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					UpdateMudValueClientRpc(networkObjectId, newMudValue);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void UpdateMudValueClientRpc(ulong networkObjectId, float newMudValue)
		{
			//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(1835857366u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, networkObjectId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newMudValue, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1835857366u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (!NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(networkObjectId, out var value))
			{
				return;
			}
			MuddyItem component = ((Component)value).GetComponent<MuddyItem>();
			if ((Object)(object)component != (Object)null && (Object)(object)component.baseGrabbableObject != (Object)null && (!((Object)(object)component.baseGrabbableObject.playerHeldBy != (Object)null) || !((NetworkBehaviour)component.baseGrabbableObject.playerHeldBy).IsOwner))
			{
				component.muddy = newMudValue;
				component.lastSyncedMuddyValue = newMudValue;
				if (component.muddy <= 0f)
				{
					component.CleanItemCompletely(localOnly: true);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CleanItemServerRpc(ulong networkObjectId)
		{
			//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(2667043385u, val3, val, (SendTo)2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, networkObjectId);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 2667043385u, val3, val, (SendTo)2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					CleanItemClientRpc(networkObjectId);
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CleanItemClientRpc(ulong networkObjectId)
		{
			//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(386351741u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, networkObjectId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 386351741u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(networkObjectId, out var value))
			{
				MuddyItem component = ((Component)value).GetComponent<MuddyItem>();
				if ((Object)(object)component != (Object)null)
				{
					component.CleanItemCompletely(localOnly: true);
				}
			}
		}

		public void Awake()
		{
			renderers = GetActiveRenderers();
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			if ((Object)(object)dockHandler == (Object)null)
			{
				dockHandler = Object.FindObjectOfType<ApparatusDockHandler>();
			}
			SetExitReferences();
			if ((Object)(object)AmbienceAudio != (Object)null)
			{
				AmbienceAudio.spatialize = true;
				AmbienceAudio.spatialBlend = 1f;
				AmbienceAudio.rolloffMode = (AudioRolloffMode)0;
				AmbienceAudio.minDistance = 2f;
				AmbienceAudio.maxDistance = 20f;
				if ((Object)(object)ambienceClip != (Object)null)
				{
					AmbienceAudio.clip = ambienceClip;
				}
				AmbienceAudio.volume = 0f;
				AmbienceAudio.loop = true;
				AmbienceAudio.Play();
			}
		}

		public void EnableIndoorFog()
		{
			if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.indoorFog != (Object)null)
			{
				if (initialFogDistance <= 0f)
				{
					initialFogDistance = RoundManager.Instance.indoorFog.parameters.meanFreePath;
					if (initialFogDistance <= 0f)
					{
						initialFogDistance = 50f;
					}
				}
				OriginalLevelHasIndoorFog = ((Component)RoundManager.Instance.indoorFog).gameObject.activeSelf;
				((Component)RoundManager.Instance.indoorFog).gameObject.SetActive(true);
				RoundManager.Instance.indoorFog.parameters.meanFreePath = initialFogDistance * 2.3f;
			}
			fogEnabled = true;
		}

		public void DisableIndoorFog()
		{
			if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.indoorFog != (Object)null)
			{
				((Component)RoundManager.Instance.indoorFog).gameObject.SetActive(OriginalLevelHasIndoorFog);
				if (initialFogDistance > 0f)
				{
					RoundManager.Instance.indoorFog.parameters.meanFreePath = initialFogDistance;
				}
			}
			fogEnabled = false;
		}

		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()
		{
			if ((Object)(object)MonitorAudio != (Object)null && (Object)(object)MonitorAudio.clip != (Object)null)
			{
				MonitorAudio.volume = 1f;
				MonitorAudio.spatialize = true;
				MonitorAudio.spatialBlend = 1f;
				if (miscClips != null && miscClips.Length > 1 && (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)
			{
				return;
			}
			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)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if ((Object)(object)PCAnimator != (Object)null)
			{
				PCAnimator.SetBool("On", false);
			}
			if (!((Object)(object)garageDoorAnimator != (Object)null))
			{
				return;
			}
			if (garageDoorAnimator.GetBool("Open"))
			{
				if ((Object)(object)DoorAudio != (Object)null && miscClips != null && miscClips.Length > 2 && (Object)(object)miscClips[2] != (Object)null)
				{
					DoorAudio.Stop();
					DoorAudio.PlayOneShot(miscClips[2], 1f);
				}
				else if ((Object)(object)DoorAudio != (Object)null && (Object)(object)doorOpeningSfx != (Object)null)
				{
					DoorAudio.Stop();
					DoorAudio.PlayOneShot(doorOpeningSfx, 1f);
				}
			}
			garageDoorAnimator.SetBool("Open", false);
		}

		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}.");
			if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.indoorFog != (Object)null)
			{
				initialFogDistance = RoundManager.Instance.indoorFog.parameters.meanFreePath;
			}
			KyvidRandom = new Random(StartOfRound.Instance.randomMapSeed + 2352);
			kyividAnimator.SetInteger("state", kyividState);
			SetupLockersServerRpc();
			SetupBasinScrap();
		}

		private void SetupBasinScrap()
		{
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: 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_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Expected O, but got Unknown
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Expected O, but got Unknown
			Debug.Log((object)"[ControlRoomManager] SetupBasinScrap STARTED");
			GameObject val = GameObject.Find("BasinScrapSpawns");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"[ControlRoomManager] Could not find BasinScrapSpawns parent");
				return;
			}
			Debug.Log((object)"[ControlRoomManager] Found BasinScrapSpawns GameObject.");
			GameObject[] array = (from t in val.GetComponentsInChildren<Transform>(true)
				where (Object)(object)t != (Object)null && ((Object)t).name.StartsWith("ScrapNode")
				select ((Component)t).gameObject).ToArray();
			Debug.Log((object)$"[ControlRoomManager] Found {array.Length} ScrapNodes.");
			if (array.Length == 0)
			{
				Debug.LogError((object)"[ControlRoomManager] BasinScrapSpawns has no children starting with 'ScrapNode'");
				return;
			}
			int seed = (((Object)(object)StartOfRound.Instance != (Object)null) ? (StartOfRound.Instance.randomMapSeed + 393) : 393);
			BasinRandom = new Random(seed);
			if ((Object)(object)StartOfRound.Instance.currentLevel == (Object)null)
			{
				Debug.LogError((object)"[ControlRoomManager] !ERROR targetLevel passed into SetupBasinScrap is NULL!");
				return;
			}
			if (StartOfRound.Instance.currentLevel.spawnableScrap == null)
			{
				Debug.LogError((object)"[ControlRoomManager] !ERROR targetLevel.spawnableScrap is NULL!");
				return;
			}
			Debug.Log((object)$"[ControlRoomManager] targetLevel spawnableScrap count is {StartOfRound.Instance.currentLevel.spawnableScrap.Count}");
			int num = muddyItemBaseCount + BasinRandom.Next(muddyItemBaseCount);
			List<WeightedItemRefrence> list = new List<WeightedItemRefrence>();
			if ((Object)(object)StartOfRound.Instance.currentLevel != (Object)null && StartOfRound.Instance.currentLevel.spawnableScrap != null)
			{
				foreach (SpawnableItemWithRarity item in StartOfRound.Instance.currentLevel.spawnableScrap)
				{
					if (item == null)
					{
						Debug.Log((object)"[ControlRoomManager] Warning: itemRarity entry is null");
					}
					else if ((Object)(object)item.spawnableItem == (Object)null)
					{
						Debug.Log((object)"[ControlRoomManager] Warning: spawnableItem inside entry is null");
					}
					else if (item.spawnableItem.minValue >= 70)
					{
						list.Add(new WeightedItemRefrence
						{
							Item = item.spawnableItem,
							Weight = item.rarity,
							FindRegisteredItem = false
						});
					}
				}
				if (list.Count == 0)
				{
					Debug.Log((object)"[ControlRoomManager] No items found with minValue >= 70, checking maxValue...");
					foreach (SpawnableItemWithRarity item2 in StartOfRound.Instance.currentLevel.spawnableScrap)
					{
						if (item2 != null && !((Object)(object)item2.spawnableItem == (Object)null) && item2.spawnableItem.maxValue >= 70)
						{
							list.Add(new WeightedItemRefrence
							{
								Item = item2.spawnableItem,
								Weight = item2.rarity,
								FindRegisteredItem = false
							});
						}
					}
				}
			}
			WeightedItemRefrence[] array2 = list.ToArray();
			Debug.Log((object)$"[ControlRoomManager] customListArray generated. Built list contains {array2.Length} item variants.");
			if (array2 == null || array2.Length == 0)
			{
				Debug.LogWarning((object)"[ControlRoomManager] customListArray for scrap spawners is empty!");
				return;
			}
			Debug.Log((object)$"[ControlRoomManager] Preparing to loop and spawn {num} templates.");
			int num2 = 0;
			for (int num3 = 0; num3 < num; num3++)
			{
				int num4 = BasinRandom.Next(0, array.Length);
				if (!((Object)(object)array[num4] == (Object)null))
				{
					ItemSpawner val2 = new GameObject("BasinItemSpawner").AddComponent<ItemSpawner>();
					if ((Object)(object)val2 == (Object)null)
					{
						Debug.LogError((object)"[ControlRoomManager] Could not find BasinItemSpawner");
					}
					Vector2 randomPointInCircleForBasin = GetRandomPointInCircleForBasin(5f);
					((Component)val2).transform.position = array[num4].transform.position + new Vector3(randomPointInCircleForBasin.x, 5f, randomPointInCircleForBasin.y);
					((Behaviour)val2).enabled = false;
					val2.spawnOnEnabled = false;
					val2.SourcePool = (SpawnPoolSource)2;
					val2.CustomList = array2;
					val2.spawnRotation = (RotationType)1;
					((Component)val2).transform.localEulerAngles = new Vector3(0f, (float)BasinRandom.Next(0, 360), 0f);
					basinScrapSpawners.Add(val2);
					((Component)val2).gameObject.SetActive(true);
					num2++;
				}
			}
			Debug.Log((object)$"[ControlRoomManager] >>> SetupBasinScrap FINISHED <<< Successfully queued {num2} spawners.");
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ApplyMuddyEffectsClientRpc(ulong networkObjectId)
		{
			//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(864406582u, val3, val, (SendTo)7, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, networkObjectId);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 864406582u, val3, val, (SendTo)7, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)RoundManager.Instance).IsServer && !((NetworkBehaviour)RoundManager.Instance).IsHost && NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(networkObjectId, out var value))
			{
				GrabbableObject component = ((Component)value).GetComponent<GrabbableObject>();
				if ((Object)(object)component != (Object)null)
				{
					ApplyMuddyEffects(component);
				}
			}
		}

		public void ApplyMuddyEffects(GrabbableObject grabbable)
		{
			if (!((Object)(object)grabbable == (Object)null))
			{
				MuddyItem.Create(grabbable);
			}
		}

		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)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (lockers != null && lockerStates != null)
			{
				for (int i = 0; i < lockers.Length; i++)
				{
					((Component)lockers[i]).gameObject.SetActive(lockerStates[i]);
				}
			}
		}

		private IEnumerator DelugeFloodEvent()
		{
			if ((Object)(object)DelugePumpAudio != (Object)null)
			{
				DelugePumpAudio.spatialize = false;
				DelugePumpAudio.spatialBlend = 1f;
				if ((Object)(object)delugePumpWhir != (Object)null)
				{
					DelugePumpAudio.PlayOneShot(delugePumpWhir);
				}
				if ((Object)(object)delugeFlow != (Object)null)
				{
					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.spatialize = true;
				MonitorAudio.spatialBlend = 1f;
				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(0.5f);
			if (basinScrapSpawners != null && basinScrapSpawners.Count > 0 && (((NetworkBehaviour)RoundManager.Instance).IsServer || ((NetworkBehaviour)RoundManager.Instance).IsHost))
			{
				object obj3 = RoundManager.Instance?.spawnedScrapContainer;
				if (obj3 == null)
				{
					RoundManager instance = RoundManager.Instance;
					if (instance == null)
					{
						obj3 = null;
					}
					else
					{
						GameObject mapPropsContainer = instance.mapPropsContainer;
						obj3 = ((mapPropsContainer != null) ? mapPropsContainer.transform : null);
					}
				}
				Transform targetContainer = (Transform)obj3;
				for (int k = 0; k < basinScrapSpawners.Count; k++)
				{
					ItemSpawner spawner = basinScrapSpawners[k];
					if ((Object)(object)spawner == (Object)null)
					{
						continue;
					}
					List<KeyValuePair<GrabbableObject, int>> spawnedResultList = ItemSpawner.SpawnRandomItems(spawner.SourcePool, ((Component)spawner).transform.position, targetContainer, ((Component)spawner).transform.rotation, spawner.CustomList, (Vector3[])null, 1, true, spawner.spawnRotation);
					foreach (KeyValuePair<GrabbableObject, int> item in spawnedResultList)
					{
						GrabbableObject newlySpawnedItem = item.Key;
						if ((Object)(object)newlySpawnedItem != (Object)null)
						{
							ApplyMuddyEffects(newlySpawnedItem);
							NetworkObject netObj = ((Component)newlySpawnedItem).GetComponent<NetworkObject>();
							if ((Object)(object)netObj != (Object)null)
							{
								ApplyMuddyEffectsClientRpc(netObj.NetworkObjectId);
							}
						}
					}
					if (k % 3 == 0)
					{
						yield return null;
					}
				}
			}
			yield return (object)new WaitForSeconds(0.5f);
			object obj4 = RoundManager.Instance?.spawnedScrapContainer;
			if (obj4 == null)
			{
				GameObject obj5 = GameObject.Find("MapPropsContainer");
				obj4 = ((obj5 != null) ? obj5.transform : null);
			}
			Transform scrapContainer = (Transform)obj4;
			if ((Object)(object)scrapContainer != (Object)null && basinScrapSpawners != null && basinScrapSpawners.Count > 0)
			{
				Vector3[] spawnerPositions = (from s in basinScrapSpawners
					where (Object)(object)s != (Object)null
					select ((Component)s).transform.position).ToArray();
				int childCount = scrapContainer.childCount;
				for (int i2 = 0; i2 < childCount; i2++)
				{
					Transform child = scrapContainer.GetChild(i2);
					if ((Object)(object)child == (Object)null)
					{
						continue;
					}
					GrabbableObject scrapItem = ((Component)child).GetComponent<GrabbableObject>();
					if ((Object)(object)scrapItem == (Object)null || scrapItem.isHeld || (Object)(object)((Component)scrapItem).GetComponent<MuddyItem>() != (Object)null)
					{
						continue;
					}
					Vector3 itemPos = ((Component)scrapItem).transform.position;
					for (int j2 = 0; j2 < spawnerPositions.Length; j2++)
					{
						Vector3 val = itemPos - spawnerPositions[j2];
						if (((Vector3)(ref val)).sqrMagnitude <= 144f)
						{
							ApplyMuddyEffects(scrapItem);
							NetworkObject backupNetObj = ((Component)scrapItem).GetComponent<NetworkObject>();
							if ((Object)(object)backupNetObj != (Object)null)
							{
								ApplyMuddyEffectsClientRpc(backupNetObj.NetworkObjectId);
							}
							break;
						}
					}
					if (i2 % 15 == 0)
					{
						yield return null;
					}
				}
			}
			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");
			}
		}

		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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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)
			{
				TimeOfDay.Instance.effects[1].effectEnabled = isRainingInside;
			}
			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)
		{
			EnableIndoorFog();
			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)
		{
			DisableIndoorFog();
			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
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2241185517u, new RpcReceiveHandler(__rpc_handler_2241185517), "TriggerCrackleServerRpc");
			((NetworkBehaviour)this).__registerRpc(229690131u, new RpcReceiveHandler(__rpc_handler_229690131), "TriggerCrackleClientRpc");
			((NetworkBehaviour)this).__registerRpc(4188246363u, new RpcReceiveHandler(__rpc_handler_4188246363), "UpdateMudValueServerRpc");
			((NetworkBehaviour)this).__registerRpc(1835857366u, new RpcReceiveHandler(__rpc_handler_1835857366), "UpdateMudValueClientRpc");
			((NetworkBehaviour)this).__registerRpc(2667043385u, new RpcReceiveHandler(__rpc_handler_2667043385), "CleanItemServerRpc");
			((NetworkBehaviour)this).__registerRpc(386351741u, new RpcReceiveHandler(__rpc_handler_386351741), "CleanItemClientRpc");
			((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(864406582u, new RpcReceiveHandler(__rpc_handler_864406582), "ApplyMuddyEffectsClientRpc");
			((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_2241185517(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong networkObjectId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref networkObjectId);
				ulong senderClientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).TriggerCrackleServerRpc(networkObjectId, senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_229690131(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong networkObjectId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref networkObjectId);
				ulong senderClientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).TriggerCrackleClientRpc(networkObjectId, senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4188246363(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 networkObjectId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref networkObjectId);
				float newMudValue = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newMudValue, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).UpdateMudValueServerRpc(networkObjectId, newMudValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1835857366(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 networkObjectId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref networkObjectId);
				float newMudValue = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newMudValue, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).UpdateMudValueClientRpc(networkObjectId, newMudValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2667043385(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 networkObjectId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref networkObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ControlRoomManager)(object)target).CleanItemServerRpc(networkObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_386351741(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