Decompiled source of PjonkGoose v2.0.1

plugins/PjonkGoose/PjonkGoose.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using PjonkGoose.Configs;
using PjonkGoose.NetcodePatcher;
using PjonkGooseEnemy.EnemyStuff;
using PjonkGooseEnemy.Misc;
using PjonkGooseEnemy.ScrapStuff;
using PjonkGooseEnemy.Util.Extensions;
using PjonkGooseEnemy.Util.Spawning;
using PjonkGooseEnemy.src.EnemyStuff;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[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.Components")]
[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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PjonkGoose")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("PjonkGoose for Lethal Company.")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+b931d32d5bc376965dd4a2161358546ac93b584f")]
[assembly: AssemblyProduct("PjonkGoose")]
[assembly: AssemblyTitle("PjonkGoose")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 PjonkGoose
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "PjonkGoose";

		public const string PLUGIN_NAME = "PjonkGoose";

		public const string PLUGIN_VERSION = "2.0.1";
	}
}
namespace PjonkGoose.Configs
{
	public class PjonkGooseConfig
	{
		public ConfigEntry<string> ConfigPjonkGooseSpawnWeights { get; private set; }

		public ConfigEntry<int> ConfigPjonkGooseMaxCount { get; private set; }

		public ConfigEntry<int> ConfigPjonkGoosePowerLevel { get; private set; }

		public ConfigEntry<int> ConfigPjonkGooseOffSpringMaxCount { get; private set; }

		public ConfigEntry<bool> ConfigPjonkGooseExtendedLogs { get; private set; }

		public ConfigEntry<bool> ConfigPjonkTurkeyEnabled { get; private set; }

		public PjonkGooseConfig(ConfigFile configFile)
		{
			ConfigPjonkGooseExtendedLogs = configFile.Bind<bool>("PjonkGoose Options", "Pjonk Goose | Extended Logs", false, "Extended Logs for the Pjonk Goose.");
			ConfigPjonkGoosePowerLevel = configFile.Bind<int>("PjonkGoose Options", "Pjonk Goose | Power Level", 3, "Power Level of the Pjonk Goose in the moon.");
			ConfigPjonkGooseSpawnWeights = configFile.Bind<string>("PjonkGoose Options", "Pjonk Goose | Spawn Weights", "All:66,Modded:66,Vanilla:66", "Spawn Weight of the Pjonk Goose in moons.");
			ConfigPjonkGooseMaxCount = configFile.Bind<int>("PjonkGoose Options", "Pjonk Goose | Max Count", 1, "Max Count of the PjonkGoose that spawn naturally in the moon.");
			ConfigPjonkGooseOffSpringMaxCount = configFile.Bind<int>("PjonkGoose Options", "Pjonk Goose | Off-Spring Max Count", 3, "Max Count of the PjonkGoose that spawn when they are spawned through as off-spring in the moon.");
			ConfigPjonkTurkeyEnabled = configFile.Bind<bool>("PjonkGoose Options", "Pjonk Turkey | Enabled", true, "Allows the pjonk turkey to spawn in certain conditions.");
			ClearUnusedEntries(configFile);
		}

		private void ClearUnusedEntries(ConfigFile configFile)
		{
			PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(configFile, null);
			dictionary.Clear();
			configFile.Save();
		}
	}
}
namespace PjonkGooseEnemy
{
	public class KnockPlayersAway : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <SmashPlayer>d__4 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerControllerB player;

			public KnockPlayersAway <>4__this;

			private float <duration>5__2;

			private Vector3 <direction>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SmashPlayer>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0038: 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_004d: 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_0055: 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_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_0082: 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_0091: 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_00a1: Expected O, but got Unknown
				int num = <>1__state;
				KnockPlayersAway knockPlayersAway = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<duration>5__2 = 0.2f;
					Vector3 position = ((Component)player).transform.position;
					Bounds bounds = ((Component)knockPlayersAway).gameObject.GetComponent<Collider>().bounds;
					Vector3 val = position - ((Bounds)(ref bounds)).center;
					<direction>5__3 = ((Vector3)(ref val)).normalized;
					break;
				}
				case 1:
					<>1__state = -1;
					break;
				}
				if (<duration>5__2 > 0f)
				{
					<duration>5__2 -= Time.fixedDeltaTime;
					player.externalForces = <direction>5__3 * 10f;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				knockPlayersAway.playersBeingSmashed.Remove(player);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public PjonkGooseAI mainscript;

		private List<PlayerControllerB> playersBeingSmashed = new List<PlayerControllerB>();

		private void OnTriggerEnter(Collider other)
		{
			if (mainscript.pushingAway && ((Component)other).CompareTag("Player") && !playersBeingSmashed.Contains(((Component)other).GetComponent<PlayerControllerB>()))
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				playersBeingSmashed.Add(component);
				((MonoBehaviour)this).StartCoroutine(SmashPlayer(component));
			}
		}

		private void OnTriggerStay(Collider other)
		{
			if (mainscript.pushingAway && ((Component)other).CompareTag("Player") && !playersBeingSmashed.Contains(((Component)other).GetComponent<PlayerControllerB>()))
			{
				PlayerControllerB component = ((Component)other).GetComponent<PlayerControllerB>();
				playersBeingSmashed.Add(component);
				((MonoBehaviour)this).StartCoroutine(SmashPlayer(component));
			}
		}

		[IteratorStateMachine(typeof(<SmashPlayer>d__4))]
		private IEnumerator SmashPlayer(PlayerControllerB player)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SmashPlayer>d__4(0)
			{
				<>4__this = this,
				player = player
			};
		}
	}
	[BepInPlugin("PjonkGoose", "PjonkGoose", "2.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static EnemyType PjonkGooseEnemyType;

		public static Item GoldenEggItem;

		public static Item PjonkTurkey;

		public static GameObject UtilsPrefab;

		public static Dictionary<string, Item> samplePrefabs = new Dictionary<string, Item>();

		private readonly Harmony _harmony = new Harmony("PjonkGoose");

		public static PjonkGooseConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PjonkGooseConfig(((BaseUnityPlugin)this).Config);
			Assets.PopulateAssets();
			if ((Object)(object)Assets.MainAssetBundle == (Object)null || (Object)(object)Assets.SecondaryAssetBundle == (Object)null)
			{
				Logger.LogError((object)"Failed to load pjonk goose assets.");
				return;
			}
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			UtilsPrefab = Assets.MainAssetBundle.LoadAsset<GameObject>("PjonkGooseEnemyUtils");
			PjonkTurkey = Assets.SecondaryAssetBundle.LoadAsset<Item>("PjonkTurkeyObj");
			Utilities.FixMixerGroups(PjonkTurkey.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(PjonkTurkey.spawnPrefab);
			Items.RegisterScrap(PjonkTurkey, 0, (LevelTypes)1);
			samplePrefabs.Add("Pjonk Turkey", PjonkTurkey);
			GoldenEggItem = Assets.MainAssetBundle.LoadAsset<Item>("PjonkEggObj");
			Utilities.FixMixerGroups(GoldenEggItem.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(GoldenEggItem.spawnPrefab);
			Items.RegisterScrap(GoldenEggItem, 0, (LevelTypes)1);
			samplePrefabs.Add("GoldenEgg", GoldenEggItem);
			PjonkGooseEnemyType = Assets.MainAssetBundle.LoadAsset<EnemyType>("PjonkGooseObj");
			TerminalNode terminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("PjonkGooseTN");
			TerminalKeyword terminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("PjonkGooseTK");
			NetworkPrefabs.RegisterNetworkPrefab(PjonkGooseEnemyType.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(PjonkGooseEnemyType.enemyPrefab.GetComponent<PjonkGooseAI>().nest);
			RegisterEnemyWithConfig(BoundConfig.ConfigPjonkGooseSpawnWeights.Value, PjonkGooseEnemyType, terminalNode, terminalKeyword, BoundConfig.ConfigPjonkGoosePowerLevel.Value, BoundConfig.ConfigPjonkGooseMaxCount.Value);
			InitializeNetworkBehaviours();
			Logger.LogInfo((object)"Plugin PjonkGoose is loaded!");
		}

		protected void RegisterEnemyWithConfig(string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword, float powerLevel, int spawnCount)
		{
			enemy.MaxCount = spawnCount;
			enemy.PowerLevel = powerLevel;
			var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
			Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
		}

		protected (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_007a: 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)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (!int.TryParse(array[1], out var result))
				{
					continue;
				}
				if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
				{
					dictionary[result2] = result;
					continue;
				}
				string value = text + "Level";
				if (Enum.TryParse<LevelTypes>(value, ignoreCase: true, out result2))
				{
					dictionary[result2] = result;
				}
				else
				{
					dictionary2[text] = result;
				}
			}
			return (dictionary, dictionary2);
		}

		internal static void ExtendedLogging(object text)
		{
			if (BoundConfig.ConfigPjonkGooseExtendedLogs.Value)
			{
				Logger.LogInfo(text);
			}
		}

		private void InitializeNetworkBehaviours()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class Assets
	{
		public static AssetBundle? MainAssetBundle;

		public static AssetBundle? SecondaryAssetBundle;

		public static void PopulateAssets()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "pjonkgooseassets"));
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Plugin.Logger.LogError((object)"Failed to load pjonk goose assets.");
			}
			SecondaryAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "pjonkturkeyassets"));
			if ((Object)(object)SecondaryAssetBundle == (Object)null)
			{
				Plugin.Logger.LogError((object)"Failed to load pjonk turkey assets.");
			}
		}
	}
}
namespace PjonkGooseEnemy.src.EnemyStuff
{
	public abstract class PjonkGooseEnemyEnemyAI : EnemyAI
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass31_0
		{
			public MineshaftElevatorController elevatorScript;

			internal bool <StopUsingElevator>b__0()
			{
				if (elevatorScript.elevatorDoorOpen)
				{
					return elevatorScript.elevatorFinishedMoving;
				}
				return false;
			}
		}

		[CompilerGenerated]
		private sealed class <StopUsingElevator>d__31 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MineshaftElevatorController elevatorScript;

			public PjonkGooseEnemyEnemyAI <>4__this;

			private <>c__DisplayClass31_0 <>8__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <StopUsingElevator>d__31(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseEnemyEnemyAI pjonkGooseEnemyEnemyAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass31_0();
					<>8__1.elevatorScript = elevatorScript;
					pjonkGooseEnemyEnemyAI.usingElevator = true;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => <>8__1.elevatorScript.elevatorDoorOpen && <>8__1.elevatorScript.elevatorFinishedMoving));
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					Plugin.ExtendedLogging("Stopped using elevator");
					pjonkGooseEnemyEnemyAI.usingElevator = false;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public EnemyAI targetEnemy;

		public bool usingElevator;

		public Vector3 positionOfPlayerBeforeTeleport = Vector3.zero;

		public EntranceTeleport lastUsedEntranceTeleport;

		public Dictionary<EntranceTeleport, Transform[]> exitPoints = new Dictionary<EntranceTeleport, Transform[]>();

		public MineshaftElevatorController? elevatorScript;

		public override void Start()
		{
			((EnemyAI)this).Start();
		}

		[Conditional("DEBUG")]
		public void LogIfDebugBuild(object text)
		{
			Plugin.Logger.LogInfo(text);
		}

		[ClientRpc]
		public void SetFloatAnimationClientRpc(string name, float value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3904357172u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3904357172u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				SetFloatAnimationOnLocalClient(name, value);
			}
		}

		public void SetFloatAnimationOnLocalClient(string name, float value)
		{
			base.creatureAnimator.SetFloat(name, value);
		}

		[ClientRpc]
		public void SetBoolAnimationClientRpc(string name, bool active)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2481451427u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2481451427u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				SetBoolAnimationOnLocalClient(name, active);
			}
		}

		public void SetBoolAnimationOnLocalClient(string name, bool active)
		{
			base.creatureAnimator.SetBool(name, active);
		}

		[ServerRpc(RequireOwnership = false)]
		public void TriggerAnimationServerRpc(string triggerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2028302706u, val, (RpcDelivery)0);
				bool flag = triggerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(triggerName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2028302706u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				TriggerAnimationClientRpc(triggerName);
			}
		}

		[ClientRpc]
		public void TriggerAnimationClientRpc(string triggerName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2654770785u, val, (RpcDelivery)0);
				bool flag = triggerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(triggerName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2654770785u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				TriggerAnimationOnLocalClient(triggerName);
			}
		}

		public void TriggerAnimationOnLocalClient(string triggerName)
		{
			base.creatureAnimator.SetTrigger(triggerName);
		}

		public void ToggleEnemySounds(bool toggle)
		{
			((Behaviour)base.creatureSFX).enabled = toggle;
			((Behaviour)base.creatureVoice).enabled = toggle;
		}

		[ClientRpc]
		public void ChangeSpeedClientRpc(float speed)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1468592744u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref speed, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1468592744u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					ChangeSpeedOnLocalClient(speed);
				}
			}
		}

		public void ChangeSpeedOnLocalClient(float speed)
		{
			base.agent.speed = speed;
		}

		public bool FindClosestPlayerInRange(float range)
		{
			//IL_006f: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = null;
			float num = float.MaxValue;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val2 in allPlayerScripts)
			{
				if (((NetworkBehaviour)val2).IsSpawned && val2.isPlayerControlled && !val2.isPlayerDead && !val2.isInHangarShipRoom && EnemyHasLineOfSightToPosition(((Component)val2).transform.position, 60f, range))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
					if (num2 < num)
					{
						num = num2;
						val = val2;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			base.targetPlayer = val;
			return true;
		}

		public bool EnemyHasLineOfSightToPosition(Vector3 pos, float width = 60f, float range = 20f, float proximityAwareness = 5f)
		{
			//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_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)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.eye == (Object)null)
			{
				_ = ((Component)this).transform;
			}
			else
			{
				_ = base.eye;
			}
			if (Vector3.Distance(base.eye.position, pos) >= range || Physics.Linecast(base.eye.position, pos, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
			{
				return false;
			}
			Vector3 val = pos - base.eye.position;
			if (!(Vector3.Angle(base.eye.forward, val) < width))
			{
				return Vector3.Distance(((Component)this).transform.position, pos) < proximityAwareness;
			}
			return true;
		}

		public bool IsPlayerReachable(PlayerControllerB PlayerToCheck)
		{
			//IL_000b: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)PlayerToCheck).transform.position, RoundManager.Instance.navHit, 2.7f, -1);
			if (!RoundManager.Instance.GotNavMeshPositionResult)
			{
				return false;
			}
			base.agent.CalculatePath(navMeshPosition, base.agent.path);
			return (int)base.agent.path.status == 0;
		}

		public float PlayerDistanceFromShip(PlayerControllerB PlayerToCheck)
		{
			//IL_0015: 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)
			if ((Object)(object)PlayerToCheck == (Object)null)
			{
				return -1f;
			}
			return Vector3.Distance(((Component)PlayerToCheck).transform.position, ((Component)StartOfRound.Instance.shipBounds).transform.position);
		}

		private float DistanceFromPlayer(PlayerControllerB player, bool IncludeYAxis)
		{
			//IL_0036: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return -1f;
			}
			if (IncludeYAxis)
			{
				return Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position);
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(((Component)player).transform.position.x, ((Component)player).transform.position.z);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(((Component)this).transform.position.x, ((Component)this).transform.position.z);
			return Vector2.Distance(val, val2);
		}

		public bool AnimationIsFinished(string AnimName)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(AnimName))
			{
				return true;
			}
			currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
			return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f;
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetTargetServerRpc(int PlayerID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2676652769u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, PlayerID);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2676652769u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SetTargetClientRpc(PlayerID);
				}
			}
		}

		[ClientRpc]
		public void SetTargetClientRpc(int PlayerID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_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)
			//IL_00ce: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2379409763u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, PlayerID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2379409763u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (PlayerID == -1)
				{
					base.targetPlayer = null;
				}
				else if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[PlayerID] == (Object)null))
				{
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[PlayerID];
				}
			}
		}

		[ServerRpc]
		public void SetEnemyTargetServerRpc(int enemyID)
		{
			//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_0114: 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_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(1173269175u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, enemyID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1173269175u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				SetEnemyTargetClientRpc(enemyID);
			}
		}

		[ClientRpc]
		public void SetEnemyTargetClientRpc(int enemyID)
		{
			//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)
			//IL_00ce: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1630424606u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, enemyID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1630424606u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (enemyID == -1)
				{
					targetEnemy = null;
				}
				else if (!((Object)(object)RoundManager.Instance.SpawnedEnemies[enemyID] == (Object)null))
				{
					targetEnemy = RoundManager.Instance.SpawnedEnemies[enemyID];
				}
			}
		}

		public void GoThroughEntrance(bool followingPlayer)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_0049: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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)
			Vector3 val = Vector3.zero;
			Vector3 val2 = Vector3.zero;
			EntranceTeleport entranceTeleportToUse = null;
			if (followingPlayer)
			{
				EntranceTeleport val3 = null;
				foreach (EntranceTeleport key in exitPoints.Keys)
				{
					if ((Object)(object)val3 == (Object)null || Vector3.Distance(positionOfPlayerBeforeTeleport, ((Component)key).transform.position) < Vector3.Distance(positionOfPlayerBeforeTeleport, ((Component)val3).transform.position))
					{
						val3 = key;
					}
				}
				if ((Object)(object)val3 != (Object)null)
				{
					entranceTeleportToUse = val3;
					val = ((Component)val3.entrancePoint).transform.position;
					val2 = ((Component)val3.exitPoint).transform.position;
				}
			}
			else
			{
				entranceTeleportToUse = lastUsedEntranceTeleport;
				val = ((Component)lastUsedEntranceTeleport.exitPoint).transform.position;
				val2 = ((Component)lastUsedEntranceTeleport.entrancePoint).transform.position;
			}
			if ((Object)(object)elevatorScript != (Object)null && NeedsElevator(val, entranceTeleportToUse, elevatorScript))
			{
				UseTheElevator(elevatorScript);
			}
			else if (Vector3.Distance(((Component)this).transform.position, val) <= 3f)
			{
				lastUsedEntranceTeleport = entranceTeleportToUse;
				base.agent.Warp(val2);
				SetEnemyOutsideServerRpc(!base.isOutside);
			}
			else
			{
				base.agent.SetDestination(val);
			}
		}

		private bool NeedsElevator(Vector3 destination, EntranceTeleport entranceTeleportToUse, MineshaftElevatorController elevatorScript)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_0014: 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_0032: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Vector3.Distance(destination, RoundManager.FindMainEntrancePosition(true, false)) < Vector3.Distance(destination, ((Component)entranceTeleportToUse).transform.position);
			bool flag2 = Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position) < Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position);
			if (!base.isOutside)
			{
				if (!flag || flag2)
				{
					return !flag && flag2;
				}
				return true;
			}
			return false;
		}

		public void UseTheElevator(MineshaftElevatorController elevatorScript)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_002c: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorBottomPoint.position) < Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorTopPoint.position);
			if (elevatorScript.elevatorFinishedMoving)
			{
				if (elevatorScript.elevatorDoorOpen)
				{
					if (NeedToCallElevator(elevatorScript, flag))
					{
						elevatorScript.CallElevatorOnServer(flag);
						MoveToWaitingPoint(elevatorScript, flag);
					}
					else if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) > 1f)
					{
						base.agent.SetDestination(elevatorScript.elevatorInsidePoint.position);
					}
					else if (!usingElevator)
					{
						elevatorScript.PressElevatorButtonOnServer(true);
						((MonoBehaviour)this).StartCoroutine(StopUsingElevator(elevatorScript));
					}
				}
			}
			else
			{
				MoveToWaitingPoint(elevatorScript, flag);
			}
		}

		[IteratorStateMachine(typeof(<StopUsingElevator>d__31))]
		private IEnumerator StopUsingElevator(MineshaftElevatorController elevatorScript)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <StopUsingElevator>d__31(0)
			{
				<>4__this = this,
				elevatorScript = elevatorScript
			};
		}

		private bool NeedToCallElevator(MineshaftElevatorController elevatorScript, bool needToGoUp)
		{
			if (!elevatorScript.elevatorCalled)
			{
				if (!(!elevatorScript.elevatorIsAtBottom && needToGoUp))
				{
					if (elevatorScript.elevatorIsAtBottom)
					{
						return !needToGoUp;
					}
					return false;
				}
				return true;
			}
			return false;
		}

		private void MoveToWaitingPoint(MineshaftElevatorController elevatorScript, bool needToGoUp)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Distance(((Component)this).transform.position, elevatorScript.elevatorInsidePoint.position) > 1f)
			{
				base.agent.SetDestination(needToGoUp ? elevatorScript.elevatorBottomPoint.position : elevatorScript.elevatorTopPoint.position);
			}
			else
			{
				base.agent.SetDestination(elevatorScript.elevatorInsidePoint.position);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetEnemyOutsideServerRpc(bool setOutside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4276311489u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4276311489u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SetEnemyOutsideClientRpc(setOutside);
				}
			}
		}

		[ClientRpc]
		public void SetEnemyOutsideClientRpc(bool setOutside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2536352066u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOutside, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2536352066u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Plugin.ExtendedLogging("Setting enemy outside: " + setOutside);
					((EnemyAI)this).SetEnemyOutside(setOutside);
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3904357172u, new RpcReceiveHandler(__rpc_handler_3904357172), "SetFloatAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(2481451427u, new RpcReceiveHandler(__rpc_handler_2481451427), "SetBoolAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(2028302706u, new RpcReceiveHandler(__rpc_handler_2028302706), "TriggerAnimationServerRpc");
			((NetworkBehaviour)this).__registerRpc(2654770785u, new RpcReceiveHandler(__rpc_handler_2654770785), "TriggerAnimationClientRpc");
			((NetworkBehaviour)this).__registerRpc(1468592744u, new RpcReceiveHandler(__rpc_handler_1468592744), "ChangeSpeedClientRpc");
			((NetworkBehaviour)this).__registerRpc(2676652769u, new RpcReceiveHandler(__rpc_handler_2676652769), "SetTargetServerRpc");
			((NetworkBehaviour)this).__registerRpc(2379409763u, new RpcReceiveHandler(__rpc_handler_2379409763), "SetTargetClientRpc");
			((NetworkBehaviour)this).__registerRpc(1173269175u, new RpcReceiveHandler(__rpc_handler_1173269175), "SetEnemyTargetServerRpc");
			((NetworkBehaviour)this).__registerRpc(1630424606u, new RpcReceiveHandler(__rpc_handler_1630424606), "SetEnemyTargetClientRpc");
			((NetworkBehaviour)this).__registerRpc(4276311489u, new RpcReceiveHandler(__rpc_handler_4276311489), "SetEnemyOutsideServerRpc");
			((NetworkBehaviour)this).__registerRpc(2536352066u, new RpcReceiveHandler(__rpc_handler_2536352066), "SetEnemyOutsideClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_3904357172(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				float value = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).SetFloatAnimationClientRpc(name, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2481451427(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string name = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
				}
				bool active = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).SetBoolAnimationClientRpc(name, active);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2028302706(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string triggerName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref triggerName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).TriggerAnimationServerRpc(triggerName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2654770785(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string triggerName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref triggerName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).TriggerAnimationClientRpc(triggerName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2676652769(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 targetServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).SetTargetServerRpc(targetServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2379409763(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 targetClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).SetTargetClientRpc(targetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1173269175(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 enemyTargetServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref enemyTargetServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).SetEnemyTargetServerRpc(enemyTargetServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1630424606(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 enemyTargetClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref enemyTargetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PjonkGooseEnemyEnemyAI)(object)target).SetEnemyTargetClientRpc(enemyTargetClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PjonkGooseEnemyEnemyAI";
		}
	}
}
namespace PjonkGooseEnemy.EnemyStuff
{
	public class PjonkGooseAI : PjonkGooseEnemyEnemyAI
	{
		public enum State
		{
			Spawning,
			Wandering,
			Guarding,
			ChasingPlayer,
			Death,
			Stunned,
			Idle,
			DragPlayerBodyToNest
		}

		[CompilerGenerated]
		private sealed class <CalculateVelocity>d__48 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PjonkGooseAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CalculateVelocity>d__48(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//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_002b: 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_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: 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_005b: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI pjonkGooseAI = <>4__this;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
				}
				else
				{
					<>1__state = -1;
				}
				Vector3 position = ((Component)pjonkGooseAI).transform.position;
				pjonkGooseAI.velocity = Vector3.Distance(position, pjonkGooseAI.lastPosition) / pjonkGooseAI.deltaTime;
				pjonkGooseAI.lastPosition = position;
				<>2__current = (object)new WaitForSeconds(pjonkGooseAI.deltaTime);
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <DelayDroppingEgg>d__75 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PjonkGooseAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayDroppingEgg>d__75(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI pjonkGooseAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					pjonkGooseAI.DropEggClientRpc();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <DelayFindingGoldenEgg>d__54 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GoldenEgg _goldenEgg;

			public PjonkGooseAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayFindingGoldenEgg>d__54(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI pjonkGooseAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)_goldenEgg == (Object)null)
					{
						Plugin.Logger.LogError((object)"GoldenEgg spawned null");
						return false;
					}
					pjonkGooseAI.goldenEgg = _goldenEgg;
					if (((NetworkBehaviour)pjonkGooseAI).IsServer)
					{
						((Component)pjonkGooseAI.goldenEgg).transform.SetParent(StartOfRound.Instance.propsContainer, true);
					}
					Plugin.ExtendedLogging("Found egg in nest: " + ((GrabbableObject)pjonkGooseAI.goldenEgg).itemProperties.itemName);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <HideMessageAfterDelay>d__89 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float delay;

			private float <timer>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <HideMessageAfterDelay>d__89(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<timer>5__2 = 0f;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<timer>5__2 < delay)
				{
					HUDManager.Instance.HideHUD(false);
					<timer>5__2 += Time.fixedDeltaTime;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				HUDManager.Instance.HideHUD(true);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <PushTimer>d__47 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PjonkGooseAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PushTimer>d__47(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Expected O, but got Unknown
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI pjonkGooseAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0029;
				case 1:
					<>1__state = -1;
					pjonkGooseAI.pushingAway = false;
					<>2__current = (object)new WaitForSeconds(3f);
					<>1__state = 2;
					return true;
				case 2:
					{
						<>1__state = -1;
						goto IL_0029;
					}
					IL_0029:
					pjonkGooseAI.pushingAway = true;
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <RecentlyDamagedCooldown>d__71 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PjonkGooseAI <>4__this;

			public PlayerControllerB playerWhoHit;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RecentlyDamagedCooldown>d__71(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI pjonkGooseAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					pjonkGooseAI.recentlyDamaged = true;
					pjonkGooseAI.playerWhoLastHit = playerWhoHit;
					if (((NetworkBehaviour)pjonkGooseAI).IsHost)
					{
						pjonkGooseAI.SetTargetServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoHit));
					}
					<>2__current = (object)new WaitForSeconds((float)pjonkGooseAI.enemyRandom.Next(10, 15));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (((NetworkBehaviour)pjonkGooseAI).IsHost && ((EnemyAI)pjonkGooseAI).currentBehaviourStateIndex == 4 && ((EnemyAI)pjonkGooseAI).currentBehaviourStateIndex == 5)
					{
						pjonkGooseAI.PlayMiscSoundsServerRpc(1);
					}
					pjonkGooseAI.recentlyDamaged = false;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SpawnTimer>d__49 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PjonkGooseAI <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SpawnTimer>d__49(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI pjonkGooseAI = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!pjonkGooseAI.nestCreated)
					{
						pjonkGooseAI.SpawnNestServerRpc();
					}
					if (!pjonkGooseAI.goldenEggCreated)
					{
						pjonkGooseAI.SpawnEggInNestServerRpc();
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					if (((EnemyAI)pjonkGooseAI).currentBehaviourStateIndex == 5 || ((EnemyAI)pjonkGooseAI).currentBehaviourStateIndex == 3 || ((EnemyAI)pjonkGooseAI).currentBehaviourStateIndex == 4)
					{
						return false;
					}
					pjonkGooseAI.ControlStateSpeedAnimationServerRpc(5f, 1, startSearch: true, running: false, guarding: false, -1, delaySpeed: true, _isAggro: false);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <StunCooldown>d__61 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PjonkGooseAI <>4__this;

			public PlayerControllerB playerWhoStunned;

			public bool delaySpeed;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <StunCooldown>d__61(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				int num = <>1__state;
				PjonkGooseAI CS$<>8__locals0 = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => ((EnemyAI)CS$<>8__locals0).stunNormalizedTimer <= 0f));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (((EnemyAI)CS$<>8__locals0).isEnemyDead)
					{
						return false;
					}
					CS$<>8__locals0.SetTargetServerRpc(Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoStunned));
					CS$<>8__locals0.ControlStateSpeedAnimationServerRpc(20f, 3, startSearch: false, running: true, guarding: false, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, playerWhoStunned), delaySpeed, _isAggro: true);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private PlayerControllerB? playerWhoLastHit;

		private const float WALKING_SPEED = 5f;

		private const float SPRINTING_SPEED = 20f;

		private bool isAggro;

		private int playerHits;

		private bool carryingPlayerBody;

		private DeadBodyInfo? bodyBeingCarried;

		public AudioClip GuardHyperVentilateClip;

		public AudioClip[] HonkSounds;

		public AudioClip StartStunSound;

		public AudioClip EndStunSound;

		public AudioClip SpawnSound;

		public AudioClip HissSound;

		public AudioClip EnrageSound;

		public AudioClip[] FootstepSounds;

		public AudioClip[] ViolentFootstepSounds;

		public AudioClip[] featherSounds;

		public AudioClip[] hitSounds;

		public AudioClip[] deathSounds;

		public Transform TopOfBody;

		public GameObject nest;

		public ParticleSystem featherHitParticles;

		public AnimationClip stunAnimation;

		private bool inAggroAnimation;

		private bool canKillPjonk;

		private int hitPjonkCount;

		private GoldenEgg goldenEgg;

		private static int pjonkGooseCount;

		private float timeSinceHittingLocalPlayer;

		private float timeSinceAction;

		private bool holdingEgg;

		private bool recentlyDamaged;

		private bool nestCreated;

		private bool isNestInside = true;

		private Coroutine? recentlyDamagedCoroutine;

		private float collisionThresholdVelocity = 16f;

		private Random enemyRandom;

		private DoorLock[]? doors;

		private bool goldenEggCreated;

		private Vector3 lastPosition;

		private float velocity;

		private float deltaTime = 0.05f;

		[NonSerialized]
		public bool pushingAway;

		private Vector3 pointToGo = Vector3.zero;

		public override void OnDestroy()
		{
			((EnemyAI)this).OnDestroy();
			pjonkGooseCount--;
		}

		public void BaseOutsideOrInsideStart()
		{
			//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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_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)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[RoundManager.Instance.outsideAINodes.Length];
			for (int i = 0; i < RoundManager.Instance.outsideAINodes.Length; i++)
			{
				array[i] = RoundManager.Instance.outsideAINodes[i].transform.position;
			}
			Vector3[] array2 = (Vector3[])(object)new Vector3[RoundManager.Instance.insideAINodes.Length];
			for (int j = 0; j < RoundManager.Instance.insideAINodes.Length; j++)
			{
				array2[j] = RoundManager.Instance.insideAINodes[j].transform.position;
			}
			Vector3 position = ((Component)this).transform.position;
			Vector3 val = Vector3.positiveInfinity;
			Vector3 val2 = Vector3.positiveInfinity;
			Vector3 val3;
			for (int k = 0; k < array.Length; k++)
			{
				val3 = array[k] - position;
				float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
				val3 = val - position;
				if (sqrMagnitude < ((Vector3)(ref val3)).sqrMagnitude)
				{
					val = array[k];
				}
			}
			for (int l = 0; l < array2.Length; l++)
			{
				val3 = array2[l] - position;
				float sqrMagnitude2 = ((Vector3)(ref val3)).sqrMagnitude;
				val3 = val2 - position;
				if (sqrMagnitude2 < ((Vector3)(ref val3)).sqrMagnitude)
				{
					val2 = array2[l];
				}
			}
			if (!((EnemyAI)this).isOutside)
			{
				val3 = val - position;
				float sqrMagnitude3 = ((Vector3)(ref val3)).sqrMagnitude;
				val3 = val2 - position;
				if (sqrMagnitude3 < ((Vector3)(ref val3)).sqrMagnitude)
				{
					SetEnemyOutsideClientRpc(setOutside: true);
					((EnemyAI)this).favoriteSpot = nest.transform;
					return;
				}
			}
			if (((EnemyAI)this).isOutside)
			{
				val3 = val - position;
				float sqrMagnitude4 = ((Vector3)(ref val3)).sqrMagnitude;
				val3 = val2 - position;
				if (sqrMagnitude4 > ((Vector3)(ref val3)).sqrMagnitude)
				{
					SetEnemyOutsideClientRpc(setOutside: false);
					((EnemyAI)this).favoriteSpot = nest.transform;
				}
			}
		}

		public override void Start()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			base.Start();
			((EnemyAI)this).agent.areaMask = -1;
			NavMeshAgent agent = ((EnemyAI)this).agent;
			agent.radius /= 2f;
			((EnemyAI)this).agent.acceleration = 20f;
			((EnemyAI)this).creatureVoice.pitch = 1.4f;
			doors = Object.FindObjectsOfType<DoorLock>();
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + 323);
			timeSinceHittingLocalPlayer = 0f;
			timeSinceAction = 0f;
			((EnemyAI)this).creatureVoice.PlayOneShot(SpawnSound);
			pjonkGooseCount++;
			((EnemyAI)this).openDoorSpeedMultiplier = 0.5f;
			if (!((NetworkBehaviour)this).IsHost)
			{
				return;
			}
			lastPosition = ((Component)this).transform.position;
			((MonoBehaviour)this).StartCoroutine(CalculateVelocity());
			((MonoBehaviour)this).StartCoroutine(PushTimer());
			ControlStateSpeedAnimationServerRpc(0f, 0, startSearch: false, running: false, guarding: false, -1, delaySpeed: true, _isAggro: false);
			((MonoBehaviour)this).StartCoroutine(SpawnTimer());
			exitPoints = new Dictionary<EntranceTeleport, Transform[]>();
			EntranceTeleport[] array = Object.FindObjectsByType<EntranceTeleport>((FindObjectsInactive)0, (FindObjectsSortMode)1);
			foreach (EntranceTeleport val in array)
			{
				exitPoints.Add(val, (Transform[])(object)new Transform[2] { val.entrancePoint, val.exitPoint });
				if (val.isEntranceToBuilding)
				{
					lastUsedEntranceTeleport = val;
				}
				if (!val.FindExitPoint())
				{
					Plugin.Logger.LogError((object)"Something went wrong in the generation of the fire exits");
				}
			}
			elevatorScript = Object.FindObjectOfType<MineshaftElevatorController>();
		}

		[IteratorStateMachine(typeof(<PushTimer>d__47))]
		private IEnumerator PushTimer()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PushTimer>d__47(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<CalculateVelocity>d__48))]
		private IEnumerator CalculateVelocity()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CalculateVelocity>d__48(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<SpawnTimer>d__49))]
		public IEnumerator SpawnTimer()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SpawnTimer>d__49(0)
			{
				<>4__this = this
			};
		}

		[ServerRpc(RequireOwnership = false)]
		private void SpawnNestServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1312854404u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1312854404u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					nest = Object.Instantiate<GameObject>(nest, ((Component)this).transform.position + Vector3.down * 0.013f, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
					nest.GetComponent<NetworkObject>().Spawn(true);
					BaseOutsideOrInsideStart();
					SpawnNestClientRpc();
				}
			}
		}

		[ClientRpc]
		public void SpawnNestClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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 != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(347256692u, val, (RpcDelivery)0);
				((NetworkBehaviour)t