Decompiled source of Black Mesa Half Life Moon Interior v2.0.1

BlackMesa.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using BlackMesa.Components;
using BlackMesa.NetcodePatcher;
using BlackMesa.Patches;
using BlackMesa.Utilities;
using DunGen;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEditor;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("BlackMesa")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A Black Mesa mod for Lethal Company ")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b1c0ca5496f2e1c3217507eb9601cb4081261bb7")]
[assembly: AssemblyProduct("BlackMesa")]
[assembly: AssemblyTitle("BlackMesa")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BlackMesa
{
	public class AcidWater : MonoBehaviour
	{
		public int DamageAmount;

		public float DamageTickRate;

		private float TimeSincePlayerDamaged;

		private void OnTriggerStay(Collider other)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if (((Component)other).gameObject.CompareTag("Player"))
			{
				if (TimeSincePlayerDamaged < DamageTickRate)
				{
					TimeSincePlayerDamaged += Time.deltaTime;
				}
				else if ((Object)(object)component != (Object)null)
				{
					TimeSincePlayerDamaged = 0f;
					component.DamagePlayer(DamageAmount, true, true, (CauseOfDeath)9, 0, false, default(Vector3));
				}
			}
		}
	}
	public class BlackMesaTV : NetworkBehaviour
	{
		public bool tvOn;

		private bool wasTvOnLastFrame;

		public MeshRenderer tvMesh;

		public VideoPlayer video;

		[Space(5f)]
		public VideoClip[] tvClips;

		public AudioClip[] tvAudioClips;

		[Space(5f)]
		private float currentClipTime;

		private int currentClip;

		public Material tvOnMaterial;

		public Material tvOffMaterial;

		public AudioClip switchTVOn;

		public AudioClip switchTVOff;

		public AudioSource tvSFX;

		private float timeSinceTurningOffTV;

		public Light tvLight;

		public void TurnTVOnOff(bool on)
		{
			Debug.Log((object)"TurnTVOnOff");
			tvOn = on;
			if (on)
			{
				tvSFX.clip = tvAudioClips[currentClip];
				tvSFX.time = currentClipTime;
				tvSFX.Play();
				tvSFX.PlayOneShot(switchTVOn);
				WalkieTalkie.TransmitOneShotAudio(tvSFX, switchTVOn, 1f);
			}
			else
			{
				tvSFX.Stop();
				tvSFX.PlayOneShot(switchTVOff);
				WalkieTalkie.TransmitOneShotAudio(tvSFX, switchTVOff, 1f);
			}
		}

		public void SwitchTVLocalClient()
		{
			Debug.Log((object)"SwitchTVLocalClient");
			if (tvOn)
			{
				TurnOffTVServerRpc();
			}
			else
			{
				TurnOnTVServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TurnOnTVServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3283880837u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3283880837u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				Debug.Log((object)"TurnOnTVServerRpc");
				timeSinceTurningOffTV = 0f;
				if (timeSinceTurningOffTV > 7f)
				{
					TurnOnTVAndSyncClientRpc(currentClip, currentClipTime);
				}
				else
				{
					TurnOnTVClientRpc();
				}
			}
		}

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

		[ClientRpc]
		public void TurnOnTVAndSyncClientRpc(int clipIndex, float clipTime)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3721177157u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clipIndex);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref clipTime, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3721177157u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Debug.Log((object)"TurnOnTVAndSyncClientRpc");
					currentClip = clipIndex;
					currentClipTime = clipTime;
					TurnTVOnOff(on: true);
				}
			}
		}

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

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

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

		[ClientRpc]
		public void SyncTVClientRpc(int clipIndex, float clipTime, bool isOn)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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)
			//IL_00ab: 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)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2381994938u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clipIndex);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref clipTime, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isOn, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2381994938u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					SyncTimeAndClipWithClients(clipIndex, clipTime, isOn);
				}
			}
		}

		private void SyncTimeAndClipWithClients(int clipIndex, float clipTime, bool isOn)
		{
			currentClip = clipIndex;
			currentClipTime = clipTime;
			tvOn = isOn;
		}

		private void OnEnable()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Debug.Log((object)"OnEnable");
			video.loopPointReached += new EventHandler(TVFinishedClip);
		}

		private void OnDisable()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Debug.Log((object)"OnDisable");
			video.loopPointReached -= new EventHandler(TVFinishedClip);
		}

		private void TVFinishedClip(VideoPlayer source)
		{
			if (tvOn && !GameNetworkManager.Instance.localPlayerController.isInsideFactory)
			{
				currentClip = (currentClip + 1) % tvClips.Length;
				video.clip = tvClips[currentClip];
				video.Play();
				tvSFX.clip = tvAudioClips[currentClip];
				tvSFX.time = 0f;
				tvSFX.Play();
			}
		}

		private void Update()
		{
			if (NetworkManager.Singleton.ShutdownInProgress || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if (!tvOn)
			{
				Debug.Log((object)"TV is off");
				if (wasTvOnLastFrame)
				{
					wasTvOnLastFrame = false;
					SetTVScreenMaterial(on: false);
					currentClipTime = (float)video.time;
					video.Stop();
				}
				if (((NetworkBehaviour)this).IsServer && !tvOn)
				{
					timeSinceTurningOffTV += Time.deltaTime;
				}
				currentClipTime += Time.deltaTime;
				if ((double)currentClipTime > tvClips[currentClip].length)
				{
					currentClip = (currentClip + 1) % tvClips.Length;
					currentClipTime = 0f;
					if (tvOn)
					{
						tvSFX.clip = tvAudioClips[currentClip];
						tvSFX.Play();
					}
				}
			}
			else
			{
				if (!wasTvOnLastFrame)
				{
					Debug.Log((object)"TV is on");
					wasTvOnLastFrame = true;
					SetTVScreenMaterial(on: true);
					video.clip = tvClips[currentClip];
					video.time = currentClipTime;
					video.Play();
				}
				currentClipTime = (float)video.time;
			}
		}

		private void SetTVScreenMaterial(bool on)
		{
			Material[] sharedMaterials = ((Renderer)tvMesh).sharedMaterials;
			if (on)
			{
				sharedMaterials[1] = tvOnMaterial;
			}
			else
			{
				sharedMaterials[1] = tvOffMaterial;
			}
			((Renderer)tvMesh).sharedMaterials = sharedMaterials;
			((Behaviour)tvLight).enabled = on;
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BlackMesaTV()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3283880837u, new RpcReceiveHandler(__rpc_handler_3283880837));
			NetworkManager.__rpc_func_table.Add(695285450u, new RpcReceiveHandler(__rpc_handler_695285450));
			NetworkManager.__rpc_func_table.Add(3721177157u, new RpcReceiveHandler(__rpc_handler_3721177157));
			NetworkManager.__rpc_func_table.Add(2933561972u, new RpcReceiveHandler(__rpc_handler_2933561972));
			NetworkManager.__rpc_func_table.Add(1766435624u, new RpcReceiveHandler(__rpc_handler_1766435624));
			NetworkManager.__rpc_func_table.Add(2492773695u, new RpcReceiveHandler(__rpc_handler_2492773695));
			NetworkManager.__rpc_func_table.Add(2381994938u, new RpcReceiveHandler(__rpc_handler_2381994938));
		}

		private static void __rpc_handler_3283880837(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;
				((BlackMesaTV)(object)target).TurnOnTVServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_3721177157(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)
			{
				int clipIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
				float clipTime = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref clipTime, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BlackMesaTV)(object)target).TurnOnTVAndSyncClientRpc(clipIndex, clipTime);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2933561972(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;
				((BlackMesaTV)(object)target).TurnOffTVServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2492773695(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;
				((BlackMesaTV)(object)target).SyncTVServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2381994938(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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int clipIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex);
				float clipTime = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref clipTime, default(ForPrimitives));
				bool isOn = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isOn, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BlackMesaTV)(object)target).SyncTVClientRpc(clipIndex, clipTime, isOn);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BlackMesaTV";
		}
	}
	public class ContainmentDoor : MonoBehaviour
	{
		public InteractTrigger triggerScript;

		private StartOfRound playersManager;

		public Animator shipDoorsAnimator;

		public bool buttonsEnabled = true;

		public float doorPower = 1f;

		public float doorPowerDuration = 10f;

		public bool overheated;

		public bool doorsOpenedInGameOverAnimation;

		public GameObject hydraulicsDisplay;

		private bool hydraulicsScreenDisplayed = true;

		public void Update()
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			SetScreenDisplay();
			if (StartOfRound.Instance.hangarDoorsClosed && StartOfRound.Instance.shipHasLanded)
			{
				overheated = false;
				triggerScript.interactable = true;
				if (doorPower > 0f)
				{
					doorPower = Mathf.Clamp(doorPower - Time.deltaTime / doorPowerDuration, 0f, 1f);
				}
				else if (NetworkManager.Singleton.IsServer)
				{
					PlayDoorAnimation(closed: false);
					StartOfRound.Instance.SetShipDoorsOverheatServerRpc();
				}
			}
			else
			{
				doorPower = Mathf.Clamp(doorPower + Time.deltaTime / (doorPowerDuration * 0.22f), 0f, 1f);
				if (overheated && doorPower >= 1f)
				{
					overheated = false;
					triggerScript.interactable = true;
				}
			}
		}

		private void SetScreenDisplay()
		{
			bool flag = true;
			if (hydraulicsScreenDisplayed != flag)
			{
				hydraulicsScreenDisplayed = flag;
				hydraulicsDisplay.SetActive(flag);
			}
		}

		public void PlayDoorAnimation(bool closed)
		{
			if (buttonsEnabled)
			{
				shipDoorsAnimator.SetBool("Closed", closed);
			}
		}

		public void SetDoorClosed()
		{
			playersManager.SetShipDoorsClosed(true);
		}

		public void SetDoorOpen()
		{
			playersManager.SetShipDoorsClosed(false);
		}

		public void SetDoorButtonsEnabled(bool doorButtonsEnabled)
		{
			buttonsEnabled = true;
		}

		private void Start()
		{
			playersManager = Object.FindObjectOfType<StartOfRound>();
		}
	}
	public class Crowbar : GrabbableObject
	{
		public AudioSource knifeAudio;

		private List<RaycastHit> objectsHitByKnifeList = new List<RaycastHit>();

		public PlayerControllerB previousPlayerHeldBy;

		private RaycastHit[] objectsHitByKnife;

		public int knifeHitForce;

		public AudioClip[] hitSFX;

		public AudioClip[] swingSFX;

		private int knifeMask = 11012424;

		private float timeAtLastDamageDealt;

		public ParticleSystem bloodParticle;

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			RoundManager.PlayRandomClip(knifeAudio, swingSFX, true, 1f, 0, 1000);
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				previousPlayerHeldBy = base.playerHeldBy;
				if (((NetworkBehaviour)base.playerHeldBy).IsOwner)
				{
					base.playerHeldBy.playerBodyAnimator.SetTrigger("UseHeldItem1");
				}
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				HitKnife();
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
		}

		public void HitKnife(bool cancel = false)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)previousPlayerHeldBy == (Object)null)
			{
				Debug.LogError((object)"Previousplayerheldby is null on this client when HitShovel is called.");
				return;
			}
			previousPlayerHeldBy.activatingItem = false;
			bool flag = false;
			bool flag2 = false;
			int num = -1;
			if (!cancel)
			{
				previousPlayerHeldBy.twoHanded = false;
				objectsHitByKnife = Physics.SphereCastAll(((Component)previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.6f, ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward, 2f, knifeMask, (QueryTriggerInteraction)2);
				objectsHitByKnifeList = objectsHitByKnife.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList();
				IHittable val2 = default(IHittable);
				for (int i = 0; i < objectsHitByKnifeList.Count; i++)
				{
					RaycastHit val = objectsHitByKnifeList[i];
					if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8)
					{
						val = objectsHitByKnifeList[i];
						if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11)
						{
							val = objectsHitByKnifeList[i];
							if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2))
							{
								continue;
							}
							val = objectsHitByKnifeList[i];
							if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)previousPlayerHeldBy).transform)
							{
								continue;
							}
							val = objectsHitByKnifeList[i];
							if (!(((RaycastHit)(ref val)).point == Vector3.zero))
							{
								Vector3 position = ((Component)previousPlayerHeldBy.gameplayCamera).transform.position;
								RaycastHit val3 = objectsHitByKnifeList[i];
								if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
								{
									continue;
								}
							}
							flag = true;
							Vector3 forward = ((Component)previousPlayerHeldBy.gameplayCamera).transform.forward;
							try
							{
								if (Time.realtimeSinceStartup - timeAtLastDamageDealt > 5f)
								{
									timeAtLastDamageDealt = Time.realtimeSinceStartup;
									val2.Hit(knifeHitForce, forward, previousPlayerHeldBy, true, 5);
									bloodParticle.Play(true);
								}
								flag2 = true;
							}
							catch (Exception arg)
							{
								Debug.Log((object)$"Exception caught when hitting object with shovel from player #{previousPlayerHeldBy.playerClientId}: {arg}");
							}
							continue;
						}
					}
					flag = true;
					val = objectsHitByKnifeList[i];
					string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag;
					for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++)
					{
						if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag)
						{
							num = j;
							break;
						}
					}
				}
			}
			if (flag)
			{
				RoundManager.PlayRandomClip(knifeAudio, hitSFX, true, 1f, 0, 1000);
				Object.FindObjectOfType<RoundManager>().PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0);
				if (!flag2 && num != -1)
				{
					knifeAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX);
					WalkieTalkie.TransmitOneShotAudio(knifeAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f);
				}
				HitShovelServerRpc(num);
			}
		}

		[ServerRpc]
		public void HitShovelServerRpc(int hitSurfaceID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(550859015u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 550859015u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				HitShovelClientRpc(hitSurfaceID);
			}
		}

		[ClientRpc]
		public void HitShovelClientRpc(int hitSurfaceID)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3289785206u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, hitSurfaceID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3289785206u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
			{
				RoundManager.PlayRandomClip(knifeAudio, hitSFX, true, 1f, 0, 1000);
				if (hitSurfaceID != -1)
				{
					HitSurfaceWithKnife(hitSurfaceID);
				}
			}
		}

		private void HitSurfaceWithKnife(int hitSurfaceID)
		{
			knifeAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX);
			WalkieTalkie.TransmitOneShotAudio(knifeAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f);
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Crowbar()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(550859015u, new RpcReceiveHandler(__rpc_handler_550859015));
			NetworkManager.__rpc_func_table.Add(3289785206u, new RpcReceiveHandler(__rpc_handler_3289785206));
		}

		private static void __rpc_handler_550859015(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_009d: 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_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Crowbar)(object)target).HitShovelServerRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3289785206(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)
			{
				int hitSurfaceID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Crowbar)(object)target).HitShovelClientRpc(hitSurfaceID);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Crowbar";
		}
	}
	public class DamageZone : MonoBehaviour
	{
		public int DamageAmount;

		public float DamageTickRate;

		public CauseOfDeath cause;

		private float TimeSincePlayerDamaged;

		private void OnTriggerStay(Collider other)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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)
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if (((Component)other).gameObject.CompareTag("Player"))
			{
				if (TimeSincePlayerDamaged < DamageTickRate)
				{
					TimeSincePlayerDamaged += Time.deltaTime;
				}
				else if ((Object)(object)component != (Object)null)
				{
					TimeSincePlayerDamaged = 0f;
					component.DamagePlayer(DamageAmount, true, true, cause, 0, false, default(Vector3));
				}
			}
		}
	}
	internal interface INightVisionCamera
	{
		Camera Camera { get; }

		Light NightVisionLight { get; }
	}
	public class InstructionManual : GrabbableObject
	{
		public int currentPage = 1;

		public Animator clipboardAnimator;

		public AudioClip[] turnPageSFX;

		public AudioSource thisAudio;

		public override void PocketItem()
		{
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.equippedUsableItemQE = false;
				base.isBeingUsed = false;
			}
			((GrabbableObject)this).PocketItem();
		}

		public override void ItemInteractLeftRight(bool right)
		{
			int num = currentPage;
			((GrabbableObject)this).RequireCooldown();
			if (right)
			{
				currentPage = Mathf.Clamp(currentPage + 1, 1, 4);
			}
			else
			{
				currentPage = Mathf.Clamp(currentPage - 1, 1, 4);
			}
			if (currentPage != num)
			{
				RoundManager.PlayRandomClip(thisAudio, turnPageSFX, true, 1f, 0, 1000);
			}
			clipboardAnimator.SetInteger("page", currentPage);
		}

		public override void DiscardItem()
		{
			if ((Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.equippedUsableItemQE = false;
			}
			base.isBeingUsed = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			base.playerHeldBy.equippedUsableItemQE = true;
			if (((NetworkBehaviour)this).IsOwner)
			{
				HUDManager.Instance.DisplayTip("To read the manual:", "Press Z to inspect closely. Press Q and E to flip the pages.", false, true, "LCTip_UseManual");
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "InstructionManual";
		}
	}
	internal class Laser : MonoBehaviour
	{
		private LineRenderer lr;

		private void Start()
		{
			lr = ((Component)this).GetComponent<LineRenderer>();
		}

		private void LateUpdate()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			lr.SetPosition(0, ((Component)this).transform.position);
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val))
			{
				if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider))
				{
					lr.SetPosition(1, ((RaycastHit)(ref val)).point);
				}
			}
			else
			{
				lr.SetPosition(1, ((Component)this).transform.position + ((Component)this).transform.forward * 5000f);
			}
		}
	}
	[BepInPlugin("Plastered_Crab.BlackMesaInterior", "Black Mesa Interior", "2.0.1")]
	public class BlackMesaInterior : BaseUnityPlugin
	{
		public const string GUID = "Plastered_Crab.BlackMesaInterior";

		public const string NAME = "Black Mesa Interior";

		public const string VERSION = "2.0.1";

		public static BlackMesaInterior Instance;

		private readonly Harmony harmony = new Harmony("Plastered_Crab.BlackMesaInterior");

		internal static ManualLogSource Logger;

		internal static DungeonFlow BlackMesaFlow;

		internal static AssetBundle Assets;

		private static AudioMixerGroup[] mixerGroups;

		private void Awake()
		{
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "blackmesainterior"));
			if ((Object)(object)Assets == (Object)null)
			{
				if (!Application.isEditor)
				{
					Logger.LogError((object)"Failed to load interior dungeon assets.");
					return;
				}
				Logger.LogWarning((object)"Failed to load interior dungeon assets, attempting to continue by loading resources by path.");
			}
			else
			{
				Logger.LogInfo((object)"Interior assets loaded successfully.");
			}
			ExtendedMod val = BlackMesaInterior.LoadAsset<ExtendedMod>("Assets/LethalCompany/Mods/BlackMesaInterior/BlackMesaInteriorMod.asset");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Failed to load the interior assets. Stopping.");
				return;
			}
			if (val.ExtendedDungeonFlows.Count < 1)
			{
				Logger.LogError((object)"The extended mod has no dungeon flow?!");
				return;
			}
			BlackMesaFlow = val.ExtendedDungeonFlows[0].DungeonFlow;
			PatchedContent.RegisterExtendedMod(val);
			Logger.LogInfo((object)"Loaded and registered interior assets.");
			harmony.PatchAll(typeof(PatchStartOfRound));
			harmony.PatchAll(typeof(PatchRoundManager));
			harmony.PatchAll(typeof(PatchNetworkManager));
			harmony.PatchAll(typeof(PatchDungeonGenerator));
			harmony.PatchAll(typeof(PatchLungProp));
			InitializeNetworkBehaviour(typeof(HandheldTVCamera));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Props/HandheldTV.prefab");
			InitializeNetworkBehaviour(typeof(Tripmine));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Props/Tripmine.prefab");
			InitializeNetworkBehaviour(typeof(StationBase));
			InitializeNetworkBehaviour(typeof(HealingStation));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Props/Healing Station.prefab");
			InitializeNetworkBehaviour(typeof(ChargingStation));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Props/HEV Station 1.prefab");
		}

		internal static T LoadAsset<T>(string path) where T : Object
		{
			if ((Object)(object)Assets != (Object)null)
			{
				return Assets.LoadAsset<T>(path);
			}
			if (!Application.isEditor)
			{
				return default(T);
			}
			try
			{
				return TryToLoadAssetDirectlyInEditor<T>(path);
			}
			catch (FileNotFoundException)
			{
				Logger.LogError((object)"Editor assembly is not present.");
				return default(T);
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static T TryToLoadAssetDirectlyInEditor<T>(string path) where T : Object
		{
			return AssetDatabase.LoadAssetAtPath<T>(path);
		}

		private static void InitializeNetworkBehaviour(Type type)
		{
			MethodInfo method = type.GetMethod("InitializeRPCS_" + type.Name, BindingFlags.Static | BindingFlags.NonPublic);
			if (method == null)
			{
				Logger.LogError((object)$"{type} does not have a static RPC initializer method.");
			}
			else
			{
				method.Invoke(null, null);
			}
		}

		private static void RegisterNetworkPrefab(string path)
		{
			GameObject val = BlackMesaInterior.LoadAsset<GameObject>(path);
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)("The prefab \"" + path + "\" was not found."));
				return;
			}
			NetworkObject val2 = default(NetworkObject);
			if (!val.TryGetComponent<NetworkObject>(ref val2))
			{
				Logger.LogError((object)$"The prefab {val} from path \"{path}\" has no NetworkObject.");
				return;
			}
			PatchNetworkManager.AddNetworkPrefab(val);
			if (mixerGroups == null)
			{
				mixerGroups = Resources.FindObjectsOfTypeAll<AudioMixerGroup>();
			}
			AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>();
			foreach (AudioSource val3 in componentsInChildren)
			{
				if ((Object)(object)val3.outputAudioMixerGroup == (Object)null)
				{
					Logger.LogWarning((object)$"{val3} on the prefab {val} from path \"{path}\" has a null output.");
					continue;
				}
				AudioMixerGroup val4 = null;
				AudioMixerGroup[] array = mixerGroups;
				foreach (AudioMixerGroup val5 in array)
				{
					if (((Object)val5).name == ((Object)val3.outputAudioMixerGroup).name)
					{
						val4 = val5;
						break;
					}
				}
				if (!((Object)(object)val4 == (Object)null))
				{
					val3.outputAudioMixerGroup = val4;
				}
			}
		}
	}
	public class RadiationWarningZone : MonoBehaviour
	{
		private void OnTriggerEnter(Collider radiationZone)
		{
			if (((Component)radiationZone).gameObject.CompareTag("Player") && !((Object)(object)radiationZone == (Object)null) && !((Object)(object)((Component)radiationZone).gameObject.GetComponent<PlayerControllerB>() != (Object)(object)StartOfRound.Instance.localPlayerController))
			{
				Debug.Log((object)"Entered Radiation Warning Zone");
				HUDManager.Instance.RadiationWarningHUD();
				HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", true);
			}
		}

		private void OnTriggerExit(Collider radiationZone)
		{
			if (((Component)radiationZone).gameObject.CompareTag("Player") && !((Object)(object)radiationZone == (Object)null))
			{
				((Component)radiationZone).gameObject.GetComponent<PlayerControllerB>();
				Debug.Log((object)"Exited Radiation Warning Zone");
				HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false);
			}
		}
	}
	public class SecurityCamera : NetworkBehaviour, INightVisionCamera
	{
		[SerializeField]
		private Camera camera;

		[SerializeField]
		private Light nightVisionLight;

		public Camera Camera => camera;

		public Light NightVisionLight => nightVisionLight;

		private void Start()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			camera.targetTexture = new RenderTexture(camera.targetTexture);
			SecurityCameraManager.Instance.AssignSecurityCameraFeed(this);
		}

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

		protected internal override string __getTypeName()
		{
			return "SecurityCamera";
		}
	}
	internal class SecurityCameraManager : MonoBehaviour
	{
		internal List<SecurityCamera> securityCameras = new List<SecurityCamera>();

		internal List<HandheldTVCamera> handheldTVCameras = new List<HandheldTVCamera>();

		internal HashSet<Camera> nightVisionCameraSet = new HashSet<Camera>();

		internal List<Light> nightVisionLights = new List<Light>();

		internal static SecurityCameraManager Instance;

		public MeshRenderer handheldTVTerminal;

		public List<int> handheldTVMaterialIndices;

		public List<BoxCollider> handheldTVTerminalScreenColliders;

		private Bounds[] handheldTVTerminalScreenBounds;

		private int currentHandheldTVIndex;

		public MeshRenderer securityFeedTerminal;

		public Material securityFeedMaterial;

		public List<int> securityCameraMaterialIndices;

		public List<BoxCollider> securityFeedTerminalScreenColliders;

		private Bounds[] securityFeedTerminalScreenBounds;

		private int currentSecurityCameraIndex;

		private Camera[] allCameras = Array.Empty<Camera>();

		private Plane[][] allCameraFrustums = Array.Empty<Plane[]>();

		private const float ActiveTerminalDistance = 15f;

		private const float ActiveTerminalDistanceSqr = 225f;

		private const float ActiveHandheldDistance = 5f;

		private const float ActiveHandheldDistanceSqr = 25f;

		private void Start()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			securityFeedTerminalScreenBounds = (Bounds[])(object)new Bounds[securityFeedTerminalScreenColliders.Count];
			for (int i = 0; i < securityFeedTerminalScreenColliders.Count; i++)
			{
				securityFeedTerminalScreenBounds[i] = ((Collider)securityFeedTerminalScreenColliders[i]).bounds;
			}
			handheldTVTerminalScreenBounds = (Bounds[])(object)new Bounds[handheldTVTerminalScreenColliders.Count];
			for (int j = 0; j < handheldTVTerminalScreenColliders.Count; j++)
			{
				handheldTVTerminalScreenBounds[j] = ((Collider)handheldTVTerminalScreenColliders[j]).bounds;
			}
		}

		private void AddNightVisionCamera(INightVisionCamera nightVisionCamera)
		{
			nightVisionCameraSet.Add(nightVisionCamera.Camera);
			nightVisionLights.Add(nightVisionCamera.NightVisionLight);
		}

		public void AssignSecurityCameraFeed(SecurityCamera securityCamera)
		{
			//IL_0037: 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_004e: Expected O, but got Unknown
			if (currentSecurityCameraIndex < securityCameraMaterialIndices.Count)
			{
				int index = securityCameraMaterialIndices[currentSecurityCameraIndex++];
				Material material = new Material(securityFeedMaterial)
				{
					mainTexture = (Texture)(object)securityCamera.Camera.targetTexture
				};
				((Renderer)(object)securityFeedTerminal).SetMaterial(index, material);
				Debug.Log((object)"Added security camera to nightvision camera list");
				securityCameras.Add(securityCamera);
				AddNightVisionCamera(securityCamera);
			}
		}

		public void AssignHandheldTVFeed(HandheldTVCamera handheldTVCamera, Material material)
		{
			if (currentHandheldTVIndex < handheldTVMaterialIndices.Count)
			{
				Material[] sharedMaterials = ((Renderer)handheldTVTerminal).sharedMaterials;
				int num = handheldTVMaterialIndices[currentHandheldTVIndex];
				sharedMaterials[num] = material;
				((Renderer)handheldTVTerminal).sharedMaterials = sharedMaterials;
				currentHandheldTVIndex++;
				Debug.Log((object)"Added handheld TV to nightvision camera list");
				handheldTVCameras.Add(handheldTVCamera);
				AddNightVisionCamera(handheldTVCamera);
			}
		}

		public void Awake()
		{
			Instance = this;
		}

		public void OnEnable()
		{
			RenderPipelineManager.beginCameraRendering += UpdateVisibleLights;
		}

		private void GetCameraFrustums()
		{
			if (allCameras.Length != Camera.allCamerasCount)
			{
				allCameras = (Camera[])(object)new Camera[Camera.allCamerasCount];
				allCameraFrustums = new Plane[allCameras.Length][];
				for (int i = 0; i < allCameraFrustums.Length; i++)
				{
					allCameraFrustums[i] = (Plane[])(object)new Plane[6];
				}
			}
			Camera.GetAllCameras(allCameras);
			for (int j = 0; j < allCameras.Length; j++)
			{
				GeometryUtility.CalculateFrustumPlanes(allCameras[j], allCameraFrustums[j]);
			}
		}

		public bool IsBoundingBoxVisibleOnOtherCameras(Bounds bounds, float activeDistanceSqr)
		{
			//IL_002a: 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_003a: 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)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < allCameras.Length; i++)
			{
				Camera val = allCameras[i];
				if (((uint)val.cullingMask & (true ? 1u : 0u)) != 0 && val != null && !nightVisionCameraSet.Contains(val))
				{
					Vector3 val2 = ((Bounds)(ref bounds)).center - ((Component)val).transform.position;
					if (!(((Vector3)(ref val2)).sqrMagnitude > activeDistanceSqr) && GeometryUtility.TestPlanesAABB(allCameraFrustums[i], bounds))
					{
						return true;
					}
				}
			}
			return false;
		}

		public void Update()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			GetCameraFrustums();
			for (int i = 0; i < securityCameras.Count; i++)
			{
				SecurityCamera securityCamera = securityCameras[i];
				if (!((Object)(object)securityCamera == (Object)null))
				{
					bool flag = ((Renderer)securityFeedTerminal).isVisible;
					if (flag && i < securityFeedTerminalScreenBounds.Length)
					{
						flag = IsBoundingBoxVisibleOnOtherCameras(securityFeedTerminalScreenBounds[i], 225f);
					}
					((Behaviour)securityCamera.Camera).enabled = flag;
				}
			}
			for (int j = 0; j < handheldTVCameras.Count; j++)
			{
				HandheldTVCamera handheldTVCamera = handheldTVCameras[j];
				if ((Object)(object)handheldTVCamera == (Object)null)
				{
					continue;
				}
				bool flag2 = ((GrabbableObject)handheldTVCamera).isBeingUsed;
				if (flag2)
				{
					flag2 = false;
					if (((Renderer)((GrabbableObject)handheldTVCamera).mainObjectRenderer).isVisible && IsBoundingBoxVisibleOnOtherCameras(((Renderer)((GrabbableObject)handheldTVCamera).mainObjectRenderer).bounds, 25f))
					{
						flag2 = true;
					}
					if (!flag2 && ((Renderer)handheldTVTerminal).isVisible && j < handheldTVTerminalScreenBounds.Length)
					{
						flag2 = IsBoundingBoxVisibleOnOtherCameras(handheldTVTerminalScreenBounds[j], 225f);
					}
				}
				((Behaviour)handheldTVCamera.Camera).enabled = flag2;
			}
			SetNightVisionVisible(visible: true);
		}

		public void UpdateVisibleLights(ScriptableRenderContext _, Camera camera)
		{
			SetNightVisionVisible(nightVisionCameraSet.Contains(camera));
		}

		private void SetNightVisionVisible(bool visible)
		{
			foreach (Light nightVisionLight in nightVisionLights)
			{
				if (!((Object)(object)nightVisionLight == (Object)null))
				{
					((Behaviour)nightVisionLight).enabled = visible;
				}
			}
		}

		public void OnDisable()
		{
			RenderPipelineManager.beginCameraRendering -= UpdateVisibleLights;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BlackMesa";

		public const string PLUGIN_NAME = "BlackMesa";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BlackMesa.Utilities
{
	internal static class BetterExplosion
	{
		private delegate void Hit(float distance);

		public static void SpawnExplosion(Vector3 explosionPosition, float killRange, float damageRange, int nonLethalDamage)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f));
			obj.AddComponent<DelayedDestruction>();
			obj.SetActive(true);
			float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, explosionPosition);
			HUDManager.Instance.ShakeCamera((ScreenShakeType)(num < 14f));
			Collider[] array = Physics.OverlapSphere(explosionPosition, damageRange + 5f, 2621448, (QueryTriggerInteraction)2);
			RaycastHit val4 = default(RaycastHit);
			foreach (Collider val in array)
			{
				Collider val2 = null;
				Hit hit = null;
				if (((Component)val).gameObject.layer == 3)
				{
					PlayerControllerB hitPlayer = ((Component)val).GetComponent<PlayerControllerB>();
					if (hitPlayer != null)
					{
						if (!((NetworkBehaviour)hitPlayer).IsOwner)
						{
							continue;
						}
						val2 = (Collider)(object)((Component)hitPlayer).GetComponent<CharacterController>();
						hit = delegate(float distance)
						{
							//IL_001e: Unknown result type (might be due to invalid IL or missing references)
							//IL_0029: Unknown result type (might be due to invalid IL or missing references)
							//IL_002e: Unknown result type (might be due to invalid IL or missing references)
							//IL_0033: Unknown result type (might be due to invalid IL or missing references)
							//IL_003d: Unknown result type (might be due to invalid IL or missing references)
							//IL_0052: Unknown result type (might be due to invalid IL or missing references)
							//IL_005d: Unknown result type (might be due to invalid IL or missing references)
							//IL_0067: Unknown result type (might be due to invalid IL or missing references)
							//IL_006c: 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_0079: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
							//IL_00af: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
							//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
							//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
							//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
							//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
							//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
							//IL_0109: Unknown result type (might be due to invalid IL or missing references)
							if (distance < killRange)
							{
								Vector3 val6 = Vector3.Normalize(((Component)hitPlayer.gameplayCamera).transform.position - explosionPosition) * 80f / Vector3.Distance(((Component)hitPlayer.gameplayCamera).transform.position, explosionPosition);
								hitPlayer.KillPlayer(val6, true, (CauseOfDeath)3, 0, default(Vector3));
							}
							else if (distance < damageRange)
							{
								Vector3 val7 = Vector3.Normalize(((Component)hitPlayer.gameplayCamera).transform.position - explosionPosition) * 80f / Vector3.Distance(((Component)hitPlayer.gameplayCamera).transform.position, explosionPosition);
								hitPlayer.DamagePlayer(nonLethalDamage, true, true, (CauseOfDeath)3, 0, false, val7);
							}
						};
						goto IL_01f9;
					}
				}
				if (((Component)val).gameObject.layer == 19)
				{
					EnemyAICollisionDetect hitEnemyCollider = ((Component)val).GetComponent<EnemyAICollisionDetect>();
					if (hitEnemyCollider != null)
					{
						if (!((NetworkBehaviour)hitEnemyCollider.mainScript).IsOwner)
						{
							continue;
						}
						val2 = ((Component)hitEnemyCollider).GetComponent<Collider>();
						hit = delegate(float distance)
						{
							//IL_0027: Unknown result type (might be due to invalid IL or missing references)
							//IL_002d: Unknown result type (might be due to invalid IL or missing references)
							if (distance < damageRange * 0.75f)
							{
								hitEnemyCollider.mainScript.HitEnemyOnLocalClient(6, default(Vector3), (PlayerControllerB)null, false, -1);
								hitEnemyCollider.mainScript.HitFromExplosion(distance);
							}
						};
						goto IL_01f9;
					}
				}
				if (((Component)val).gameObject.layer == 21)
				{
					Landmine landmine = ((Component)val).GetComponent<Landmine>();
					if (landmine != null && ((NetworkBehaviour)landmine).IsOwner)
					{
						val2 = ((Component)landmine).GetComponent<Collider>();
						hit = delegate(float distance)
						{
							if (distance < damageRange)
							{
								((MonoBehaviour)landmine).StartCoroutine(landmine.TriggerOtherMineDelayed(landmine));
							}
						};
					}
				}
				goto IL_01f9;
				IL_01f9:
				if (!((Object)(object)val2 == (Object)null))
				{
					Vector3 val3 = val2.ClosestPoint(explosionPosition);
					if (!Physics.Linecast(explosionPosition, val3, ref val4, 256, (QueryTriggerInteraction)1))
					{
						float distance2 = Vector3.Distance(explosionPosition, val3);
						hit(distance2);
					}
				}
			}
			array = Physics.OverlapSphere(explosionPosition, 10f, -2049);
			Rigidbody val5 = default(Rigidbody);
			for (int i = 0; i < array.Length; i++)
			{
				if (((Component)array[i]).TryGetComponent<Rigidbody>(ref val5))
				{
					val5.AddExplosionForce(70f, explosionPosition, 10f);
				}
			}
		}
	}
	public static class Extensions
	{
		public static string GetPath(this Transform transform)
		{
			StringBuilder stringBuilder = new StringBuilder(((Object)transform).name);
			while ((Object)(object)transform.parent != (Object)null)
			{
				transform = transform.parent;
				stringBuilder.Insert(0, '/');
				stringBuilder.Insert(0, ((Object)transform).name);
			}
			return stringBuilder.ToString();
		}

		public static void SetMaterial(this Renderer renderer, int index, Material material)
		{
			Material[] sharedMaterials = renderer.sharedMaterials;
			sharedMaterials[index] = material;
			renderer.sharedMaterials = sharedMaterials;
		}
	}
}
namespace BlackMesa.Patches
{
	[HarmonyPatch(typeof(DungeonGenerator))]
	internal class PatchDungeonGenerator
	{
		private static int? originalGenerationAttempts;

		[HarmonyPrefix]
		[HarmonyPatch("Generate")]
		private static void GenerateNewFloorPrefix(DungeonGenerator __instance)
		{
			if (!((Object)(object)__instance.DungeonFlow != (Object)(object)BlackMesaInterior.BlackMesaFlow))
			{
				originalGenerationAttempts = __instance.MaxAttemptCount;
				__instance.MaxAttemptCount *= 5;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("Generate")]
		private static void GenerateNewFloorPostfix(DungeonGenerator __instance)
		{
			if (originalGenerationAttempts.HasValue)
			{
				__instance.MaxAttemptCount = originalGenerationAttempts.Value;
				originalGenerationAttempts = null;
			}
		}
	}
	[HarmonyPatch(typeof(LungProp))]
	internal class PatchLungProp
	{
		[HarmonyTranspiler]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static IEnumerable<CodeInstruction> DisconnectFromMachineryTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)typeof(RoundManager).GetMethod("SwitchPower", new Type[1] { typeof(bool) }), (string)null)
			});
			if (val.IsInvalid)
			{
				BlackMesaInterior.Logger.LogError((object)"Failed to patch DisconnectFromMachinery()");
				return instructions;
			}
			val.Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[1]
			{
				new CodeInstruction(OpCodes.Call, (object)typeof(LungPropDisconnectedHandler).GetMethod("TriggerAllEvents", BindingFlags.Static | BindingFlags.NonPublic))
			});
			return val.Instructions();
		}
	}
	internal static class PatchNetworkManager
	{
		private static List<GameObject> networkPrefabs = new List<GameObject>();

		internal static void AddNetworkPrefab(GameObject prefab)
		{
			if ((Object)(object)NetworkManager.Singleton != (Object)null)
			{
				NetworkManager.Singleton.AddNetworkPrefab(prefab);
			}
			else
			{
				networkPrefabs.Add(prefab);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(NetworkConfig), "InitializePrefabs")]
		private static void InitializePrefabsPostfix(NetworkConfig __instance)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			NetworkPrefabs prefabs = __instance.Prefabs;
			foreach (GameObject networkPrefab in networkPrefabs)
			{
				NetworkPrefab val = new NetworkPrefab
				{
					Prefab = networkPrefab
				};
				prefabs.Add(val);
			}
			networkPrefabs = new List<GameObject>();
		}
	}
	internal static class PatchRoundManager
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "SpawnSyncedProps")]
		private static void SpawnSyncedPropsPostfix(RoundManager __instance)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance.dungeonGenerator?.Generator.DungeonFlow != (Object)(object)BlackMesaInterior.BlackMesaFlow)
			{
				return;
			}
			List<GameObject> spawnedSyncedObjects = __instance.spawnedSyncedObjects;
			List<NetworkObjectReference> list = new List<NetworkObjectReference>();
			List<int> list2 = new List<int>();
			foreach (GameObject item2 in spawnedSyncedObjects)
			{
				GrabbableObject component = item2.GetComponent<GrabbableObject>();
				if (component != null && !((Object)(object)item2.GetComponentInChildren<ScanNodeProperties>() == (Object)null) && component.itemProperties.isScrap && component.scrapValue == 0)
				{
					int item = (int)((float)__instance.AnomalyRandom.Next(component.itemProperties.minValue, component.itemProperties.maxValue) * __instance.scrapValueMultiplier);
					list.Add(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject));
					list2.Add(item);
				}
			}
			__instance.SyncScrapValuesClientRpc(list.ToArray(), list2.ToArray());
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public sealed class PatchStartOfRound
	{
		[HarmonyPostfix]
		[HarmonyPatch("ShipLeave")]
		private static void ShipLeavePostFix()
		{
			HandheldTVCamera[] array = Object.FindObjectsByType<HandheldTVCamera>((FindObjectsInactive)0, (FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				array[i].ShipIsLeaving();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ShipHasLeft")]
		private static void ShipHasLeftPostFix()
		{
			HandheldTVCamera[] array = Object.FindObjectsByType<HandheldTVCamera>((FindObjectsInactive)0, (FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				array[i].ExplodeClientRPC();
			}
		}
	}
}
namespace BlackMesa.Components
{
	public class ChargingStation : StationBase
	{
		public float batterySyncInterval = 0.25f;

		public float batteryChargePerSecond = 0.2f;

		private GrabbableObject itemBeingCharged;

		private float lastBatterySync;

		protected override void Start()
		{
			base.Start();
		}

		protected override void UpdateInteractabilityWithCapacity()
		{
			GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer;
			if ((Object)(object)currentlyHeldObjectServer == (Object)null || !currentlyHeldObjectServer.itemProperties.requiresBattery)
			{
				triggerScript.disabledHoverTip = "Use to charge item batteries";
				triggerScript.interactable = false;
			}
			else if (currentlyHeldObjectServer.insertedBattery.charge >= 1f)
			{
				triggerScript.disabledHoverTip = "Battery is full";
				triggerScript.interactable = false;
			}
			else
			{
				triggerScript.interactable = true;
			}
		}

		protected override void OnActivatedByPlayer(PlayerControllerB player, ref float capacityInterpolationDelay)
		{
			if (isActiveOnLocalClient)
			{
				capacityInterpolationDelay = batterySyncInterval;
			}
			itemBeingCharged = player.currentlyHeldObjectServer;
		}

		protected override TickResult DoActiveTick()
		{
			TickResult result = TickResult.Continue;
			if (!itemBeingCharged.itemProperties.requiresBattery)
			{
				return TickResult.Deactivate;
			}
			Battery insertedBattery = itemBeingCharged.insertedBattery;
			float val = batteryChargePerSecond * Time.deltaTime;
			val = Math.Min(val, remainingCapacity);
			float num = insertedBattery.charge + val;
			if (num >= 1f)
			{
				num = 1f;
				result = TickResult.Deactivate;
			}
			_ = insertedBattery.charge;
			SetBatteryChargeOnLocalClient(itemBeingCharged, num);
			if (Time.time - lastBatterySync >= batterySyncInterval)
			{
				SyncBatteryCharge();
			}
			ConsumeCapacity(val);
			return result;
		}

		protected override void OnActiveTickingEnded()
		{
			SyncBatteryCharge();
		}

		private void SyncBatteryCharge()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			lastBatterySync = Time.time;
			SyncBatteryChargeServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)itemBeingCharged), itemBeingCharged.insertedBattery.charge);
		}

		[ServerRpc(RequireOwnership = false)]
		private void SyncBatteryChargeServerRpc(NetworkBehaviourReference item, float charge)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3218380902u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref item, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref charge, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3218380902u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SyncBatteryChargeClientRpc(item, charge);
				}
			}
		}

		[ClientRpc]
		private void SyncBatteryChargeClientRpc(NetworkBehaviourReference item, float charge)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3452870845u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref item, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref charge, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3452870845u, val, (RpcDelivery)0);
				}
				GrabbableObject item2 = default(GrabbableObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !isActiveOnLocalClient && ((NetworkBehaviourReference)(ref item)).TryGet<GrabbableObject>(ref item2, (NetworkManager)null))
				{
					SetBatteryChargeOnLocalClient(item2, charge);
				}
			}
		}

		private void SetBatteryChargeOnLocalClient(GrabbableObject item, float charge)
		{
			item.insertedBattery.charge = charge;
			item.insertedBattery.empty = charge <= 0f;
			item.ChargeBatteries();
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ChargingStation()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3218380902u, new RpcReceiveHandler(__rpc_handler_3218380902));
			NetworkManager.__rpc_func_table.Add(3452870845u, new RpcReceiveHandler(__rpc_handler_3452870845));
		}

		private static void __rpc_handler_3218380902(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_004a: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference item = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref item, default(ForNetworkSerializable));
				float charge = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref charge, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ChargingStation)(object)target).SyncBatteryChargeServerRpc(item, charge);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3452870845(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_004a: 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)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference item = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref item, default(ForNetworkSerializable));
				float charge = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref charge, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ChargingStation)(object)target).SyncBatteryChargeClientRpc(item, charge);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ChargingStation";
		}
	}
	internal class DelayedDestruction : MonoBehaviour
	{
		public float timeUntilDestruction = 5f;

		private void Update()
		{
			timeUntilDestruction -= Time.deltaTime;
			if (timeUntilDestruction <= 0f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class HandheldTVCamera : WalkieTalkie, INightVisionCamera
	{
		public Camera securityCamera;

		public Light nightVisionLight;

		public AudioClip HandheldExplosionWarning;

		public float HandheldExplosionDelay = 5f;

		private bool hasExploded;

		public Camera Camera => securityCamera;

		public Light NightVisionLight => nightVisionLight;

		public override void Start()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			((WalkieTalkie)this).Start();
			securityCamera.targetTexture = new RenderTexture(securityCamera.targetTexture);
			base.onMaterial = new Material(base.onMaterial)
			{
				mainTexture = (Texture)(object)securityCamera.targetTexture
			};
			SecurityCameraManager.Instance.AssignHandheldTVFeed(this, base.onMaterial);
		}

		public void ShipIsLeaving()
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(ExplodeAfterDelay());
			}
		}

		private IEnumerator ExplodeAfterDelay()
		{
			yield return (object)new WaitForSeconds(10f);
			PlayExplosionWarningSound();
			PlayExplosionWarningSoundClientRpc();
			yield return (object)new WaitForSeconds(HandheldExplosionDelay);
			ExplodeClientRPC();
		}

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

		public void PlayExplosionWarningSound()
		{
			base.thisAudio.PlayOneShot(HandheldExplosionWarning);
		}

		[ClientRpc]
		public void ExplodeClientRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4288225865u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4288225865u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !hasExploded)
			{
				hasExploded = true;
				BetterExplosion.SpawnExplosion(((Component)this).transform.position, 0.5f, 2f, 20);
				if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					int num = Array.IndexOf(((GrabbableObject)this).playerHeldBy.ItemSlots, (GrabbableObject)(object)this);
					((GrabbableObject)this).playerHeldBy.DestroyItemInSlot(num);
				}
				else if (((NetworkBehaviour)this).IsServer)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
			}
		}

		public override void LateUpdate()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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)
			//IL_0072: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).LateUpdate();
			if (((GrabbableObject)this).isPocketed && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(0f, 1f, 0f);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(0f, 90f, 90f);
				Transform lowerSpine = ((GrabbableObject)this).playerHeldBy.lowerSpine;
				((Component)this).transform.position = lowerSpine.position + val;
				((Component)this).transform.rotation = lowerSpine.rotation * Quaternion.Euler(val2);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_HandheldTVCamera()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1964363742u, new RpcReceiveHandler(__rpc_handler_1964363742));
			NetworkManager.__rpc_func_table.Add(4288225865u, new RpcReceiveHandler(__rpc_handler_4288225865));
		}

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

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

		protected internal override string __getTypeName()
		{
			return "HandheldTVCamera";
		}
	}
	public class HealingStation : StationBase
	{
		public float healthSyncInterval;

		public float healthPerSecond = 10f;

		private int maximumPlayerHealth;

		private float healthRemainder;

		private float lastHealthSync;

		protected override void Start()
		{
			base.Start();
			maximumPlayerHealth = GameNetworkManager.Instance.localPlayerController.health;
			if (healthSyncInterval == 0f)
			{
				healthSyncInterval = capacitySyncInterval;
			}
		}

		protected override void UpdateInteractabilityWithCapacity()
		{
			if (GameNetworkManager.Instance.localPlayerController.health >= maximumPlayerHealth)
			{
				triggerScript.disabledHoverTip = "Already full health";
				triggerScript.interactable = false;
			}
			else
			{
				triggerScript.interactable = true;
			}
		}

		protected override void OnActivatedByPlayer(PlayerControllerB player, ref float capacityInterpolationDelay)
		{
			if (isActiveOnLocalClient)
			{
				capacityInterpolationDelay = 1f / healthPerSecond;
			}
			healthRemainder = 0f;
		}

		protected override TickResult DoActiveTick()
		{
			TickResult result = TickResult.Continue;
			float val = healthPerSecond * Time.deltaTime + healthRemainder;
			val = Math.Min(val, remainingCapacity);
			int health = playerInteracting.health;
			healthRemainder = val % 1f;
			PlayerControllerB obj = playerInteracting;
			obj.health += (int)val;
			if (playerInteracting.health >= maximumPlayerHealth)
			{
				playerInteracting.health = maximumPlayerHealth;
				result = TickResult.Deactivate;
			}
			int num = playerInteracting.health - health;
			if (num > 0)
			{
				HUDManager.Instance.UpdateHealthUI(playerInteracting.health, false);
				if (playerInteracting.health >= 10)
				{
					playerInteracting.MakeCriticallyInjured(false);
				}
				if (Time.time - lastHealthSync >= healthSyncInterval)
				{
					UpdatePlayerHealth();
				}
			}
			ConsumeCapacity(num);
			return result;
		}

		protected override void OnActiveTickingEnded()
		{
			UpdatePlayerHealth();
		}

		private void UpdatePlayerHealth()
		{
			UpdatePlayerHealthServerRpc((int)playerInteracting.playerClientId, playerInteracting.health, playerInteracting.health >= maximumPlayerHealth);
			lastHealthSync = Time.time;
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdatePlayerHealthServerRpc(int playerID, int health, bool fullyHealed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2166540083u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerID);
					BytePacker.WriteValueBitPacked(val2, health);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref fullyHealed, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2166540083u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					UpdatePlayerHealthClientRpc(playerID, health, fullyHealed);
				}
			}
		}

		[ClientRpc]
		private void UpdatePlayerHealthClientRpc(int playerID, int health, bool fullyHealed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(963848832u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				BytePacker.WriteValueBitPacked(val2, health);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref fullyHealed, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 963848832u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !isActiveOnLocalClient)
			{
				StartOfRound.Instance.allPlayerScripts[playerID].DamageOnOtherClients(0, health);
				if (fullyHealed)
				{
					StopActiveAudioOnClient();
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_HealingStation()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2166540083u, new RpcReceiveHandler(__rpc_handler_2166540083));
			NetworkManager.__rpc_func_table.Add(963848832u, new RpcReceiveHandler(__rpc_handler_963848832));
		}

		private static void __rpc_handler_2166540083(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_0049: 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)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
				int health = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref health);
				bool fullyHealed = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref fullyHealed, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((HealingStation)(object)target).UpdatePlayerHealthServerRpc(playerID, health, fullyHealed);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_963848832(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_0049: 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)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
				int health = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref health);
				bool fullyHealed = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref fullyHealed, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((HealingStation)(object)target).UpdatePlayerHealthClientRpc(playerID, health, fullyHealed);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "HealingStation";
		}
	}
	public class LungPropDisconnectedHandler : MonoBehaviour
	{
		public UnityEvent Event = new UnityEvent();

		internal void TriggerEvent()
		{
			Event.Invoke();
		}

		internal static void TriggerAllEvents()
		{
			LungPropDisconnectedHandler[] array = Object.FindObjectsByType<LungPropDisconnectedHandler>((FindObjectsSortMode)0);
			for (int i = 0; i < array.Length; i++)
			{
				array[i].TriggerEvent();
			}
		}
	}
	internal class PlayParticleAnimationEvent : MonoBehaviour
	{
		public ParticleSystem particleSystemA;

		public void PlayParticleSystemA()
		{
			particleSystemA.Play();
		}

		public void StopParticleSystemA()
		{
			particleSystemA.Stop();
		}
	}
	public class ReassignInteractTriggerForDoorLock : MonoBehaviour
	{
		pu