Decompiled source of Black Mesa Half Life Moon Interior v3.0.2

BlackMesa.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.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.Interfaces;
using BlackMesa.NetcodePatcher;
using BlackMesa.Patches;
using BlackMesa.Scriptables;
using BlackMesa.Utilities;
using DunGen;
using DunGen.Graph;
using DunGenPlus;
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.Rendering.HighDefinition;
using UnityEngine.VFX;
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("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("BlackMesa")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A Black Mesa mod for Lethal Company ")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e3f218daa690134614d6ceb0981d31b6e7497630")]
[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;
		}
	}
}
public class BarnacleGrabTrigger : MonoBehaviour
{
	public Barnacle barnacle;

	private void OnTriggerStay(Collider other)
	{
		PlayerControllerB player = default(PlayerControllerB);
		if (((Component)other).TryGetComponent<PlayerControllerB>(ref player))
		{
			barnacle.TryGrabPlayerOrHeldItem(player);
		}
		GrabbableObject item = default(GrabbableObject);
		if (((Component)other).TryGetComponent<GrabbableObject>(ref item))
		{
			barnacle.GrabItem(item);
		}
		EnemyAICollisionDetect val = default(EnemyAICollisionDetect);
		if (((Component)other).TryGetComponent<EnemyAICollisionDetect>(ref val))
		{
			barnacle.GrabEnemy(val.mainScript);
		}
	}
}
public class RigidbodyGravity : MonoBehaviour
{
	public Vector3 gravity = Vector3.down * 15.9f;

	private Rigidbody rigidBody;

	private void Start()
	{
		rigidBody = ((Component)this).GetComponent<Rigidbody>();
		rigidBody.useGravity = false;
	}

	private void FixedUpdate()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		rigidBody.AddForce(gravity, (ForceMode)5);
	}
}
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;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		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;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		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();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		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")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	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;

		internal static GameObject GenerationRulesPrefab;

		internal static List<GameObject> PrefabsWithAudioSources = new List<GameObject>();

		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.");
			}
			FixPluginTypesSerializationCheck fixPluginTypesSerializationCheck = BlackMesaInterior.LoadAsset<FixPluginTypesSerializationCheck>("Assets/LethalCompany/Mods/BlackMesaInterior/FixPluginTypesSerializationCheck.asset");
			if ((Object)(object)fixPluginTypesSerializationCheck == (Object)null)
			{
				Logger.LogError((object)"FixPluginTypesSerialization checker was not loaded.");
				return;
			}
			if (!fixPluginTypesSerializationCheck.buh)
			{
				Logger.LogError((object)"FixPluginTypesSerialization is not working, please copy its config from someone that has no errors during FixPluginTypesSerialization startup before the chainloader.");
				return;
			}
			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;
			}
			DunGenExtender val2 = BlackMesaInterior.LoadAsset<DunGenExtender>("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/DunGenPlus/DunGenExtender.asset");
			if ((Object)(object)val2 == (Object)null)
			{
				Logger.LogError((object)"Failed to find DunGenPlus configuration. Stopping.");
				return;
			}
			API.AddDunGenExtender(val2);
			GenerationRulesPrefab = BlackMesaInterior.LoadAsset<GameObject>("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/GenerationRules.prefab");
			if ((Object)(object)GenerationRulesPrefab == (Object)null)
			{
				Logger.LogError((object)"Failed to find generation rules prefab. Stopping.");
				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));
			harmony.PatchAll(typeof(PatchPlayerControllerB));
			harmony.PatchAll(typeof(PatchMenuManager));
			harmony.PatchAll(typeof(PatchAnimator));
			harmony.PatchAll(typeof(PatchEnemyAI));
			BlackMesaInterior.LoadAsset<DiffusionProfileMappings>("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Diffusion Profile Mappings.asset").Apply();
			InitializeNetworkBehaviour(typeof(Barnacle));
			InitializeNetworkBehaviour(typeof(BarnacleSounds));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Hazards/Barnacle/Barnacle.prefab");
			InitializeNetworkBehaviour(typeof(Tripmine));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Hazards/Laser Tripmine/Tripmine.prefab");
			InitializeNetworkBehaviour(typeof(HandheldTVCamera));
			RegisterNetworkPrefab("Assets/LethalCompany/Mods/BlackMesaInterior/DunGen Stuff/Prefabs/Props/HandheldTV.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.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);
			PrefabsWithAudioSources.Add(val);
		}

		private static List<AudioMixerGroup> GetVanillaAudioMixerGroups()
		{
			HashSet<string> hashSet = new HashSet<string>();
			List<AudioMixerGroup> list = new List<AudioMixerGroup>();
			AudioMixer[] array = Resources.FindObjectsOfTypeAll<AudioMixer>();
			foreach (AudioMixer val in array)
			{
				if (!hashSet.Contains(((Object)val).name))
				{
					hashSet.Add(((Object)val).name);
					AudioMixerGroup[] array2 = val.FindMatchingGroups("");
					foreach (AudioMixerGroup item in array2)
					{
						list.Add(item);
					}
				}
			}
			return list;
		}

		internal static void FixAudioSources()
		{
			List<AudioMixerGroup> vanillaAudioMixerGroups = GetVanillaAudioMixerGroups();
			foreach (GameObject prefabsWithAudioSource in PrefabsWithAudioSources)
			{
				AudioSource[] componentsInChildren = prefabsWithAudioSource.GetComponentsInChildren<AudioSource>();
				foreach (AudioSource val in componentsInChildren)
				{
					if ((Object)(object)val.outputAudioMixerGroup == (Object)null)
					{
						Logger.LogWarning((object)$"{val} on the prefab {prefabsWithAudioSource} has a null output.");
						continue;
					}
					AudioMixerGroup val2 = null;
					foreach (AudioMixerGroup item in vanillaAudioMixerGroups)
					{
						if (((Object)item).name == ((Object)val.outputAudioMixerGroup).name)
						{
							val2 = item;
							break;
						}
					}
					if (!((Object)(object)val2 == (Object)null))
					{
						if ((Object)(object)val2 == (Object)(object)val.outputAudioMixerGroup)
						{
							Logger.LogWarning((object)$"Replacement audio mixer group is the same as the original for {val}.");
						}
						else
						{
							val.outputAudioMixerGroup = val2;
						}
					}
				}
			}
		}

		internal static void BatchAllTileModels(Dungeon dungeon)
		{
			int num = 0;
			foreach (Tile allTile in dungeon.AllTiles)
			{
				if (!((Object)(object)allTile == (Object)null))
				{
					Transform val = ((Component)allTile).transform.Find("Models");
					if (!((Object)(object)val == (Object)null))
					{
						StaticBatchingUtility.Combine(((Component)val).gameObject);
						num++;
					}
				}
			}
			Logger.LogInfo((object)$"Marked {num} tiles to be static-batched.");
		}
	}
	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();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SecurityCamera";
		}
	}
	internal class SecurityCameraManager : MonoBehaviour
	{
		internal static SecurityCameraManager Instance;

		internal List<SecurityCamera> securityCameras = new List<SecurityCamera>();

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

		public MeshRenderer handheldTVTerminal;

		public List<int> handheldTVMaterialIndices;

		public List<BoxCollider> handheldTVTerminalScreenColliders;

		public MeshRenderer securityFeedTerminal;

		public Material securityFeedMaterial;

		public List<int> securityCameraMaterialIndices;

		public List<BoxCollider> securityFeedTerminalScreenColliders;

		public int camerasToRenderPerFrame = 2;

		private int currentHandheldTVIndex;

		private int currentSecurityCameraIndex;

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

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

		private bool allOtherCameraFrustumsUpdated;

		private List<Camera> allControlledCameras = new List<Camera>();

		private List<Bounds> allControlledCameraScreenBounds = new List<Bounds>();

		private List<Renderer[]> allControlledCameraScreenRenderers = new List<Renderer[]>();

		private int nextCameraToRender;

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

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

		private const float ActiveTerminalDistance = 15f;

		private const float ActiveTerminalDistanceSqr = 225f;

		private const float ActiveHandheldDistance = 5f;

		private const float ActiveHandheldDistanceSqr = 25f;

		private void AddCamera(INightVisionCamera nightVisionCamera, Bounds screenBounds, params Renderer[] screenRenderers)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			nightVisionCameraSet.Add(nightVisionCamera.Camera);
			nightVisionLights.Add(nightVisionCamera.NightVisionLight);
			allControlledCameras.Add(nightVisionCamera.Camera);
			allControlledCameraScreenBounds.Add(screenBounds);
			allControlledCameraScreenRenderers.Add(screenRenderers);
			((Component)nightVisionCamera.Camera).GetComponent<HDAdditionalCameraData>().hasPersistentHistory = true;
		}

		public void AssignSecurityCameraFeed(SecurityCamera securityCamera)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			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);
				AddCamera(securityCamera, ((Collider)securityFeedTerminalScreenColliders[currentSecurityCameraIndex]).bounds);
				currentSecurityCameraIndex++;
			}
		}

		public void AssignHandheldTVFeed(HandheldTVCamera handheldTVCamera, Material material)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			if (currentHandheldTVIndex < handheldTVMaterialIndices.Count)
			{
				Material[] sharedMaterials = ((Renderer)handheldTVTerminal).sharedMaterials;
				int num = handheldTVMaterialIndices[currentHandheldTVIndex];
				sharedMaterials[num] = material;
				((Renderer)handheldTVTerminal).sharedMaterials = sharedMaterials;
				Debug.Log((object)"Added handheld TV to nightvision camera list");
				handheldTVCameras.Add(handheldTVCamera);
				AddCamera(handheldTVCamera, ((Collider)handheldTVTerminalScreenColliders[currentHandheldTVIndex]).bounds, (Renderer)((GrabbableObject)handheldTVCamera).mainObjectRenderer);
				currentHandheldTVIndex++;
			}
		}

		public void Awake()
		{
			Instance = this;
		}

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

		private void GetCameraFrustums()
		{
			if (allOtherCameraFrustumsUpdated)
			{
				return;
			}
			allOtherCameraFrustumsUpdated = true;
			if (allOtherCameras.Length != Camera.allCamerasCount)
			{
				allOtherCameras = (Camera[])(object)new Camera[Camera.allCamerasCount];
				allOtherCamerasFrustums = new Plane[allOtherCameras.Length][];
				for (int i = 0; i < allOtherCamerasFrustums.Length; i++)
				{
					allOtherCamerasFrustums[i] = (Plane[])(object)new Plane[6];
				}
			}
			Camera.GetAllCameras(allOtherCameras);
			for (int j = 0; j < allOtherCameras.Length; j++)
			{
				GeometryUtility.CalculateFrustumPlanes(allOtherCameras[j], allOtherCamerasFrustums[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 < allOtherCameras.Length; i++)
			{
				Camera val = allOtherCameras[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(allOtherCamerasFrustums[i], bounds))
					{
						return true;
					}
				}
			}
			return false;
		}

		private void LateUpdate()
		{
			if (allControlledCameras.Count == 0)
			{
				return;
			}
			allOtherCameraFrustumsUpdated = false;
			foreach (Camera allControlledCamera in allControlledCameras)
			{
				if (!((Object)(object)allControlledCamera == (Object)null))
				{
					((Behaviour)allControlledCamera).enabled = false;
				}
			}
			for (int i = 0; i < camerasToRenderPerFrame; i++)
			{
				if (ShouldRenderCamera(nextCameraToRender))
				{
					((Behaviour)allControlledCameras[nextCameraToRender]).enabled = true;
				}
				nextCameraToRender = (nextCameraToRender + 1) % allControlledCameras.Count;
			}
			PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController;
			if ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)val.spectatedPlayerScript != (Object)null)
				{
					val = val.spectatedPlayerScript;
				}
				GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer;
				foreach (HandheldTVCamera handheldTVCamera in handheldTVCameras)
				{
					if (!((Object)(object)handheldTVCamera == (Object)null) && !((Object)(object)handheldTVCamera.Camera == (Object)null) && !((Object)(object)handheldTVCamera != (Object)(object)currentlyHeldObjectServer))
					{
						((Behaviour)handheldTVCamera.Camera).enabled = true;
						break;
					}
				}
			}
			SetNightVisionVisible(visible: true);
		}

		private bool ShouldRenderCamera(int cameraIndex)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			if (cameraIndex < 0 || cameraIndex >= allControlledCameras.Count)
			{
				return false;
			}
			Camera val = allControlledCameras[cameraIndex];
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			if (!((Component)val).gameObject.activeInHierarchy)
			{
				return false;
			}
			Bounds bounds = allControlledCameraScreenBounds[cameraIndex];
			GetCameraFrustums();
			if (IsBoundingBoxVisibleOnOtherCameras(bounds, 225f))
			{
				return true;
			}
			Renderer[] array = allControlledCameraScreenRenderers[cameraIndex];
			foreach (Renderer val2 in array)
			{
				if (val2.isVisible && IsBoundingBoxVisibleOnOtherCameras(val2.bounds, 25f))
				{
					return true;
				}
			}
			return false;
		}

		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;
		}

		public static int IntHash(this Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return (int)position.x ^ (int)position.y ^ (int)position.z;
		}
	}
}
namespace BlackMesa.Scriptables
{
	[CreateAssetMenu(menuName = "Black Mesa/Diffusion Profile Mappings")]
	public class DiffusionProfileMappings : ScriptableObject
	{
		public DiffusionProfileMapping[] mappings;

		internal void Apply()
		{
			if (mappings == null)
			{
				BlackMesaInterior.Logger.LogError((object)$"Diffusion profile mappings were missing\n{new StackTrace()}");
				return;
			}
			DiffusionProfileSettings[] value = ((VolumeParameter<DiffusionProfileSettings[]>)(object)HDRenderPipelineGlobalSettings.instance.GetOrCreateDiffusionProfileList().diffusionProfiles).value;
			foreach (DiffusionProfileSettings val in value)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				float num = BitConverter.Int32BitsToSingle((int)val.profile.hash);
				for (int j = 0; j < mappings.Length; j++)
				{
					DiffusionProfileMapping diffusionProfileMapping = mappings[j];
					if (diffusionProfileMapping.diffusionProfileName == ((Object)val).name)
					{
						diffusionProfileMapping.material.SetFloat("_DiffusionProfileHash", num);
					}
				}
			}
		}
	}
	[Serializable]
	public class DiffusionProfileMapping
	{
		public Material material;

		public string diffusionProfileName;
	}
	[CreateAssetMenu(menuName = "Black Mesa/FixPluginTypesSerialization Check")]
	public class FixPluginTypesSerializationCheck : ScriptableObject
	{
		public bool buh;
	}
}
namespace BlackMesa.Patches
{
	[HarmonyPatch(typeof(Animator))]
	internal static class PatchAnimator
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetTriggerString")]
		private static void SetTriggerStringPostfix(Animator __instance)
		{
			AnimatorCuller.OnAnimationTriggered(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetTriggerID")]
		private static void SetTriggerIDPostfix(Animator __instance)
		{
			AnimatorCuller.OnAnimationTriggered(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetBoolString")]
		private static void SetBoolStringPostfix(Animator __instance)
		{
			AnimatorCuller.OnAnimationTriggered(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetBoolID")]
		private static void SetBoolIDPostfix(Animator __instance)
		{
			AnimatorCuller.OnAnimationTriggered(__instance);
		}
	}
	[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(EnemyAI))]
	internal static class PatchEnemyAI
	{
		internal static HashSet<EnemyAI> AllEnemies = new HashSet<EnemyAI>();

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void StartPostfix(EnemyAI __instance)
		{
			AllEnemies.Add(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDestroy")]
		private static void OnDestroyPostfix(EnemyAI __instance)
		{
			AllEnemies.Remove(__instance);
		}
	}
	[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();
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal static class PatchMenuManager
	{
		[HarmonyPrefix]
		[HarmonyPatch("Start")]
		private static void StartPostfix()
		{
			BlackMesaInterior.FixAudioSources();
			LightSwitcher.CacheVanillaLightSounds();
		}
	}
	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>();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PatchPlayerControllerB
	{
		private static HashSet<PlayerControllerB> lockedPlayers = new HashSet<PlayerControllerB>();

		internal static void SetPlayerPositionLocked(PlayerControllerB player, bool locked)
		{
			if (locked)
			{
				lockedPlayers.Add(player);
			}
			else
			{
				lockedPlayers.Remove(player);
			}
			player.disableMoveInput = locked;
		}

		[HarmonyPrefix]
		[HarmonyPatch("LateUpdate")]
		private static void LateUpdatePrefix(PlayerControllerB __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (lockedPlayers.Contains(__instance))
			{
				((Component)__instance).transform.localPosition = Vector3.zero;
				__instance.fallValue = 0f;
				__instance.fallValueUncapped = 0f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnDeadBody")]
		private static void SpawnDeadBodyPostfix(PlayerControllerB __instance)
		{
			Barnacle.OnRagdollSpawnedForPlayer(__instance);
		}
	}
	internal static class PatchRoundManager
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "SetLevelObjectVariables")]
		private static void SetLevelObjectVariablesPostfix(RoundManager __instance)
		{
			if ((Object)(object)__instance.dungeonGenerator.Generator.DungeonFlow == (Object)(object)BlackMesaInterior.BlackMesaFlow)
			{
				BlackMesaInterior.BatchAllTileModels(__instance.dungeonGenerator.Generator.CurrentDungeon);
				if ((Object)(object)LightController.instance != (Object)null)
				{
					LightController.instance.PopulateLightGroups();
				}
			}
		}

		[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("Awake")]
		private static void AwakePostfix()
		{
			Object.Instantiate<GameObject>(BlackMesaInterior.GenerationRulesPrefab);
		}

		[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.Interfaces
{
	public interface IDumbEnemy : IHittable
	{
		void Stun(float time);

		void Kill(bool destroy);
	}
}
namespace BlackMesa.Generation
{
	public class ConnectionRules : MonoBehaviour
	{
		public DoorwayTagRule[] doorwayTagRules;

		private TileConnectionRule rule;

		private Dictionary<DoorwayTagPair, ConnectionResult> doorwayTagRuleLookup = new Dictionary<DoorwayTagPair, ConnectionResult>();

		private void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			rule = new TileConnectionRule(new CanTilesConnectDelegate(CanTilesConnect), 0);
			doorwayTagRuleLookup.Clear();
			DoorwayTagRule[] array = doorwayTagRules;
			for (int i = 0; i < array.Length; i++)
			{
				DoorwayTagRule doorwayTagRule = array[i];
				doorwayTagRuleLookup.Add(doorwayTagRule.Pair, doorwayTagRule.result);
			}
			DoorwayPairFinder.CustomConnectionRules.Add(rule);
		}

		private void OnDisable()
		{
			DoorwayPairFinder.CustomConnectionRules.Remove(rule);
			rule = null;
		}

		private ConnectionResult CanTilesConnect(Tile tileA, Tile tileB, Doorway doorwayA, Doorway doorwayB)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (doorwayTagRuleLookup.TryGetValue(new DoorwayTagPair(doorwayA, doorwayB), out var value))
			{
				return value;
			}
			return (ConnectionResult)2;
		}
	}
	public class DoorwayInfo : MonoBehaviour
	{
		public DoorwayTag doorwayTag;
	}
	[CreateAssetMenu(menuName = "Black Mesa/Generation/Doorway Tag")]
	public class DoorwayTag : ScriptableObject
	{
	}
	public struct DoorwayTagPair : IEquatable<DoorwayTagPair>
	{
		public DoorwayTag tagA;

		public DoorwayTag tagB;

		public DoorwayTagPair(DoorwayTag tagA, DoorwayTag tagB)
		{
			this.tagA = tagA;
			this.tagB = tagB;
		}

		public DoorwayTagPair(Doorway doorwayA, Doorway doorwayB)
		{
			DoorwayInfo doorwayInfo = default(DoorwayInfo);
			this = new DoorwayTagPair(((Component)doorwayA).TryGetComponent<DoorwayInfo>(ref doorwayInfo) ? doorwayInfo.doorwayTag : null, ((Component)doorwayB).TryGetComponent<DoorwayInfo>(ref doorwayInfo) ? doorwayInfo.doorwayTag : null);
		}

		public readonly bool Equals(DoorwayTagPair other)
		{
			if ((Object)(object)tagA == (Object)(object)other.tagA)
			{
				return (Object)(object)tagB == (Object)(object)other.tagB;
			}
			return false;
		}

		public override readonly bool Equals(object other)
		{
			if (other is DoorwayTagPair other2)
			{
				return Equals(other2);
			}
			return false;
		}

		public override readonly int GetHashCode()
		{
			return HashCode.Combine(((Object)(object)tagA != (Object)null) ? ((object)tagA).GetHashCode() : 0, ((Object)(object)tagB != (Object)null) ? ((object)tagB).GetHashCode() : 0);
		}
	}
	[Serializable]
	public struct DoorwayTagRule : IEquatable<DoorwayTagPair>
	{
		public DoorwayTag tagA;

		public DoorwayTag tagB;

		public ConnectionResult result;

		public readonly DoorwayTagPair Pair => new DoorwayTagPair(tagA, tagB);

		public readonly bool Equals(DoorwayTagPair other)
		{
			if ((Object)(object)tagA == (Object)(object)other.tagA)
			{
				return (Object)(object)tagB == (Object)(object)other.tagB;
			}
			return false;
		}

		public override readonly bool Equals(object other)
		{
			if (other is DoorwayTagPair other2)
			{
				return Equals(other2);
			}
			return false;
		}

		public override readonly int GetHashCode()
		{
			return HashCode.Combine(((object)tagA).GetHashCode(), ((object)tagB).GetHashCode());
		}
	}
}
namespace BlackMesa.Components
{
	public class AnimatorCuller : MonoBehaviour
	{
		private static readonly Dictionary<Animator, AnimatorCuller> cullers = new Dictionary<Animator, AnimatorCuller>();

		private Animator animator;

		private void OnEnable()
		{
			animator = ((Component)this).GetComponent<Animator>();
			animator.keepAnimatorStateOnDisable = true;
			cullers.Add(animator, this);
		}

		public void CompleteAnimationAndDisableAnimator()
		{
			((MonoBehaviour)this).StartCoroutine(DisableAtEndOfFrame(animator));
		}

		private static IEnumerator DisableAtEndOfFrame(Animator animator)
		{
			yield return (object)new WaitForEndOfFrame();
			AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
			if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash == 0 || !(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime < 1f))
			{
				AnimatorStateInfo nextAnimatorStateInfo = animator.GetNextAnimatorStateInfo(0);
				if (((AnimatorStateInfo)(ref nextAnimatorStateInfo)).fullPathHash == 0 || !(((AnimatorStateInfo)(ref nextAnimatorStateInfo)).normalizedTime < 1f))
				{
					((Behaviour)animator).enabled = false;
				}
			}
		}

		internal static void OnAnimationTriggered(Animator animator)
		{
			if (cullers.TryGetValue(animator, out var value) && !((Object)(object)value == (Object)null))
			{
				value.EnableAnimator();
			}
		}

		public void EnableAnimator()
		{
			((Behaviour)animator).enabled = true;
		}

		private void OnDisable()
		{
			cullers.Remove(animator);
		}
	}
	public class Barnacle : NetworkBehaviour, IDumbEnemy, IHittable
	{
		private enum State
		{
			Extending,
			Idle,
			Pulling,
			Eating,
			Flinching,
			Dead
		}

		private static readonly Random animationRandomizer = new Random();

		private static readonly HashSet<Barnacle> barnacles = new HashSet<Barnacle>();

		public Animator animator;

		public BarnacleSounds sounds;

		[Header("Tongue")]
		public Rigidbody[] tongueSegments;

		[Header("Tongue Raycast")]
		public Transform raycastOrigin;

		public LayerMask tongueCastMask;

		public float maxLength;

		public float tongueGroundDistance;

		[Header("Tongue Speed")]
		public float defaultTongueRetractSpeed;

		public float defaultTongueDropSpeed;

		[Header("Grabbing")]
		public Transform dummyObject;

		public Transform holder;

		public float holderPositionScale;

		[Header("Pulling")]
		public float eatDistance;

		[Header("Eating/Dropping")]
		public Transform itemStash;

		public Transform mouthAttachment;

		public VisualEffect pukeEffect;

		public AnimationCurve idleSoundTimeCurve;

		private const float gravity = 15.9f;

		private float tongueRetractSpeed;

		private float tongueDropSpeed;

		private Transform tongueParentTransform;

		private Vector3 retractedTongueLocalPosition;

		private State state = State.Idle;

		private float flinchTimeLeft;

		private CapsuleCollider[] tongueSegmentColliders;

		private float[] tongueSegmentMouthOffsets;

		private float targetTongueOffset;

		private float currentTongueOffset;

		private float eatingTongueOffset;

		private int firstEnabledSegment;

		private Transform dummyObjectParent;

		private Rigidbody dummyObjectBody;

		private Joint dummyObjectJoint;

		private Joint holderJoint;

		private float defaultAngularDrag;

		private GrabbableObject grabbedItem;

		private PlayerControllerB grabbedPlayer;

		private Transform grabbedPlayerPreviousParent;

		private DeadBodyInfo grabbedBody;

		private EnemyAI grabbedEnemy;

		private bool centeringHolderPosition;

		private Vector3 centeredHolderLocalPosition;

		private bool centeringDummyObjectRotation;

		private float idleSoundTime = -1f;

		private float pukeTravelTime = 2f;

		private readonly List<GrabbableObject> eatenItems = new List<GrabbableObject>();

		internal bool HasGrabbedObject
		{
			get
			{
				if (grabbedItem == null && grabbedPlayer == null && grabbedBody == null)
				{
					return grabbedEnemy != null;
				}
				return true;
			}
		}

		internal bool CanGrab
		{
			get
			{
				if (!HasGrabbedObject)
				{
					if (state != 0)
					{
						return state == State.Idle;
					}
					return true;
				}
				return false;
			}
		}

		internal bool IsDead => state == State.Dead;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody val = tongueSegments[0];
			tongueParentTransform = ((Component)val).transform.parent;
			retractedTongueLocalPosition = ((Component)val).transform.localPosition;
			tongueRetractSpeed = defaultTongueRetractSpeed;
			tongueDropSpeed = defaultTongueDropSpeed;
			tongueSegmentColliders = (CapsuleCollider[])(object)new CapsuleCollider[tongueSegments.Length];
			tongueSegmentMouthOffsets = new float[tongueSegments.Length];
			float num = 0f;
			int num2 = tongueSegments.Length;
			while (num2-- > 0)
			{
				tongueSegmentColliders[num2] = ((Component)tongueSegments[num2]).GetComponent<CapsuleCollider>();
				float num3 = num;
				Vector3 val2 = ((Component)tongueSegments[num2]).transform.TransformVector(new Vector3(0f, 0f, tongueSegmentColliders[num2].height));
				num = num3 + ((Vector3)(ref val2)).magnitude;
				tongueSegmentMouthOffsets[num2] = num;
			}
			dummyObjectParent = dummyObject.parent;
			dummyObjectBody = ((Component)dummyObject).GetComponent<Rigidbody>();
			dummyObjectJoint = ((Component)dummyObjectBody).GetComponent<Joint>();
			holderJoint = ((Component)holder).GetComponent<Joint>();
			defaultAngularDrag = dummyObjectBody.angularDrag;
			((Component)tongueParentTransform).gameObject.SetActive(false);
		}

		private void Start()
		{
			//IL_0062: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			animator.CrossFadeInFixedTime("Extending", 0.25f);
			DropTongue();
			barnacles.Add(this);
			((Component)tongueParentTransform).gameObject.SetActive(true);
			for (int i = 1; i < tongueSegments.Length; i++)
			{
				tongueSegments[i].isKinematic = false;
				RigidbodyGravity component = ((Component)tongueSegments[i]).GetComponent<RigidbodyGravity>();
				if ((Object)(object)component != (Object)null)
				{
					component.gravity = Vector3.down * 15.9f;
				}
			}
			pukeEffect.SetFloat("Gravity", 15.9f);
		}

		public void Stun(float duration)
		{
			StunServerRpc(duration);
		}

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			if (IsDead)
			{
				return false;
			}
			if (force <= 0)
			{
				return false;
			}
			StartDyingServerRpc();
			return true;
		}

		public void Kill(bool destroy)
		{
			if (destroy && ((NetworkBehaviour)this).IsOwner)
			{
				((NetworkBehaviour)this).NetworkObject.Despawn(true);
			}
			StartDyingServerRpc();
		}

		private void SetIdleSoundTimer()
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				idleSoundTime = idleSoundTimeCurve.Evaluate((float)animationRandomizer.NextDouble());
			}
		}

		private void DisableHolderPhysics()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			dummyObjectBody.isKinematic = true;
			dummyObjectBody.centerOfMass = Vector3.zero;
			dummyObjectBody.angularDrag = defaultAngularDrag;
			dummyObjectBody.interpolation = (RigidbodyInterpolation)0;
		}

		private void EnableHolderPhysics()
		{
			dummyObjectBody.isKinematic = false;
			dummyObjectBody.interpolation = (RigidbodyInterpolation)1;
		}

		private void SetState(State newState)
		{
			if (newState != state)
			{
				state = newState;
			}
		}

		private void DropTongue()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			dummyObject.SetParent(dummyObjectParent, false);
			dummyObject.position = ((Component)this).transform.position;
			dummyObjectJoint.connectedBody = null;
			DisableHolderPhysics();
			float distance = maxLength;
			RaycastHit val = default(RaycastHit);
			if (Physics.SphereCast(raycastOrigin.position, 0.1f, Vector3.down, ref val, maxLength, LayerMask.op_Implicit(tongueCastMask), (QueryTriggerInteraction)1))
			{
				distance = ((RaycastHit)(ref val)).distance;
			}
			targetTongueOffset = distance - tongueGroundDistance;
			((Component)sounds.groundAudioSource).transform.position = ((RaycastHit)(ref val)).point;
			pukeTravelTime = Mathf.Sqrt(2f * Vector3.Distance(((Component)pukeEffect).transform.position, ((RaycastHit)(ref val)).point) / 15.9f);
			SetState(State.Extending);
			animator.CrossFadeInFixedTime("Extending", 0.5f);
		}

		private bool CanGrabPlayer(PlayerControllerB player)
		{
			if (!((NetworkBehaviour)player).IsOwner)
			{
				return false;
			}
			if (player.isPlayerDead)
			{
				return false;
			}
			return true;
		}

		private bool CanGrabItem(GrabbableObject item)
		{
			if (item.itemProperties.twoHandedAnimation && !(item is RagdollGrabbableObject))
			{
				return false;
			}
			return true;
		}

		private bool CanGrabEnemy(EnemyAI enemy)
		{
			if (!((NetworkBehaviour)enemy).IsOwner)
			{
				return false;
			}
			if (!(enemy is MaskedPlayerEnemy) && !(enemy is FlowerSnakeEnemy) && !(enemy is CentipedeAI))
			{
				return false;
			}
			return true;
		}

		public void TryGrabPlayerOrHeldItem(PlayerControllerB player)
		{
			//IL_0101: Unknown result type (might