Decompiled source of DeathHeadHopper v1.2.1

DeathHeadHopper.dll

Decompiled a day ago
using System;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Cronchy")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1+aa211415060cc9d9a7929f511e78f9fedea80015")]
[assembly: AssemblyProduct("DeathHeadHopper")]
[assembly: AssemblyTitle("DeathHeadHopper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DeathHeadHopper
{
	public class DeathHeadController : MonoBehaviourPun
	{
		internal PlayerDeathHead deathHead;

		internal Rigidbody rb;

		internal HeadCollisionHandler collisionHandler;

		internal PhysGrabObjectImpactDetector impactDetector;

		internal HeadHopHandler hopHandler;

		internal HeadJumpHandler jumpHandler;

		internal HeadAudioHandler audioHandler;

		internal HeadReboundHandler reboundHandler;

		internal HeadAnchorHandler anchorHandler;

		internal HeadEyeHandler eyeHandler;

		public UnityEvent m_HeadJumpEvent = new UnityEvent();

		public UnityEvent m_HeadHopEvent = new UnityEvent();

		public float maxCooldownMultiplier = 4f;

		public float startReboundTruckDistance = 3f;

		public float truckRoomRadius = 8f;

		internal float distanceToTruckRoom;

		internal bool spectated;

		internal float recentlyGrabbedTimer;

		protected void Start()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			deathHead = ((Component)this).GetComponent<PlayerDeathHead>();
			rb = ((Component)this).GetComponent<Rigidbody>();
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			impactDetector.playerHurtDisable = false;
			if (m_HeadJumpEvent == null)
			{
				m_HeadJumpEvent = new UnityEvent();
			}
			if (m_HeadHopEvent == null)
			{
				m_HeadHopEvent = new UnityEvent();
			}
			collisionHandler = ((Component)this).gameObject.AddComponent<HeadCollisionHandler>();
			hopHandler = ((Component)this).gameObject.AddComponent<HeadHopHandler>();
			jumpHandler = ((Component)this).gameObject.AddComponent<HeadJumpHandler>();
			audioHandler = ((Component)this).gameObject.AddComponent<HeadAudioHandler>();
			reboundHandler = ((Component)this).gameObject.AddComponent<HeadReboundHandler>();
			anchorHandler = ((Component)this).gameObject.AddComponent<HeadAnchorHandler>();
			eyeHandler = ((Component)this).gameObject.AddComponent<HeadEyeHandler>();
		}

		protected void Update()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			distanceToTruckRoom = Mathf.Max(0f, Vector3.Distance(((Component)LevelGenerator.Instance.LevelPathTruck).transform.position, ((Component)this).transform.position) - truckRoomRadius);
			FixDeathHeadTpWhenOutsideRoom();
			if (anchorHandler.isAnchored)
			{
				deathHead.inTruckReviveTimer = 0.4f;
			}
		}

		protected void FixDeathHeadTpWhenOutsideRoom()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_001b: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer() || (int)GameDirector.instance.currentState != 2)
			{
				return;
			}
			if (((Component)this).transform.position.y < -50f)
			{
				if (RoundDirector.instance.extractionPointActive)
				{
					deathHead.physGrabObject.Teleport(RoundDirector.instance.extractionPointCurrent.safetySpawn.position, RoundDirector.instance.extractionPointCurrent.safetySpawn.rotation);
				}
				else
				{
					deathHead.physGrabObject.Teleport(((Component)TruckSafetySpawnPoint.instance).transform.position, ((Component)TruckSafetySpawnPoint.instance).transform.rotation);
				}
				rb.velocity = Vector3.zero;
				if (anchorHandler.isAnchored)
				{
					anchorHandler.DestroyAnchor();
				}
			}
			if (deathHead.outsideLevelTimer > 0f)
			{
				deathHead.outsideLevelTimer = 0f;
			}
		}

		protected void LateUpdate()
		{
			UpdateSpectated();
		}

		private void UpdateSpectated()
		{
			if (!deathHead.playerAvatar.isLocal)
			{
				return;
			}
			if (!deathHead.triggered || SpectateCamera.instance?.player == null)
			{
				spectated = false;
			}
			else if ((Object)(object)SpectateCamera.instance.player == (Object)(object)PlayerAvatar.instance && !spectated)
			{
				if (GameManager.Multiplayer())
				{
					((MonoBehaviourPun)this).photonView.RPC("SetSpectated", (RpcTarget)1, new object[1] { true });
				}
				SetSpectated(value: true);
			}
			else if ((Object)(object)SpectateCamera.instance.player != (Object)(object)PlayerAvatar.instance && spectated)
			{
				if (GameManager.Multiplayer())
				{
					((MonoBehaviourPun)this).photonView.RPC("SetSpectated", (RpcTarget)1, new object[1] { false });
				}
				SetSpectated(value: false);
			}
		}

		[PunRPC]
		internal void SetSpectated(bool value)
		{
			spectated = value;
		}
	}
	[BepInPlugin("Cronchy.DeathHeadHopper", "DeathHeadHopper", "1.2.1")]
	public class DeathHeadHopper : BaseUnityPlugin
	{
		public static GameObject? DeathHeadHopperPrefab;

		private const string _mainAssetBundle = "DeathHeadHopper";

		public static ConfigEntry<bool> FlashlightFlicker;

		public static ConfigEntry<bool> AlwaysAnchor;

		internal static DeathHeadHopper Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		internal void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			BindConfig();
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void BindConfig()
		{
			string text = "General";
			string text2 = "Host Client Config";
			FlashlightFlicker = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "FlashlightFlicker", true, "The playerdeathhead flickers its flashlight to indicate when something is wrong.");
			AlwaysAnchor = ((BaseUnityPlugin)this).Config.Bind<bool>(text2, "AnchorOnAllStages", false, "Always tether playerdeathhead to an anchor on the ground, instead of only once the last extraction point is completed.");
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private static void LoadAssets()
		{
			Logger.LogInfo((object)"Loading Assets...");
			AssetBundle val = LoadAssetBundle("DeathHeadHopper");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Failed to load asset bundle :(");
				return;
			}
			DeathHeadHopperPrefab = val.LoadAsset<GameObject>("Assets/DeathHeadHopper.prefab");
			if ((Object)(object)DeathHeadHopperPrefab == (Object)null)
			{
				Logger.LogError((object)"Failed to load prefab :(");
			}
			else
			{
				Logger.LogInfo((object)"Assets loaded!");
			}
		}

		private static AssetBundle LoadAssetBundle(string name)
		{
			Logger.LogDebug((object)("DeathHeadHopper: Loading Asset Bundle: " + name));
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name);
			return AssetBundle.LoadFromFile(text);
		}
	}
	public class DeathHeadHopperController : MonoBehaviour
	{
		public Vector3 spectateOffset = new Vector3(0f, 0.6f, 0f);

		private PlayerDeathHead deathHead;

		private Transform headTransform;

		private PhotonView headPhotonView;

		private HeadJumpHandler jumpHandler;

		private HeadHopHandler hopHandler;

		private Transform _tMainCamera;

		protected void Awake()
		{
			_tMainCamera = ((Component)Camera.main).transform;
			deathHead = PlayerAvatar.instance.playerDeathHead;
			headTransform = ((Component)deathHead).transform;
			headPhotonView = ((Component)deathHead).GetComponent<PhotonView>();
			DeathHeadController component = ((Component)deathHead).GetComponent<DeathHeadController>();
			jumpHandler = component.jumpHandler;
			hopHandler = component.hopHandler;
			PlayerAvatar.instance.spectatePoint = ((Component)this).transform;
		}

		protected void Update()
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_008f: 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)
			if (Object.op_Implicit((Object)(object)headTransform) && Object.op_Implicit((Object)(object)((Component)this).transform))
			{
				Quaternion val = Quaternion.LookRotation(Vector3.ProjectOnPlane(headTransform.forward, Vector3.up));
				Quaternion rotation = ((Component)this).transform.rotation;
				float x = ((Quaternion)(ref rotation)).eulerAngles.x;
				float y = ((Quaternion)(ref val)).eulerAngles.y;
				rotation = ((Component)this).transform.rotation;
				Quaternion val2 = Quaternion.Euler(x, y, ((Quaternion)(ref rotation)).eulerAngles.z);
				((Component)this).transform.SetPositionAndRotation(headTransform.position + spectateOffset, val2);
			}
		}

		protected void LateUpdate()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0050: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)SpectateCamera.instance.player != (Object)(object)PlayerAvatar.instance)
			{
				return;
			}
			if (SemiFunc.InputDown((InputKey)1))
			{
				Jump();
			}
			if (SemiFunc.InputDown((InputKey)14))
			{
				Vector3 val = Vector3.ProjectOnPlane(((Component)_tMainCamera).transform.forward, Vector3.up);
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					hopHandler.HopRealign(normalized);
					return;
				}
				headPhotonView.RPC("HopRealign", (RpcTarget)2, new object[1] { normalized });
			}
		}

		private void Jump()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0041: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0060: 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_006f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_0084: 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)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ProjectOnPlane(((Component)_tMainCamera).transform.forward, Vector3.up);
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 val2 = Vector3.Cross(Vector3.up, normalized);
			float num = SemiFunc.InputMovementX();
			float num2 = SemiFunc.InputMovementY();
			Vector3 val3 = Vector3.zero;
			if (num2 > 0f)
			{
				val3 += normalized;
			}
			if (num2 < 0f)
			{
				val3 -= normalized;
			}
			if (num < 0f)
			{
				val3 -= val2;
			}
			if (num > 0f)
			{
				val3 += val2;
			}
			val3 = ((Vector3)(ref val3)).normalized;
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				jumpHandler.JumpHead(val3);
				return;
			}
			headPhotonView.RPC("JumpHead", (RpcTarget)2, new object[1] { val3 });
		}
	}
	public static class DHHFunc
	{
		public static GameObject? DeathHeadHopperObj;

		public static bool IsDeathHeadSpectatable(PlayerAvatar player)
		{
			if ((Object)(object)player == (Object)(object)PlayerAvatar.instance)
			{
				if (!SemiFunc.RunIsLevel())
				{
					return SemiFunc.RunIsShop();
				}
				return true;
			}
			return false;
		}

		public static bool IsLastPointExtracting()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			RoundDirector instance = RoundDirector.instance;
			if (instance.extractionPointsCompleted >= instance.extractionPoints - 1 && Object.op_Implicit((Object)(object)instance.extractionPointCurrent))
			{
				if ((int)instance.extractionPointCurrent.currentState != 3 && (int)instance.extractionPointCurrent.currentState != 4)
				{
					return (int)instance.extractionPointCurrent.currentState == 6;
				}
				return true;
			}
			return false;
		}
	}
	internal class HeadAnchorHandler : MonoBehaviour
	{
		private DeathHeadController controller;

		public float anchorRadius = 8f;

		public Vector3 tetherOffset = new Vector3(0f, 0.2f, 0f);

		public float anchorReboundForce = 0.05f;

		public float lightThreshold = 0.95f;

		public float minGroundedTime = 0.5f;

		public float breakSpeed = 2f;

		public float unAnchorDelay = 0.8f;

		public Vector4 cameraShake = new Vector4(5f, 3f, 8f, 0.5f);

		public Vector4 cameraImpact = new Vector4(5f, 3f, 8f, 0.25f);

		internal bool isAnchored;

		private float distanceFromAnchor;

		private float unAnchorTimer;

		private float anchoredFor;

		private Vector3 headAnchorPoint;

		private Tether? anchorTether;

		private bool isBreaking;

		private Vector3 breakPoint = Vector3.zero;

		private float breakingLerp;

		private bool hasAnchoredAfterExtracted;

		private float reAnchorCooldown;

		private bool localSeen;

		protected void Awake()
		{
			controller = ((Component)this).GetComponent<DeathHeadController>();
		}

		protected void Start()
		{
			controller.reboundHandler.AddReboundForce(new HeadReboundHandler.Rebound(() => headAnchorPoint - ((Component)this).transform.position, () => isAnchored && distanceFromAnchor > anchorRadius, () => Mathf.Min(distanceFromAnchor / anchorRadius * anchorReboundForce, controller.reboundHandler.defaultReboundForce), shouldNegateProductVelocity: false));
			controller.eyeHandler.eyeNegativeConditions.Add(delegate
			{
				float num = controller.anchorHandler.anchoredFor;
				return num > 0.1f && num < 1f;
			});
			controller.eyeHandler.eyeNegativeConditions.Add(isOutsideAnchorRange);
			controller.eyeHandler.eyeFlickerConditions.Add(isOutsideAnchorRange);
			bool isOutsideAnchorRange()
			{
				return controller.anchorHandler.distanceFromAnchor / controller.anchorHandler.anchorRadius > controller.anchorHandler.lightThreshold;
			}
		}

		protected void Update()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			UpdateAnchorState();
			if (isAnchored)
			{
				distanceFromAnchor = Vector3.Distance(headAnchorPoint, ((Component)this).transform.position);
				anchoredFor += Time.deltaTime;
				ValuableHighlightInTruck();
			}
			else
			{
				distanceFromAnchor = 0f;
				anchoredFor = 0f;
			}
			if (isBreaking && anchorTether != null)
			{
				breakingLerp += Time.deltaTime * breakSpeed;
				anchorTether.point = Vector3.Lerp(breakPoint, headAnchorPoint, breakingLerp);
				if (breakingLerp >= 1f)
				{
					((Component)anchorTether).gameObject.SetActive(false);
					isBreaking = false;
				}
			}
			if (isAnchored && !isBreaking)
			{
				UpdateTetherPoint();
			}
		}

		private void ValuableHighlightInTruck()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerController.instance.playerAvatarScript.isDisabled && !localSeen && isAnchored && controller.deathHead.roomVolumeCheck.inTruck && RoundDirector.instance.allExtractionPointsCompleted)
			{
				Vector3 localCameraPosition = PlayerController.instance.playerAvatarScript.localCameraPosition;
				float num = Vector3.Distance(((Component)this).transform.position, localCameraPosition);
				if (num <= 10f && SemiFunc.OnScreen(((Component)this).transform.position, -0.15f, -0.15f))
				{
					Vector3 val = localCameraPosition - ((Component)this).transform.position;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					RaycastHit val2 = default(RaycastHit);
					if (!Physics.Raycast(controller.deathHead.physGrabObject.centerPoint, normalized, ref val2, num, LayerMask.GetMask(new string[1] { "Default" })))
					{
						localSeen = true;
						ValuableDiscover.instance.New(controller.deathHead.physGrabObject, (State)0);
					}
				}
			}
			if (localSeen && !controller.deathHead.roomVolumeCheck.inTruck)
			{
				localSeen = false;
			}
		}

		private void UpdateAnchorState()
		{
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer())
			{
				return;
			}
			if (!RoundDirector.instance.allExtractionPointsCompleted)
			{
				hasAnchoredAfterExtracted = false;
			}
			bool grabbed = controller.impactDetector.physGrabObject.grabbed;
			bool collidingCartWasGrabbed = controller.collisionHandler.collidingCartWasGrabbed;
			unAnchorTimer = ((grabbed || collidingCartWasGrabbed) ? (unAnchorTimer + Time.deltaTime) : 0f);
			reAnchorCooldown = ((grabbed || collidingCartWasGrabbed) ? (reAnchorCooldown - Time.deltaTime) : 0.5f);
			bool flag = !DeathHeadHopper.AlwaysAnchor.Value && !RoundDirector.instance.allExtractionPointsCompleted;
			if (unAnchorTimer > unAnchorDelay || !controller.deathHead.triggered || flag)
			{
				if (isAnchored)
				{
					DestroyAnchor();
				}
			}
			else
			{
				if (reAnchorCooldown <= 0f)
				{
					return;
				}
				bool flag2 = !hasAnchoredAfterExtracted && RoundDirector.instance.allExtractionPointsCompleted;
				if (!flag2 && (!controller.collisionHandler.isColliding || controller.collisionHandler.IsCollidingCart))
				{
					return;
				}
				Vector3? groundPointDown = controller.collisionHandler.GetGroundPointDown();
				if (groundPointDown.HasValue)
				{
					if (flag2)
					{
						hasAnchoredAfterExtracted = true;
					}
					if (!isAnchored)
					{
						CreateAnchor(groundPointDown.Value);
					}
				}
			}
		}

		private void UpdateTetherPoint()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if (anchorTether != null && ((Component)anchorTether).gameObject.activeInHierarchy)
			{
				Vector3 point = ((Component)this).transform.TransformPoint(tetherOffset);
				anchorTether.point = point;
				anchorTether.colorInterpolation = Mathf.Max(0f, (Mathf.Clamp01(distanceFromAnchor / anchorRadius) - lightThreshold) * (1f / (1f - lightThreshold)));
			}
		}

		private void EnableTether()
		{
			//IL_0048: 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)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			if (anchorTether == null)
			{
				GameObject val = new GameObject("HeadAnchorTether");
				val.transform.parent = ((Component)this).transform;
				anchorTether = val.AddComponent<Tether>();
			}
			((Component)anchorTether).gameObject.SetActive(true);
			anchorTether.origin = headAnchorPoint;
			anchorTether.curveEnabled = true;
			controller.audioHandler.PlayAnchorAttachSound();
			UpdateTetherPoint();
			anchorTether.ResetCurvePointSmooth();
			isBreaking = false;
		}

		private void DisableTether()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (anchorTether == null)
			{
				return;
			}
			if (controller.deathHead.triggered)
			{
				controller.audioHandler.PlayAnchorBreakSound();
				if (controller.deathHead.playerAvatar.isLocal)
				{
					GameDirector.instance.CameraShake.ShakeDistance(cameraShake.x, cameraShake.y, cameraShake.z, ((Component)this).transform.position, cameraShake.w);
					GameDirector.instance.CameraImpact.ShakeDistance(cameraImpact.x, cameraImpact.y, cameraImpact.z, ((Component)this).transform.position, cameraImpact.w);
				}
			}
			anchorTether.curveEnabled = false;
			isBreaking = true;
			breakPoint = anchorTether.point;
			breakingLerp = 0f;
		}

		internal void CreateAnchor(Vector3 position)
		{
			//IL_002f: 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)
			isAnchored = true;
			if (!SemiFunc.IsMultiplayer())
			{
				CreateAnchorRPC(position);
				return;
			}
			((MonoBehaviourPun)controller).photonView.RPC("CreateAnchorRPC", (RpcTarget)0, new object[1] { position });
		}

		[PunRPC]
		internal void CreateAnchorRPC(Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			headAnchorPoint = position;
			isAnchored = true;
			EnableTether();
		}

		internal void DestroyAnchor()
		{
			isAnchored = false;
			if (!SemiFunc.IsMultiplayer())
			{
				DestroyAnchorRPC();
			}
			else
			{
				((MonoBehaviourPun)controller).photonView.RPC("DestroyAnchorRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		internal void DestroyAnchorRPC()
		{
			isAnchored = false;
			DisableTether();
		}
	}
	public class HeadAudioHandler : MonoBehaviour
	{
		private DeathHeadController controller;

		public Sound? jumpSound;

		public Sound? anchorBreakSound;

		public Sound? anchorAttachSound;

		protected void Awake()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			controller = ((Component)this).GetComponent<DeathHeadController>();
			AudioSource val = ((Component)this).gameObject.GetComponent<AudioSource>();
			if ((Object)(object)val == (Object)null)
			{
				DeathHeadHopper.Logger.LogDebug((object)"No existing AudioSource. Trying to add...");
				val = ((Component)this).gameObject.AddComponent<AudioSource>();
			}
			if ((Object)(object)val == (Object)null)
			{
				DeathHeadHopper.Logger.LogError((object)"Failed to add AudioSource.");
				return;
			}
			DeathHeadHopper.Logger.LogDebug((object)"Successfully got or added AudioSource.");
			Sound val2 = new Sound();
			val2.Source = val;
			val2.Sounds = ((Component)this).gameObject.GetComponent<NotValuableObject>().audioPreset.impactMedium.Sounds.Clone() as AudioClip[];
			val2.Volume = 0.12f;
			val2.VolumeRandom = 0f;
			val2.Pitch = 0.8f;
			val2.PitchRandom = 0f;
			jumpSound = val2;
			val2 = new Sound();
			val2.Source = val;
			val2.Sounds = controller.deathHead.playerAvatar.tumbleBreakFreeSound.Sounds.Clone() as AudioClip[];
			val2.Volume = 0.2f;
			val2.VolumeRandom = 0f;
			val2.Pitch = 1f;
			val2.PitchRandom = 0f;
			anchorBreakSound = val2;
			val2 = new Sound();
			val2.Source = val;
			val2.Sounds = controller.deathHead.eyeFlashNegativeSound.Sounds.Clone() as AudioClip[];
			val2.Volume = 0.2f;
			val2.VolumeRandom = 0f;
			val2.Pitch = 1f;
			val2.PitchRandom = 0f;
			anchorAttachSound = val2;
		}

		internal void PlayJumpSound()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Sound? obj = jumpSound;
			if (obj != null)
			{
				obj.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
		}

		internal void PlayAnchorBreakSound()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Sound? obj = anchorBreakSound;
			if (obj != null)
			{
				obj.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
		}

		internal void PlayAnchorAttachSound()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Sound? obj = anchorAttachSound;
			if (obj != null)
			{
				obj.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f);
			}
		}
	}
	public class HeadCollisionHandler : MonoBehaviour
	{
		private PhysGrabObjectImpactDetector impactDetector;

		public LayerMask layerMask;

		public float collisionDelay = 0.15f;

		internal bool isColliding;

		private readonly List<Collision> activeCollisions = new List<Collision>();

		private float collisionTimer;

		private float collisionDelayTimer;

		internal bool collidingCartWasGrabbed;

		private float collidingCartTimer;

		private PhysGrabCart? collidingCart;

		internal bool IsCollidingCart => collidingCartTimer > 0f;

		protected void Awake()
		{
			//IL_0038: 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)
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			layerMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Default", "PhysGrabObject", "PhysGrabObjectHinge", "PhysGrabObjectCart" }));
		}

		protected void Update()
		{
			if (collisionTimer > 0f)
			{
				collisionTimer -= Time.deltaTime;
				if (collisionDelayTimer > 0f)
				{
					collisionDelayTimer -= Time.deltaTime;
				}
				else
				{
					isColliding = true;
				}
			}
			else
			{
				isColliding = false;
				collisionDelayTimer = collisionDelay;
			}
			if (collidingCart == null)
			{
				if (collidingCartTimer > 0f)
				{
					collidingCartTimer -= Time.deltaTime;
				}
				else
				{
					collidingCartWasGrabbed = false;
				}
				return;
			}
			collidingCartTimer = 1f;
			if (!collidingCartWasGrabbed && ((Component)collidingCart).gameObject.GetComponent<PhysGrabObject>().grabbed)
			{
				collidingCartWasGrabbed = true;
			}
		}

		protected void OnCollisionEnter(Collision collision)
		{
			activeCollisions.Add(collision);
			UpdateCollidingCart();
		}

		protected void OnCollisionExit(Collision collision)
		{
			activeCollisions.Remove(collision);
			UpdateCollidingCart();
		}

		private void UpdateCollidingCart()
		{
			collidingCart = impactDetector.currentCart ?? activeCollisions.Select((Collision x) => ((Component)x.collider).GetComponentInParent<PhysGrabCart>()).FirstOrDefault((Func<PhysGrabCart, bool>)((PhysGrabCart cart) => cart != null));
		}

		protected void OnCollisionStay(Collision other)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			int num = 1 << other.gameObject.layer;
			if ((num & LayerMask.op_Implicit(layerMask)) > 0)
			{
				collisionTimer = 0.1f;
			}
		}

		internal Vector3? GetGroundPointDown()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position, Vector3.down, ref val, 50f, LayerMask.GetMask(new string[1] { "Default" })))
			{
				return ((RaycastHit)(ref val)).point;
			}
			return null;
		}
	}
	public class HeadEyeHandler : MonoBehaviour
	{
		private DeathHeadController controller;

		private PlayerDeathHead deathHead;

		internal List<Func<bool>> eyeFlickerConditions = new List<Func<bool>>();

		internal List<Func<bool>> eyeNegativeConditions = new List<Func<bool>>();

		[Space]
		public Color eyeColor = new Color(1f, 0.9047236f, 0.5801887f);

		public Color eyeLightColor = new Color(1f, 0.6744879f, 0.3820755f);

		private float eyeWarningLerp;

		[Space]
		public float eyeShineIntensity = 1.2f;

		public float eyeLightRange = 8f;

		private float eyeShineLerp;

		[Space]
		public float eyeFlickerIntensity = 0.8f;

		[Range(0f, 1f)]
		public float eyeFlickerColorMultiplier = 1f;

		public float eyeFlickerSpeed = 8f;

		public float eyeFlickerMinDelay = 0.1f;

		public float eyeFlickerMaxDelay = 1f;

		private AnimationCurve eyeFlickerCurve;

		private float eyeFlickerLerp = 1f;

		private float nextFlickerTimer;

		protected void Awake()
		{
			//IL_004c: 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)
			controller = ((Component)this).GetComponent<DeathHeadController>();
			deathHead = controller.deathHead;
			eyeFlickerCurve = AssetManager.instance.animationCurveInOut;
			((Component)deathHead.eyeFlashLight).transform.localPosition = new Vector3(0f, 0.13f, 0.008f);
			deathHead.eyeFlashLight.type = (LightType)0;
			deathHead.eyeFlashLight.spotAngle = 120f;
			deathHead.eyeFlashLight.shadows = (LightShadows)1;
			deathHead.eyeFlashLight.range = eyeLightRange;
			deathHead.eyeFlashLight.color = eyeLightColor;
			deathHead.eyeFlashLight.intensity = 0f;
		}

		protected void LateUpdate()
		{
			if (deathHead.eyeFlash && deathHead.eyeFlashLerp < 1f)
			{
				eyeShineLerp = 0f;
				return;
			}
			deathHead.eyeFlash = false;
			EyeColor();
			if (DeathHeadHopper.FlashlightFlicker.Value && eyeFlickerConditions.Any((Func<bool> x) => x()))
			{
				EyeFlicker();
			}
			else
			{
				EyeFlash();
			}
		}

		private void EyeColor()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b8: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (eyeNegativeConditions.Any((Func<bool> x) => x()))
			{
				eyeWarningLerp = Mathf.Min(eyeWarningLerp + 2f * Time.deltaTime, 1f);
			}
			else if (eyeWarningLerp > 0f)
			{
				eyeWarningLerp = Mathf.Max(eyeWarningLerp - 2f * Time.deltaTime, 0f);
			}
			Color val = Color.Lerp(eyeColor, deathHead.eyeFlashNegativeColor, eyeWarningLerp);
			Color color = Color.Lerp(eyeLightColor, deathHead.eyeFlashNegativeColor, eyeWarningLerp);
			deathHead.eyeMaterial.SetColor(deathHead.eyeMaterialColor, val);
			deathHead.eyeFlashLight.color = color;
		}

		private void EyeFlicker()
		{
			eyeShineLerp = 0f;
			nextFlickerTimer -= Time.deltaTime;
			if (nextFlickerTimer <= 0f)
			{
				eyeFlickerLerp = 0f;
				nextFlickerTimer = Random.Range(eyeFlickerMinDelay, eyeFlickerMaxDelay);
			}
			if (eyeFlickerLerp < 1f)
			{
				eyeFlickerLerp = Mathf.Min(eyeFlickerLerp + eyeFlickerSpeed * Time.deltaTime, 1f);
				float num = ((eyeFlickerLerp <= 0.5f) ? eyeFlickerLerp : (1f - eyeFlickerLerp)) * 2f;
				deathHead.eyeMaterial.SetFloat(deathHead.eyeMaterialAmount, eyeFlickerCurve.Evaluate(num) * eyeFlickerColorMultiplier);
				deathHead.eyeFlashLight.intensity = eyeFlickerCurve.Evaluate(num) * eyeFlickerIntensity;
			}
		}

		private void EyeFlash()
		{
			nextFlickerTimer = 0f;
			eyeFlickerLerp = 0f;
			if (controller.spectated)
			{
				if (eyeShineLerp == 1f)
				{
					eyeShineLerp = 0f;
				}
				if (eyeShineLerp > 0.1f)
				{
					eyeShineLerp = Mathf.Max(eyeShineLerp - 2f * Time.deltaTime, 0.1f);
				}
				else if (eyeShineLerp < 0.1f)
				{
					eyeShineLerp = Mathf.Min(eyeShineLerp + 2f * Time.deltaTime, 0.1f);
				}
			}
			else if (eyeShineLerp < 1f)
			{
				eyeShineLerp = Mathf.Min(eyeShineLerp + 2f * Time.deltaTime, 1f);
			}
			if (((Component)deathHead.eyeFlashLight).gameObject.activeSelf ^ (eyeShineLerp < 1f))
			{
				((Component)deathHead.eyeFlashLight).gameObject.SetActive(eyeShineLerp < 1f);
			}
			if (((Component)deathHead.eyeFlashLight).gameObject.activeSelf)
			{
				deathHead.eyeMaterial.SetFloat(deathHead.eyeMaterialAmount, deathHead.eyeFlashCurve.Evaluate(eyeShineLerp));
				deathHead.eyeFlashLight.intensity = deathHead.eyeFlashCurve.Evaluate(eyeShineLerp) * eyeShineIntensity;
			}
		}
	}
	public class HeadHopHandler : MonoBehaviour
	{
		private DeathHeadController controller;

		private Rigidbody rb;

		public float hopJumpForce = 3f;

		public float hopRotationForce = 20f;

		public float hopDamping = 12f;

		public float hopAngleThreshold = 2f;

		public float hopVelocityThreshold = 0.03f;

		public float hopCooldown = 0.6f;

		private float hopCooldownTimer;

		private bool isHopping;

		private Quaternion hopTargetRotation;

		protected void Awake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			controller = ((Component)this).GetComponent<DeathHeadController>();
			rb = ((Component)this).GetComponent<Rigidbody>();
			controller.m_HeadJumpEvent.AddListener(new UnityAction(OnHeadJump));
		}

		protected void Update()
		{
			if (hopCooldownTimer > 0f)
			{
				hopCooldownTimer -= Time.deltaTime;
			}
		}

		protected void FixedUpdate()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (isHopping && !rb.isKinematic)
			{
				Quaternion val = hopTargetRotation * Quaternion.Inverse(rb.rotation);
				float num = default(float);
				Vector3 val2 = default(Vector3);
				((Quaternion)(ref val)).ToAngleAxis(ref num, ref val2);
				if (num > 180f)
				{
					num -= 360f;
				}
				Vector3 val3 = ((Vector3)(ref val2)).normalized * num * (MathF.PI / 180f) * hopRotationForce;
				rb.angularVelocity = Vector3.Lerp(rb.angularVelocity, val3, Time.fixedDeltaTime * hopDamping);
				Vector3 angularVelocity = rb.angularVelocity;
				if (((Vector3)(ref angularVelocity)).magnitude < hopVelocityThreshold && Quaternion.Angle(rb.rotation, hopTargetRotation) < hopAngleThreshold)
				{
					isHopping = false;
				}
			}
		}

		private void OnHeadJump()
		{
			isHopping = false;
			hopCooldownTimer = hopCooldown / 2f;
		}

		[PunRPC]
		internal void HopRealign(Vector3 forwardVector)
		{
			//IL_0041: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (!(hopCooldownTimer > 0f) && !rb.isKinematic)
			{
				controller.m_HeadHopEvent.Invoke();
				rb.AddForce(new Vector3(0f, hopJumpForce, 0f), (ForceMode)1);
				hopTargetRotation = Quaternion.LookRotation(forwardVector, Vector3.up);
				isHopping = true;
				hopCooldownTimer = hopCooldown;
			}
		}
	}
	public delegate void HeadJumpedEventHandler();
	public class HeadJumpHandler : MonoBehaviourPun
	{
		private DeathHeadController controller;

		private Rigidbody rb;

		public float jumpVertical = 1f;

		public float jumpForce = 2.8f;

		public float rotationForce = 0.05f;

		public float jumpCooldown = 1f;

		private float jumpCooldownTimer;

		private float jumpBufferTimer;

		private Vector3 jumpDirection;

		protected void Awake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			controller = ((Component)this).GetComponent<DeathHeadController>();
			rb = ((Component)this).GetComponent<Rigidbody>();
			controller.m_HeadHopEvent.AddListener(new UnityAction(OnHeadHop));
		}

		protected void Update()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			if (jumpBufferTimer > 0f)
			{
				jumpBufferTimer -= Time.deltaTime;
				if (controller.collisionHandler.isColliding && jumpCooldownTimer <= 0f)
				{
					controller.m_HeadJumpEvent.Invoke();
					jumpDirection.y = jumpVertical;
					Vector3 val = jumpDirection * jumpForce;
					rb.AddForce(val, (ForceMode)1);
					Vector3 val2 = Vector3.Cross(Vector3.up, jumpDirection);
					rb.AddTorque(val2 * rotationForce, (ForceMode)1);
					jumpCooldownTimer = jumpCooldown;
					jumpBufferTimer = 0f;
					if (!SemiFunc.IsMultiplayer())
					{
						HeadJumped(jumpForce);
					}
					else
					{
						((MonoBehaviourPun)this).photonView.RPC("HeadJumped", (RpcTarget)0, new object[1] { jumpForce });
					}
				}
			}
			if (jumpCooldownTimer > 0f)
			{
				jumpCooldownTimer -= Time.deltaTime;
			}
		}

		private void OnHeadHop()
		{
			jumpCooldownTimer = jumpCooldown / 2f;
		}

		[PunRPC]
		internal void JumpHead(Vector3 forwardVector)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			jumpBufferTimer = 0.25f;
			jumpDirection = forwardVector;
		}

		[PunRPC]
		internal void HeadJumped(float jumpMultiplier)
		{
			controller.audioHandler.PlayJumpSound();
		}
	}
	internal class HeadReboundHandler : MonoBehaviour
	{
		internal class Rebound
		{
			public Func<Vector3> direction;

			public Func<bool> shouldApply;

			public Func<float>? force;

			public bool shouldNegateProductVelocity;

			public Rebound(Func<Vector3> direction, Func<bool> shouldApply, Func<float>? force = null, bool shouldNegateProductVelocity = true)
			{
				Func<Vector3> direction2 = direction;
				base..ctor();
				this.direction = delegate
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000b: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					Vector3 val = direction2();
					return ((Vector3)(ref val)).normalized;
				};
				this.shouldApply = shouldApply;
				this.force = force;
				this.shouldNegateProductVelocity = shouldNegateProductVelocity;
			}
		}

		private DeathHeadController controller;

		private Rigidbody rb;

		public float reboundDuration = 3f;

		public float defaultReboundForce = 0.1f;

		public float volicityProductMultiplier = 0.05f;

		public float reboundYVelocity = 0.08f;

		public float maxTotalReboundForce = 7f;

		private readonly List<Rebound> reboundEffects = new List<Rebound>();

		protected void Awake()
		{
			controller = ((Component)this).GetComponent<DeathHeadController>();
			rb = ((Component)this).GetComponent<Rigidbody>();
		}

		internal void FixedUpdate()
		{
			//IL_006b: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.IsMasterClientOrSingleplayer() || controller.impactDetector.physGrabObject.grabbed)
			{
				return;
			}
			foreach (Rebound reboundEffect in reboundEffects)
			{
				if (reboundEffect.shouldApply())
				{
					float num = ((reboundEffect.force != null) ? reboundEffect.force() : defaultReboundForce);
					Vector3 val = -reboundEffect.direction();
					Vector3 velocity = rb.velocity;
					float num2 = Vector3.Dot(val, ((Vector3)(ref velocity)).normalized);
					velocity = rb.velocity;
					float num3 = num2 * ((Vector3)(ref velocity)).magnitude;
					if (reboundEffect.shouldNegateProductVelocity)
					{
						num += volicityProductMultiplier * Mathf.Max(0f, num3);
					}
					if (num3 < 0f)
					{
						num = Mathf.Min(num, maxTotalReboundForce + num3);
					}
					Rigidbody obj = rb;
					obj.velocity += reboundEffect.direction() * num + new Vector3(0f, reboundYVelocity, 0f);
				}
			}
		}

		public void AddReboundForce(Rebound rebound)
		{
			reboundEffects.Add(rebound);
		}
	}
	public class Tether : MonoBehaviour
	{
		public Vector3 origin;

		public Vector3 point;

		public Color tetherStartColor;

		public Color tetherEndColor;

		public float curveSpeed;

		public int curveResolution;

		public float colorInterpolation;

		public bool curveEnabled;

		[Header("Texture Scrolling")]
		public Vector2 scrollSpeed;

		private Vector3 curvePointSmooth;

		private LineRenderer lineRenderer;

		[HideInInspector]
		public Material lineMaterial;

		protected void Awake()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0085: 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)
			lineRenderer = ((Component)this).gameObject.AddComponent<LineRenderer>();
			LineRenderer component = ((Component)PlayerAvatar.instance).GetComponent<PhysGrabber>().physGrabBeam.gameObject.GetComponent<LineRenderer>();
			((Renderer)lineRenderer).material = ((Renderer)component).material;
			lineRenderer.textureMode = component.textureMode;
			((Renderer)lineRenderer).shadowCastingMode = (ShadowCastingMode)0;
			AnimationCurve val = new AnimationCurve();
			val.AddKey(0f, 0f);
			val.AddKey(new Keyframe(0.1f, 0.11f, 0f, 0f));
			val.AddKey(new Keyframe(0.9f, 0.07f, 0f, 0f));
			val.AddKey(1f, 0.05f);
			lineRenderer.widthCurve = val;
			lineMaterial = ((Renderer)lineRenderer).material;
		}

		protected void LateUpdate()
		{
			DrawLine();
			ScrollTexture();
		}

		internal void ResetCurvePointSmooth()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			curvePointSmooth = (origin + point) / 2f;
		}

		private void DrawLine()
		{
			//IL_0016: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			float num = curveSpeed;
			if (!curveEnabled)
			{
				num = 20f;
			}
			Vector3 val = (origin + point) / 2f;
			Vector3[] array = (Vector3[])(object)new Vector3[curveResolution];
			curvePointSmooth = Vector3.Lerp(curvePointSmooth, val, Time.deltaTime * num);
			for (int i = 0; i < curveResolution; i++)
			{
				float t = (float)i / ((float)curveResolution - 1f);
				array[i] = CalculateBezierPoint(t, origin, curvePointSmooth, point);
			}
			lineRenderer.positionCount = curveResolution;
			lineRenderer.SetPositions(array);
		}

		private Vector3 CalculateBezierPoint(float t, Vector3 p0, Vector3 p1, Vector3 p2)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Pow(1f - t, 2f) * p0 + 2f * (1f - t) * t * p1 + Mathf.Pow(t, 2f) * p2;
		}

		private void ScrollTexture()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)lineMaterial))
			{
				lineMaterial.mainTextureScale = new Vector2(1f, 1f);
				Vector2 mainTextureOffset = Time.time * scrollSpeed;
				lineMaterial.mainTextureOffset = mainTextureOffset;
				lineMaterial.color = Color.Lerp(tetherStartColor, tetherEndColor, colorInterpolation);
				lineMaterial.EnableKeyword("_EMISSION");
				lineMaterial.SetColor("_EmissionColor", lineMaterial.color);
			}
		}

		public Tether()
		{
			//IL_0016: 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: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			tetherStartColor = (Color)(ColorUtility.TryParseHtmlString("#00C4FD", ref val) ? new Color(val.r, val.g, val.b, 0.1f) : Color.red);
			Color val2 = default(Color);
			tetherEndColor = (Color)(ColorUtility.TryParseHtmlString("#E70A17", ref val2) ? new Color(val2.r, val2.g, val2.b, 0.4f) : Color.red);
			curveSpeed = 2f;
			curveResolution = 20;
			curveEnabled = true;
			scrollSpeed = new Vector2(4f, 0f);
			((MonoBehaviour)this)..ctor();
		}
	}
}
namespace DeathHeadHopper.Patches
{
	[HarmonyPatch(typeof(GameDirector))]
	public static class GameDirectorPatch
	{
		[HarmonyPatch("gameStateStart")]
		[HarmonyPostfix]
		public static void GameStateStart_Postfix()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			if ((int)GameDirector.instance.currentState != 2 || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop()))
			{
				return;
			}
			string name = ((Object)((Component)PlayerAvatar.instance.spectatePoint).gameObject).name;
			GameObject? deathHeadHopperPrefab = DeathHeadHopper.DeathHeadHopperPrefab;
			if (name == ((deathHeadHopperPrefab != null) ? ((Object)deathHeadHopperPrefab).name : null))
			{
				DeathHeadHopper.Logger.LogDebug((object)"Player already has DeathHeadHopper enabled");
				return;
			}
			DeathHeadHopper.Logger.LogDebug((object)"Creating DeathHeadHopper object instance...");
			DHHFunc.DeathHeadHopperObj = new GameObject("DeathHeadHopper");
			if (DHHFunc.DeathHeadHopperObj == null)
			{
				DeathHeadHopper.Logger.LogError((object)"Failed to create DeathHeadHopper object instance :(");
				return;
			}
			DHHFunc.DeathHeadHopperObj.SetActive(false);
			DHHFunc.DeathHeadHopperObj.AddComponent<DeathHeadHopperController>();
			DHHFunc.DeathHeadHopperObj.transform.SetParent(((Component)PlayerAvatar.instance).transform.parent, false);
			DeathHeadHopper.Logger.LogDebug((object)"DeathHeadHopper object instance created!");
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				ComponentHolderProtocol.AddComponent<DeathHeadController>((Object)(object)player.playerDeathHead);
			}
			DeathHeadHopper.Logger.LogDebug((object)"Added DeathHeadController to player heads!");
		}

		[HarmonyPatch("Revive")]
		[HarmonyPrefix]
		private static void Revive_Prefix()
		{
			if (DHHFunc.DeathHeadHopperObj != null && DHHFunc.DeathHeadHopperObj.activeSelf)
			{
				DeathHeadHopper.Logger.LogInfo((object)"You are revived! Disabling DeathHeadHopper");
				DHHFunc.DeathHeadHopperObj.SetActive(false);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerDeathHead))]
	public class PlayerDeathHeadPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void Update_Prefix(PlayerDeathHead __instance, out bool __state)
		{
			bool flag = false;
			if (__instance.inTruckPrevious != __instance.roomVolumeCheck.inTruck)
			{
				DeathHeadController component = ((Component)__instance).GetComponent<DeathHeadController>();
				if (component.anchorHandler.isAnchored)
				{
					__instance.inTruckPrevious = !__instance.inTruckPrevious;
					flag = true;
				}
			}
			__state = flag;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Update_Postfix(PlayerDeathHead __instance, bool __state)
		{
			if (__state)
			{
				__instance.inTruckPrevious = !__instance.inTruckPrevious;
			}
		}
	}
	[HarmonyPatch(typeof(SpectateCamera))]
	internal static class SpectateCameraPatch
	{
		private static readonly FieldInfo f_isDisabled = AccessTools.Field(typeof(PlayerAvatar), "isDisabled");

		private static readonly MethodInfo m_inputDown = AccessTools.Method(typeof(SemiFunc), "InputDown", (Type[])null, (Type[])null);

		private static readonly MethodInfo m_playerSwitch = AccessTools.Method(typeof(SpectateCamera), "PlayerSwitch", (Type[])null, (Type[])null);

		[HarmonyPatch("StateNormal")]
		[HarmonyPrefix]
		private static void StateNormal_Prefix()
		{
			if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && Object.op_Implicit((Object)(object)DHHFunc.DeathHeadHopperObj) && DHHFunc.DeathHeadHopperObj != null && !DHHFunc.DeathHeadHopperObj.activeSelf)
			{
				DeathHeadHopper.Logger.LogInfo((object)"You died! Enabling DeathHeadHopper");
				DHHFunc.DeathHeadHopperObj.SetActive(true);
			}
		}

		[HarmonyPatch("PlayerSwitch")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> PlayerSwitch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindIndex((CodeInstruction ci) => CodeInstructionExtensions.LoadsField(ci, f_isDisabled, false));
			if (num <= 0 || !(list[num + 1].operand is Label item))
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} index: {1}", "PlayerSwitch_Transpiler", num));
			int num2 = list.FindIndex(num, (CodeInstruction ci) => ci.opcode == OpCodes.Ret);
			if (num2 <= 0)
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} returnIndex: {1}", "PlayerSwitch_Transpiler", num2));
			DeathHeadHopper.Logger.LogDebug((object)"Found playerAvatar.isDisabled check in PlayerSwitch, replacing code instructions");
			Label label = generator.DefineLabel();
			list[num2 + 1].labels.Add(label);
			list[num2 + 1].labels.Remove(item);
			list[num + 1].opcode = OpCodes.Brfalse_S;
			list[num + 2].labels.Add(item);
			list.InsertRange(num + 2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Ldloc_3, (object)null),
				CodeInstruction.Call(typeof(DHHFunc), "IsDeathHeadSpectatable", new Type[1] { typeof(PlayerAvatar) }, (Type[])null),
				new CodeInstruction(OpCodes.Brfalse, (object)label)
			});
			return list.AsEnumerable();
		}

		[HarmonyPatch("StateNormal")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> StateNormal_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindIndex((CodeInstruction ci) => CodeInstructionExtensions.Calls(ci, m_inputDown)) - 1;
			if (num <= 0 || list[num].opcode != OpCodes.Ldc_I4_1)
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} start: {1}", "StateNormal_Transpiler", num));
			int num2 = list.FindIndex(num, (CodeInstruction ci) => CodeInstructionExtensions.Calls(ci, m_playerSwitch));
			if (num2 == -1)
			{
				return instructions;
			}
			DeathHeadHopper.Logger.LogDebug((object)string.Format("{0} end: {1}", "StateNormal_Transpiler", num2));
			DeathHeadHopper.Logger.LogDebug((object)"Found jump check in StateNormal, removing code instructions");
			list[num].opcode = OpCodes.Nop;
			list.RemoveRange(num + 1, num2 - num);
			return list.AsEnumerable();
		}
	}
}