Decompiled source of Moonswept v1.0.0

Moonswept.dll

Decompiled a week ago
using System;
using System.Diagnostics;
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 Microsoft.CodeAnalysis;
using MonoMod.Utils;
using Moonswept.Config;
using MoonsweptTeam.Moonswept.NetcodePatcher;
using TestAccountCore;
using TestAccountCore.Dependencies;
using TestAccountCore.Dependencies.Compatibility;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[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: AssemblyCompany("MoonsweptTeam.Moonswept")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A variety content mod for Lethal Company. Currently adding 2 enemies.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+39580e51380c2e1ec951cd3d2692569e62b5bf41")]
[assembly: AssemblyProduct("Moonswept")]
[assembly: AssemblyTitle("MoonsweptTeam.Moonswept")]
[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.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 Moonswept
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency("TestAccount666.TestAccountCore", "1.13.0")]
	[BepInPlugin("MoonsweptTeam.Moonswept", "Moonswept", "1.0.0")]
	public class Moonswept : BaseUnityPlugin
	{
		public static Moonswept Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("MoonsweptTeam.Moonswept");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			if (DependencyChecker.IsLobbyCompatibilityInstalled())
			{
				Logger.LogInfo((object)"Found LobbyCompatibility Mod, initializing support :)");
				LobbyCompatibilitySupport.Initialize("MoonsweptTeam.Moonswept", "1.0.0", (CompatibilityLevel)2, (VersionStrictness)2);
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			Netcode.ExecuteNetcodePatcher(executingAssembly);
			AssetLoader.LoadBundle(executingAssembly, "Moonswept");
			AssetLoader.LoadEnemies(((BaseUnityPlugin)this).Config);
			MoonsweptConfig.InitializeConfigs(((BaseUnityPlugin)this).Config);
			Patch();
			Logger.LogInfo((object)"MoonsweptTeam.Moonswept v1.0.0 has loaded!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoonsweptTeam.Moonswept";

		public const string PLUGIN_NAME = "Moonswept";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Moonswept.Enemies.MovingTurret
{
	public class MovingTurret : EnemyAI
	{
		private enum BehaviourState
		{
			PATROLLING,
			CHASING,
			SPOTTED_PLAYER,
			FIRING
		}

		public Transform aimTarget;

		public ParticleSystem gunshots;

		public AudioSource source;

		public AudioSource seePlayerSource;

		public Light searchLight;

		private Vector3 _targetLastSeenAt;

		private float _lockOnTimer;

		private float _firingTimer;

		private float _firingDelay;

		private bool _isDoingGunshots;

		private PlayerControllerB _lastTarget;

		private const float _VIEW_DISTANCE = 8f;

		private const float _BULLET_FIRE_WIDTH = 25f;

		private const int _DAMAGE_AMOUNT = 15;

		private const float _DEFAULT_SPEED = 2f;

		private const float _CHASE_SPEED = 14f;

		private const float _WIDTH_FOV = 80f;

		private const float _FIRE_DELAY = 0.21f;

		private const float _LOCK_ON_TIME = 1f;

		private const float _TURN_SPEED = 4f;

		public override void Start()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			((EnemyAI)this).SwitchToBehaviourState(0);
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			source.Play();
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				return;
			}
			((Component)searchLight).gameObject.SetActive(base.currentBehaviourStateIndex == 2);
			if (base.stunNormalizedTimer >= 0f)
			{
				base.agent.speed = 0f;
				return;
			}
			if (base.currentBehaviourStateIndex != 3 && Object.op_Implicit((Object)(object)base.targetPlayer))
			{
				AimAtTarget();
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((uint)currentBehaviourStateIndex <= 1u)
			{
				ResetAim();
			}
			HandleGunshots();
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead)
			{
				switch ((BehaviourState)base.currentBehaviourStateIndex)
				{
				case BehaviourState.PATROLLING:
					DoPatrollingInterval();
					break;
				case BehaviourState.SPOTTED_PLAYER:
					DoSpottedPlayerInterval();
					break;
				case BehaviourState.CHASING:
					DoChasingInterval();
					break;
				case BehaviourState.FIRING:
					DoFiringInterval();
					break;
				default:
					Moonswept.Logger.LogWarning((object)$"Unexpected behavior state '{base.currentBehaviourStateIndex}'!");
					break;
				}
			}
		}

		private void AimAtTarget()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			aimTarget.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(0f, aimTarget.eulerAngles.y, 0f), 4f * Time.fixedDeltaTime);
		}

		private void ResetAim()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = _targetLastSeenAt;
			if (val == Vector3.zero)
			{
				val = base.agent.steeringTarget;
			}
			aimTarget.LookAt(val);
			((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(0f, aimTarget.eulerAngles.y, 0f), 4f * Time.fixedDeltaTime);
		}

		private void HandleGunshots()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			if (!_isDoingGunshots)
			{
				return;
			}
			_firingDelay += Time.fixedDeltaTime;
			if (!(_firingDelay < 0.21f))
			{
				_firingDelay = 0f;
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (!((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(25f, 60, -1) != (Object)(object)localPlayerController) && !Physics.Linecast(base.eye.position, ((Component)localPlayerController).transform.position, 512, (QueryTriggerInteraction)2))
				{
					localPlayerController.DamagePlayer(15, true, true, (CauseOfDeath)7, 0, false, default(Vector3));
				}
			}
		}

		private void DoPatrollingInterval()
		{
			//IL_0037: 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)
			base.agent.speed = 2f;
			if (((EnemyAI)this).TargetClosestPlayer(8f, true, 70f))
			{
				if (Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) > 8f)
				{
					base.targetPlayer = null;
					return;
				}
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				_lastTarget = base.targetPlayer;
				((EnemyAI)this).SwitchToBehaviourState(1);
			}
		}

		private void DoSpottedPlayerInterval()
		{
			base.agent.speed = 0f;
			_lockOnTimer += base.AIIntervalTime;
			if (!(_lockOnTimer < 1f))
			{
				_lockOnTimer = 0f;
				StartGunshotsClientRpc();
				((EnemyAI)this).SwitchToBehaviourState(3);
			}
		}

		private void DoChasingInterval()
		{
			//IL_0013: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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)
			base.agent.speed = 14f;
			if (_targetLastSeenAt != Vector3.zero)
			{
				((EnemyAI)this).SetDestinationToPosition(_targetLastSeenAt, false);
			}
			if (Object.op_Implicit((Object)(object)base.targetPlayer))
			{
				_targetLastSeenAt = ((Component)base.targetPlayer).transform.position;
			}
			bool flag = !((EnemyAI)this).TargetClosestPlayer(8f, true, 70f) || Physics.Linecast(base.eye.position, ((Component)base.targetPlayer).transform.position, 512, (QueryTriggerInteraction)2);
			bool flag2 = !flag;
			bool flag3 = !Object.op_Implicit((Object)(object)_lastTarget) || !((EnemyAI)this).CheckLineOfSightForPosition(((Component)_lastTarget).transform.position, 80f, 60, -1f, (Transform)null) || Physics.Linecast(base.eye.position, ((Component)_lastTarget).transform.position, 512, (QueryTriggerInteraction)2);
			bool flag4 = !flag3;
			if (flag4)
			{
				base.targetPlayer = _lastTarget;
			}
			if (flag4 || flag2)
			{
				_lockOnTimer = 0f;
				((EnemyAI)this).SwitchToBehaviourState(2);
			}
			else if (!(_targetLastSeenAt != Vector3.zero) || !(Vector3.Distance(_targetLastSeenAt, ((Component)this).transform.position) >= 3f))
			{
				_targetLastSeenAt = Vector3.zero;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourState(0);
			}
		}

		private void DoFiringInterval()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = 0f;
			_firingTimer += base.AIIntervalTime;
			if (!(_firingTimer < 2f))
			{
				_firingTimer = 0f;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourState(1);
				StopGunshotsClientRpc();
			}
		}

		[ClientRpc]
		private void StartGunshotsClientRpc()
		{
			//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(2056167209u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2056167209u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					gunshots.Play();
					_isDoingGunshots = true;
					_firingDelay = 0f;
				}
			}
		}

		[ClientRpc]
		private void StopGunshotsClientRpc()
		{
			//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(3192524290u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3192524290u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					gunshots.Stop();
					_isDoingGunshots = false;
					_firingDelay = 0f;
				}
			}
		}

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

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

		private static void __rpc_handler_2056167209(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;
				((MovingTurret)(object)target).StartGunshotsClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3192524290(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;
				((MovingTurret)(object)target).StopGunshotsClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "MovingTurret";
		}
	}
}
namespace Moonswept.Enemies.CleaningDrone
{
	public class CleaningDroneAI : EnemyAI
	{
		public enum BehaviourState
		{
			WANDER,
			RETREAT
		}

		public Transform modelRoot;

		public AnimationCurve movement;

		public float rotationSpeed;

		private float _movementStopwatch;

		private Transform _currentTargetNode;

		private Vector3 _initialPos;

		public GameObject fogPrefab;

		private float _gasStopwatch;

		private const float _GAS_DISPENSE_INTERVAL = 0.5f;

		private const float _DEFAULT_SPEED = 2f;

		private const float _RETREAT_SPEED = 14f;

		public override void Start()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_0023: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			((Component)modelRoot).transform.Rotate(new Vector3(0f, rotationSpeed, 0f) * Time.fixedDeltaTime);
			_movementStopwatch += Time.fixedDeltaTime;
			if (_movementStopwatch >= 4f)
			{
				_movementStopwatch = 0f;
			}
			((Component)modelRoot).transform.localPosition = new Vector3(0f, 8.24f + movement.Evaluate(_movementStopwatch) * 4f, 0f);
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (!base.isEnemyDead)
			{
				_gasStopwatch += base.AIIntervalTime;
				if (_gasStopwatch >= 0.5f)
				{
					_gasStopwatch = 0f;
					SpawnFogClientRpc();
				}
				switch ((BehaviourState)base.currentBehaviourStateIndex)
				{
				case BehaviourState.WANDER:
					base.agent.speed = 2f;
					break;
				case BehaviourState.RETREAT:
					DoRetreatInterval();
					break;
				default:
					Moonswept.Logger.LogWarning((object)$"Unexpected behavior state: {base.currentBehaviourStateIndex}");
					break;
				}
			}
		}

		public void DoRetreatInterval()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_007b: 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)
			base.agent.speed = 14f;
			float num = Vector3.Distance(_initialPos, _currentTargetNode.position);
			float num2 = Vector3.Distance(((Component)this).transform.position, _currentTargetNode.position);
			if (num2 / num <= 0.4f)
			{
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourState(0);
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(_currentTargetNode.position, false);
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSfx = false, int hitID = -1)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSfx, hitID);
			((EnemyAI)this).StopSearch(base.currentSearch, true);
			((EnemyAI)this).SwitchToBehaviourState(1);
			_initialPos = ((Component)this).transform.position;
			_currentTargetNode = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, false);
			base.enemyHP -= force;
			if (base.enemyHP <= 0)
			{
				((EnemyAI)this).KillEnemyClientRpc(true);
			}
		}

		[ClientRpc]
		public void SpawnFogClientRpc()
		{
			//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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1977515955u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1977515955u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Object.Instantiate<GameObject>(fogPrefab, ((Component)modelRoot).transform.position, Quaternion.identity);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CleaningDroneAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1977515955u, new RpcReceiveHandler(__rpc_handler_1977515955));
		}

		private static void __rpc_handler_1977515955(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;
				((CleaningDroneAI)(object)target).SpawnFogClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CleaningDroneAI";
		}
	}
	public class FogBehavior : MonoBehaviour
	{
		public SphereCollider collider;

		public float destroyAfter;

		public ParticleSystem particleSystem;

		public LocalVolumetricFog localFog;

		private float _stopwatch;

		public void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (Object.op_Implicit((Object)(object)localPlayerController) && !localPlayerController.isPlayerDead && localPlayerController.isPlayerControlled)
			{
				Bounds bounds = ((Collider)collider).bounds;
				if (((Bounds)(ref bounds)).Contains(localPlayerController.playerEye.position))
				{
					localPlayerController.increasingDrunknessThisFrame = true;
					localPlayerController.drunknessInertia = Mathf.Clamp(localPlayerController.drunknessInertia + Time.fixedDeltaTime / 2f * localPlayerController.drunknessSpeed, 0.1f, 4.5f);
				}
				_stopwatch += Time.fixedDeltaTime;
				if (_stopwatch >= destroyAfter - 1.5f)
				{
					particleSystem.Stop();
					Object.Destroy((Object)(object)localFog);
				}
				if (_stopwatch >= destroyAfter)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}
	}
}
namespace Moonswept.Config
{
	internal abstract class MoonsweptConfig
	{
		public abstract void Initialize(ConfigFile configFile);

		public static void InitializeConfigs(ConfigFile configFile)
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			foreach (Type type in types)
			{
				try
				{
					if (!(type == typeof(MoonsweptConfig)) && type.IsSubclassOf(typeof(MoonsweptConfig)) && Activator.CreateInstance(type) is MoonsweptConfig moonsweptConfig)
					{
						moonsweptConfig.Initialize(configFile);
					}
				}
				catch (Exception ex)
				{
					Extensions.LogDetailed(ex, (string)null);
				}
			}
		}
	}
	public static class ConfigHelper
	{
		public static ConfigEntry<int> BindInt(this ConfigFile configFile, string section, string key, int defaultValue, string description, int min = 0, int max = 100)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return configFile.Bind<int>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), Array.Empty<object>()));
		}

		public static ConfigEntry<float> BindFloat(this ConfigFile configFile, string section, string key, float defaultValue, string description, float min = 0f, float max = 1f)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return configFile.Bind<float>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()));
		}

		public static ConfigEntry<bool> BindBool(this ConfigFile configFile, string section, string key, bool defaultValue, string description)
		{
			return configFile.Bind<bool>(section, key, defaultValue, description);
		}

		public static ConfigEntry<string> BindString(this ConfigFile configFile, string section, string key, string defaultValue, string description)
		{
			return configFile.Bind<string>(section, key, defaultValue, description);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace MoonsweptTeam.Moonswept.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}