Decompiled source of LightEater v1.0.0

LightEater.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
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 LightEater.Managers;
using LightEater.NetcodePatcher;
using LightEater.Patches;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LightEater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LightEater")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4f6e7a3d-9f39-4466-b505-b6ce2e3133d4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LightEater
{
	public class Constants
	{
		public const string GLOBAL = "_Global_";

		public const string LIGHT_EATER = "Light Eater";
	}
	[BepInPlugin("Lega.LightEater", "Light Eater", "1.0.0")]
	public class LightEater : BaseUnityPlugin
	{
		private const string modGUID = "Lega.LightEater";

		private const string modName = "Light Eater";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Lega.LightEater");

		private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lighteater"));

		internal static ManualLogSource mls;

		public static ConfigFile configFile;

		public static List<RadMechAI> radMechAIs = new List<RadMechAI>();

		public static List<GrabbableObject> grabbableObjects = new List<GrabbableObject>();

		public void Awake()
		{
			mls = Logger.CreateLogSource("LightEater");
			configFile = ((BaseUnityPlugin)this).Config;
			ConfigManager.Load();
			NetcodePatcher();
			LoadEnemies();
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(GrabbableObjectPatch));
			harmony.PatchAll(typeof(RadMechAIPatch));
		}

		private static void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public static void LoadEnemies()
		{
			EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LightEater/LightEaterEnemy.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, ConfigManager.rarity.Value, (LevelTypes)(-1), (TerminalNode)null, (TerminalKeyword)null);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LightEater";

		public const string PLUGIN_NAME = "LightEater";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LightEater.Patches
{
	internal class GrabbableObjectPatch
	{
		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		[HarmonyPostfix]
		private static void StartGame(ref GrabbableObject __instance)
		{
			RoundManagerPatch.AddGrabbableObject(__instance);
		}
	}
	internal class RadMechAIPatch
	{
		[HarmonyPatch(typeof(RadMechAI), "Start")]
		[HarmonyPostfix]
		private static void StartGame(ref RadMechAI __instance)
		{
			RoundManagerPatch.AddRadMech(__instance);
		}
	}
	internal class RoundManagerPatch
	{
		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPostfix]
		private static void StartGame()
		{
			LightEater.radMechAIs.Clear();
			RadMechAI[] array = Object.FindObjectsOfType<RadMechAI>();
			foreach (RadMechAI radMech in array)
			{
				AddRadMech(radMech);
			}
			LightEater.grabbableObjects.Clear();
			GrabbableObject[] array2 = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject grabbableObject in array2)
			{
				AddGrabbableObject(grabbableObject);
			}
		}

		public static void AddRadMech(RadMechAI radMech)
		{
			if (!LightEater.radMechAIs.Contains(radMech))
			{
				LightEater.radMechAIs.Add(radMech);
			}
		}

		public static void AddGrabbableObject(GrabbableObject grabbableObject)
		{
			if (grabbableObject.itemProperties.requiresBattery && !LightEater.grabbableObjects.Contains(grabbableObject))
			{
				LightEater.grabbableObjects.Add(grabbableObject);
			}
		}
	}
}
namespace LightEater.Managers
{
	public class ConfigManager
	{
		public static ConfigEntry<int> rarity;

		public static ConfigEntry<float> huntingSpeed;

		public static ConfigEntry<float> chasingSpeed;

		public static ConfigEntry<int> damage;

		public static ConfigEntry<float> lightCharge;

		public static ConfigEntry<float> itemCharge;

		public static ConfigEntry<float> oldBirdCharge;

		public static void Load()
		{
			rarity = LightEater.configFile.Bind<int>("_Global_", "Rarity", 50, "Light Eater rarity");
			huntingSpeed = LightEater.configFile.Bind<float>("_Global_", "Hunting speed", 3f, "Light Eater speed when it moves towards a light");
			chasingSpeed = LightEater.configFile.Bind<float>("_Global_", "Chasing speed", 4f, "Light Eater speed when it moves towards a player");
			damage = LightEater.configFile.Bind<int>("_Global_", "Damage", 20, "Light Eater damage");
			lightCharge = LightEater.configFile.Bind<float>("_Global_", "Light charge", 0.2f, "Electric charge received upon absorption of a dungeon light");
			itemCharge = LightEater.configFile.Bind<float>("_Global_", "Item charge", 0.2f, "Electric charge received upon absorption of an item");
			oldBirdCharge = LightEater.configFile.Bind<float>("_Global_", "Old Bird charge", 1f, "Electric charge received upon absorption of an Old Bird");
		}
	}
}
namespace LightEater.Behaviours
{
	public class LightEaterAI : EnemyAI
	{
		public enum State
		{
			WANDERING,
			HUNTING,
			ABSORBING,
			CHASING
		}

		public float currentCharge;

		public Transform TurnCompass;

		public AudioClip[] MoveSounds = Array.Empty<AudioClip>();

		public AudioClip AbsorptionSound;

		public AudioClip SwingSound;

		public AudioClip ChargeSound;

		public AudioClip ExplosionSound;

		public float moveTimer;

		public List<EntranceTeleport> entrances;

		public GameObject closestLightSource;

		private float explodeTimer;

		public bool absorbPlayerObject;

		public Coroutine absorbLightCoroutine;

		public Coroutine attackCoroutine;

		public override void Start()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			base.creatureAnimator.SetTrigger("startWalk");
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			entrances = Object.FindObjectsOfType<EntranceTeleport>().ToList();
		}

		public override void Update()
		{
			//IL_0062: 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_0088: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				explodeTimer += Time.deltaTime;
				PlayMoveSound();
				int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
				if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 3)
				{
					TurnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
					((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, TurnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
				}
			}
		}

		public void PlayMoveSound()
		{
			if (base.currentBehaviourStateIndex != 2)
			{
				moveTimer -= Time.deltaTime;
				if (MoveSounds.Length != 0 && moveTimer <= 0f)
				{
					base.creatureSFX.PlayOneShot(MoveSounds[Random.Range(0, MoveSounds.Length)]);
					moveTimer = 3f;
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 2f;
				if (FoundClosestPlayerInRange(25f, 10f))
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					DoAnimationClientRpc("startRun");
					((EnemyAI)this).SwitchToBehaviourClientRpc(3);
				}
				else if (FoundLightSource())
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					DoAnimationClientRpc("startRun");
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				base.agent.speed = ConfigManager.huntingSpeed.Value;
				if (FoundClosestPlayerInRange(25f, 10f))
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(3);
				}
				else if (CloseToLightSource())
				{
					DoAnimationClientRpc("startAbsorb");
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
				break;
			case 2:
				base.agent.speed = 0f;
				if ((Object)(object)closestLightSource == (Object)null)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					DoAnimationClientRpc("startWalk");
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					AbsorbLight();
				}
				break;
			case 3:
				base.agent.speed = ConfigManager.chasingSpeed.Value;
				if (TargetOutsideChasedPlayer())
				{
					break;
				}
				if (explodeTimer < 10f)
				{
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
				}
				else if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					DoAnimationClientRpc("startWalk");
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else if (!StunExplosion())
				{
					if (AbsorbPlayerObject() || CrossingLight())
					{
						absorbPlayerObject = false;
						DoAnimationClientRpc("startAbsorb");
						((EnemyAI)this).SwitchToBehaviourClientRpc(2);
					}
					else
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
					}
				}
				break;
			}
		}

		public bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				range = senseRange;
			}
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				return Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
			}
			return false;
		}

		public bool FoundLightSource()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			if (CrossingLight())
			{
				return true;
			}
			if (LightEater.radMechAIs.Any((RadMechAI r) => !((EnemyAI)r).isEnemyDead))
			{
				closestLightSource = ((Component)(from r in LightEater.radMechAIs
					where !((EnemyAI)r).isEnemyDead
					orderby Vector3.Distance(((Component)this).transform.position, ((Component)r).transform.position)
					select r).FirstOrDefault()).gameObject;
			}
			else if (!base.isOutside)
			{
				base.path1 = new NavMeshPath();
				closestLightSource = ((Component)(from l in RoundManager.Instance.allPoweredLightsAnimators
					where base.agent.CalculatePath(((EnemyAI)this).ChooseClosestNodeToPosition(((Component)l).transform.position, false, 0).position, base.path1)
					orderby Vector3.Distance(((Component)this).transform.position, ((Component)l).transform.position)
					select l).FirstOrDefault()).gameObject;
			}
			else
			{
				closestLightSource = ((Component)RoundManager.Instance.allPoweredLightsAnimators.OrderBy((Animator l) => Vector3.Distance(GetEntranceExitPosition(GetClosestEntrance()), ((Component)l).transform.position)).FirstOrDefault()).gameObject;
			}
			return (Object)(object)closestLightSource != (Object)null;
		}

		public bool CrossingLight()
		{
			Animator? obj = ((IEnumerable<Animator>)RoundManager.Instance.allPoweredLightsAnimators).FirstOrDefault((Func<Animator, bool>)((Animator l) => Vector3.Distance(((Component)this).transform.position, ((Component)l).transform.position) <= 10f));
			object obj2 = ((obj != null) ? ((Component)obj).gameObject : null);
			if (obj2 == null)
			{
				GrabbableObject? obj3 = ((IEnumerable<GrabbableObject>)LightEater.grabbableObjects).FirstOrDefault((Func<GrabbableObject, bool>)((GrabbableObject g) => g.insertedBattery.charge > 0f && Vector3.Distance(((Component)this).transform.position, ((Component)g).transform.position) <= 10f));
				obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
			}
			closestLightSource = (GameObject)obj2;
			return (Object)(object)closestLightSource != (Object)null;
		}

		public bool CloseToLightSource()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			object obj = DetermineLightSource();
			if ((obj is RadMechAI && !base.isOutside) || (obj is Animator && base.isOutside))
			{
				GoTowardsEntrance();
				return false;
			}
			Vector3 val = ((obj is RadMechAI) ? closestLightSource.transform.position : ((EnemyAI)this).ChooseClosestNodeToPosition(closestLightSource.transform.position, false, 0).position);
			((EnemyAI)this).SetDestinationToPosition(val, false);
			if (!(Vector3.Distance(((Component)base.eye).transform.position, closestLightSource.transform.position) < 5f))
			{
				return Vector3.Distance(((Component)this).transform.position, val) < 1f;
			}
			return true;
		}

		public void AbsorbLight()
		{
			//IL_0037: 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)
			if (absorbLightCoroutine == null)
			{
				NetworkObject component = closestLightSource.GetComponent<NetworkObject>();
				if ((Object)(object)component != (Object)null)
				{
					AbsorbLightClientRpc(NetworkObjectReference.op_Implicit(component));
				}
				else
				{
					AbsorbLightClientRpc(closestLightSource.transform.position);
				}
			}
		}

		[ClientRpc]
		public void AbsorbLightClientRpc(NetworkObjectReference obj)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3900372421u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3900372421u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				closestLightSource = ((Component)val3).gameObject;
				if (absorbLightCoroutine == null)
				{
					absorbLightCoroutine = ((MonoBehaviour)this).StartCoroutine(AbsorbLightCoroutine());
				}
			}
		}

		[ClientRpc]
		public void AbsorbLightClientRpc(Vector3 position)
		{
			//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_0089: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(281305429u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 281305429u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Vector3 position2 = position;
				closestLightSource = ((Component)RoundManager.Instance.allPoweredLightsAnimators.OrderBy((Animator l) => Vector3.Distance(position2, ((Component)l).transform.position)).FirstOrDefault()).gameObject;
				if (absorbLightCoroutine == null)
				{
					absorbLightCoroutine = ((MonoBehaviour)this).StartCoroutine(AbsorbLightCoroutine());
				}
			}
		}

		public IEnumerator AbsorbLightCoroutine()
		{
			bool isAbsorbed = true;
			float absorbDuration = 5f;
			float timePassed = 0f;
			object lightSource = DetermineLightSource();
			base.creatureSFX.PlayOneShot(AbsorptionSound);
			FlashlightItem flashlight = (FlashlightItem)((lightSource is FlashlightItem) ? lightSource : null);
			GrabbableObject val = (GrabbableObject)((lightSource is GrabbableObject) ? lightSource : null);
			if (val != null)
			{
				absorbDuration *= val.insertedBattery.charge;
				if ((Object)(object)flashlight != (Object)null)
				{
					flashlight.flashlightAudio.PlayOneShot(flashlight.flashlightFlicker);
					WalkieTalkie.TransmitOneShotAudio(flashlight.flashlightAudio, flashlight.flashlightFlicker, 0.8f);
					flashlight.flashlightInterferenceLevel = 1;
				}
			}
			while (timePassed < absorbDuration)
			{
				yield return (object)new WaitForSeconds(0.5f);
				timePassed += 0.5f;
				if (!HandleLightConsumption(lightSource, absorbDuration, timePassed))
				{
					isAbsorbed = false;
					break;
				}
			}
			if ((Object)(object)flashlight != (Object)null)
			{
				flashlight.flashlightInterferenceLevel = 0;
			}
			if (isAbsorbed)
			{
				HandleLightDepletion(lightSource);
			}
			closestLightSource = null;
			absorbLightCoroutine = null;
		}

		public object DetermineLightSource()
		{
			GrabbableObject result = default(GrabbableObject);
			if (closestLightSource.TryGetComponent<GrabbableObject>(ref result))
			{
				return result;
			}
			RadMechAI componentInParent = closestLightSource.GetComponentInParent<RadMechAI>();
			if (componentInParent != null)
			{
				return componentInParent;
			}
			return ((IEnumerable<Animator>)RoundManager.Instance.allPoweredLightsAnimators).FirstOrDefault((Func<Animator, bool>)((Animator l) => (Object)(object)((Component)l).gameObject == (Object)(object)closestLightSource));
		}

		public bool HandleLightConsumption(object lightSource, float absorbDuration, float timePassed)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			RadMechAI val = (RadMechAI)((lightSource is RadMechAI) ? lightSource : null);
			if (val == null)
			{
				GrabbableObject val2 = (GrabbableObject)((lightSource is GrabbableObject) ? lightSource : null);
				if (val2 == null)
				{
					Animator val3 = (Animator)((lightSource is Animator) ? lightSource : null);
					if (val3 != null && val3 != null)
					{
						val3.SetTrigger("Flicker");
					}
					return true;
				}
				val2.insertedBattery.charge = Mathf.Max(0f, 1f - (timePassed + (5f - absorbDuration)) / 5f);
				if (Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position) > 15f)
				{
					return !(val2.insertedBattery.charge > 0f);
				}
				return true;
			}
			val.FlickerFace();
			if (!((EnemyAI)val).isEnemyDead)
			{
				return !val.inFlyingMode;
			}
			return false;
		}

		public void HandleLightDepletion(object lightSource)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			RadMechAI val = (RadMechAI)((lightSource is RadMechAI) ? lightSource : null);
			if (val == null)
			{
				GrabbableObject val2 = (GrabbableObject)((lightSource is GrabbableObject) ? lightSource : null);
				if (val2 == null)
				{
					if (!(lightSource is Animator))
					{
						return;
					}
					currentCharge += ConfigManager.lightCharge.Value;
					Animator val3 = (Animator)((lightSource is Animator) ? lightSource : null);
					if (val3 != null)
					{
						val3.SetBool("on", false);
						RoundManager.Instance.allPoweredLightsAnimators.RemoveAll((Animator l) => (Object)(object)((Component)l).gameObject == (Object)(object)closestLightSource);
					}
				}
				else
				{
					currentCharge += ConfigManager.itemCharge.Value;
				}
			}
			else
			{
				currentCharge += ConfigManager.oldBirdCharge.Value;
				if (((NetworkBehaviour)this).IsOwner && !((EnemyAI)val).isEnemyDead)
				{
					GameObject val4 = Object.Instantiate<GameObject>(((EnemyAI)val).enemyType.nestSpawnPrefab, ((Component)val).transform.position, ((Component)val).transform.rotation);
					val4.GetComponentInChildren<NetworkObject>().Spawn(true);
					LightEater.radMechAIs.Remove(val);
					((EnemyAI)val).KillEnemyOnOwnerClient(true);
				}
			}
		}

		public bool TargetOutsideChasedPlayer()
		{
			if (base.targetPlayer.isInsideFactory == base.isOutside)
			{
				GoTowardsEntrance();
				return true;
			}
			return false;
		}

		public bool TargetClosestPlayerInAnyCase()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return true;
		}

		public bool AbsorbPlayerObject()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 15f)
			{
				return false;
			}
			if (absorbPlayerObject)
			{
				return true;
			}
			AbsorbPlayerObjectClientRpc((int)base.targetPlayer.playerClientId);
			return absorbPlayerObject;
		}

		[ClientRpc]
		public void AbsorbPlayerObjectClientRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1373637753u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1373637753u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return;
			}
			for (int i = 0; i < component.ItemSlots.Length; i++)
			{
				GrabbableObject val3 = component.ItemSlots[i];
				if ((Object)(object)val3 != (Object)null && val3.itemProperties.requiresBattery && val3.insertedBattery.charge > 0f)
				{
					closestLightSource = ((Component)val3).gameObject;
					break;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AbsorbPlayerObjectServerRpc(NetworkObjectReference obj)
		{
			//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)
			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(330733170u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 330733170u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
				{
					absorbPlayerObject = true;
					closestLightSource = ((Component)val3).gameObject;
				}
			}
		}

		public bool StunExplosion()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			if (currentCharge < 1f || explodeTimer < 10f)
			{
				return false;
			}
			if (!base.targetPlayer.HasLineOfSightToPosition(base.eye.position, 60f, 15, -1f))
			{
				return false;
			}
			base.agent.speed = 0f;
			currentCharge -= 1f;
			explodeTimer = 0f;
			StunExplosionClientRpc();
			return true;
		}

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

		public IEnumerator StunExplosionCoroutine()
		{
			base.creatureAnimator.SetTrigger("startExplode");
			base.creatureSFX.PlayOneShot(ChargeSound);
			yield return (object)new WaitForSeconds(0.75f);
			base.creatureSFX.PlayOneShot(ExplosionSound);
			StunGrenadeItem.StunExplosion(base.eye.position, true, 9999f, 2f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f);
			base.creatureAnimator.SetTrigger("startRun");
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (base.currentBehaviourStateIndex == 3 && attackCoroutine == null)
			{
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					AttackServerRpc((int)val.playerClientId);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AttackServerRpc(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)
			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(3866375404u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3866375404u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AttackClientRpc(playerId);
				}
			}
		}

		[ClientRpc]
		public void AttackClientRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1596026719u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1596026719u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && attackCoroutine == null)
				{
					attackCoroutine = ((MonoBehaviour)this).StartCoroutine(AttackCoroutine(StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>()));
				}
			}
		}

		public IEnumerator AttackCoroutine(PlayerControllerB player)
		{
			base.creatureAnimator.SetTrigger("startAttack");
			base.creatureSFX.PlayOneShot(SwingSound);
			yield return (object)new WaitForSeconds(0.8f);
			player.DamagePlayer(ConfigManager.damage.Value, true, true, (CauseOfDeath)8, 0, false, default(Vector3));
			base.creatureAnimator.SetTrigger("startRun");
			attackCoroutine = null;
		}

		public void GoTowardsEntrance()
		{
			//IL_000d: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			EntranceTeleport closestEntrance = GetClosestEntrance();
			if (Vector3.Distance(((Component)this).transform.position, closestEntrance.entrancePoint.position) < 1f)
			{
				Vector3 entranceExitPosition = GetEntranceExitPosition(closestEntrance);
				TeleportEnemyClientRpc(entranceExitPosition, !base.isOutside);
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(closestEntrance.entrancePoint.position, false);
			}
		}

		public EntranceTeleport GetClosestEntrance()
		{
			return (from e in entrances
				where e.isEntranceToBuilding == base.isOutside
				orderby Vector3.Distance(((Component)this).transform.position, e.entrancePoint.position)
				select e).FirstOrDefault();
		}

		public Vector3 GetEntranceExitPosition(EntranceTeleport entranceTeleport)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			return ((IEnumerable<EntranceTeleport>)entrances).FirstOrDefault((Func<EntranceTeleport, bool>)((EntranceTeleport e) => e.isEntranceToBuilding != entranceTeleport.isEntranceToBuilding && e.entranceId == entranceTeleport.entranceId)).entrancePoint.position;
		}

		[ClientRpc]
		public void TeleportEnemyClientRpc(Vector3 teleportPosition, bool isOutside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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)
			//IL_00f7: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3427173509u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref teleportPosition);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isOutside, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3427173509u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((EnemyAI)this).SetEnemyOutside(isOutside);
					base.serverPosition = teleportPosition;
					((Component)this).transform.position = teleportPosition;
					base.agent.Warp(teleportPosition);
					((EnemyAI)this).SyncPositionToClients();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DoAnimationServerRpc(string animationState)
		{
			//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_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(1228153506u, val, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1228153506u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DoAnimationClientRpc(animationState);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(string animationState)
		{
			//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_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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2154635945u, val, (RpcDelivery)0);
				bool flag = animationState != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationState, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2154635945u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.creatureAnimator.SetTrigger(animationState);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LightEaterAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3900372421u, new RpcReceiveHandler(__rpc_handler_3900372421));
			NetworkManager.__rpc_func_table.Add(281305429u, new RpcReceiveHandler(__rpc_handler_281305429));
			NetworkManager.__rpc_func_table.Add(1373637753u, new RpcReceiveHandler(__rpc_handler_1373637753));
			NetworkManager.__rpc_func_table.Add(330733170u, new RpcReceiveHandler(__rpc_handler_330733170));
			NetworkManager.__rpc_func_table.Add(2969224247u, new RpcReceiveHandler(__rpc_handler_2969224247));
			NetworkManager.__rpc_func_table.Add(3866375404u, new RpcReceiveHandler(__rpc_handler_3866375404));
			NetworkManager.__rpc_func_table.Add(1596026719u, new RpcReceiveHandler(__rpc_handler_1596026719));
			NetworkManager.__rpc_func_table.Add(3427173509u, new RpcReceiveHandler(__rpc_handler_3427173509));
			NetworkManager.__rpc_func_table.Add(1228153506u, new RpcReceiveHandler(__rpc_handler_1228153506));
			NetworkManager.__rpc_func_table.Add(2154635945u, new RpcReceiveHandler(__rpc_handler_2154635945));
		}

		private static void __rpc_handler_3900372421(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LightEaterAI)(object)target).AbsorbLightClientRpc(obj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_281305429(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LightEaterAI)(object)target).AbsorbLightClientRpc(position);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1373637753(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LightEaterAI)(object)target).AbsorbPlayerObjectClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		private static void __rpc_handler_3866375404(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LightEaterAI)(object)target).AttackServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1596026719(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LightEaterAI)(object)target).AttackClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3427173509(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 teleportPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref teleportPosition);
				bool isOutside = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isOutside, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LightEaterAI)(object)target).TeleportEnemyClientRpc(teleportPosition, isOutside);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1228153506(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 animationState = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationState, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LightEaterAI)(object)target).DoAnimationServerRpc(animationState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2154635945(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 animationState = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref animationState, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LightEaterAI)(object)target).DoAnimationClientRpc(animationState);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LightEaterAI";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace LightEater.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}