Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Moonswept v1.4.0
Moonswept.dll
Decompiled a week agousing 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.Pool; 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("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [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.4.0.0")] [assembly: AssemblyInformationalVersion("1.4.0+5ab466cce11ff115cf1f571ac6ea2abb68c24883")] [assembly: AssemblyProduct("Moonswept")] [assembly: AssemblyTitle("MoonsweptTeam.Moonswept")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Moonswept { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("TestAccount666.TestAccountCore", "1.13.0")] [BepInPlugin("MoonsweptTeam.Moonswept", "Moonswept", "1.4.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.4.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.4.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.4.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 float _angerTimer; private const float _VIEW_DISTANCE = 5f; private const int _BULLET_FLY_DISTANCE = 13; private const float _BULLET_FIRE_WIDTH = 15f; private const int _DAMAGE_AMOUNT = 5; private const float _DEFAULT_SPEED = 3f; 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 _ANGER_TIME = 1f; private const float _TURN_SPEED = 4f; private const float _TARGET_TURN_SPEED = 9.6f; private const int _OBSTACLE_LAYER_MASK = 512; 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; } _angerTimer = Math.Max(_angerTimer - Time.deltaTime, 0f); if ((base.currentBehaviourStateIndex != 3 || _angerTimer > 0f) && 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) aimTarget.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); Quaternion val = Quaternion.Euler(0f, aimTarget.eulerAngles.y, 0f); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val, 9.6f * Time.deltaTime); } 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005c: 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_006d: 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); Quaternion val2 = Quaternion.Euler(0f, aimTarget.eulerAngles.y, 0f); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 4f * Time.deltaTime); } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if (Object.op_Implicit((Object)(object)playerWhoHit)) { _angerTimer = 1f; base.targetPlayer = playerWhoHit; _lockOnTimer = 1f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if (!((Object)(object)base.targetPlayer != (Object)(object)localPlayerController)) { ((EnemyAI)this).SwitchToBehaviourServerRpc(2); } } } 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!_isDoingGunshots) { return; } _firingDelay += Time.deltaTime; if (!(_firingDelay < 0.21f)) { _firingDelay = 0f; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (!((Object)(object)((EnemyAI)this).CheckLineOfSightForPlayer(15f, 13, -1) != (Object)(object)localPlayerController) && !Physics.Linecast(base.eye.position, ((Component)localPlayerController).transform.position, 512, (QueryTriggerInteraction)2)) { localPlayerController.DamagePlayer(5, true, true, (CauseOfDeath)7, 0, false, default(Vector3)); } } } private void DoPatrollingInterval() { //IL_003a: 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) base.agent.speed = 3f; if (((EnemyAI)this).TargetClosestPlayer(5f, true, 70f, false, false, true)) { if (Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) > 5f) { 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_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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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(5f, true, 70f, false, false, true) || 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 < 3f)) { _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) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2056167209u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2056167209u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; 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) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3192524290u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3192524290u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; gunshots.Stop(); _isDoingGunshots = false; _firingDelay = 0f; } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2056167209u, new RpcReceiveHandler(__rpc_handler_2056167209), "StartGunshotsClientRpc"); ((NetworkBehaviour)this).__registerRpc(3192524290u, new RpcReceiveHandler(__rpc_handler_3192524290), "StopGunshotsClientRpc"); ((EnemyAI)this).__initializeRpcs(); } 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)1; ((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)1; ((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; private const int _FOG_POOL_INITIAL_CAPACITY = 8; private const int _FOG_POOL_MAX_SIZE = 64; public static ObjectPool<GameObject>? FogPool; 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); InitializeFogPool(); } private void InitializeFogPool() { if (!((Object)(object)fogPrefab == (Object)null) && FogPool == null) { FogPool = new ObjectPool<GameObject>((Func<GameObject>)delegate { GameObject val = Object.Instantiate<GameObject>(fogPrefab); val.SetActive(false); return val; }, (Action<GameObject>)delegate(GameObject fog) { fog.SetActive(true); FogBehavior component2 = fog.GetComponent<FogBehavior>(); component2.ResetForReuse(); }, (Action<GameObject>)delegate(GameObject fog) { FogBehavior component = fog.GetComponent<FogBehavior>(); component.OnRelease(); fog.SetActive(false); }, (Action<GameObject>)Object.Destroy, false, 8, 64); } } public override void Update() { //IL_0073: 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_00eb: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (!base.isEnemyDead) { _gasStopwatch += Time.deltaTime; if (_gasStopwatch >= 0.5f) { _gasStopwatch -= 0.5f; SpawnFog(); } ((Component)modelRoot).transform.Rotate(new Vector3(0f, rotationSpeed, 0f) * Time.deltaTime); _movementStopwatch += Time.deltaTime; if (_movementStopwatch >= 4f) { _movementStopwatch = 0f; } ((Component)modelRoot).transform.localPosition = new Vector3(0f, 6.24f + movement.Evaluate(_movementStopwatch) * 4f, 0f); } } private void SpawnFog() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)modelRoot).transform.position; Quaternion identity = Quaternion.identity; GameObject val = FogPool?.Get(); if (val == null || !Object.op_Implicit((Object)(object)val)) { Moonswept.Logger.LogWarning((object)"Failed to get fog instance from pool! Is the pool empty?"); return; } val.transform.position = position; val.transform.rotation = identity; } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead) { 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, -1); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyAI)this).__initializeRpcs(); } [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 ResetForReuse() { _stopwatch = 0f; particleSystem.Clear(true); particleSystem.Play(true); ((Behaviour)localFog).enabled = true; ((Collider)collider).enabled = true; ((Component)this).gameObject.SetActive(true); } public void OnRelease() { if (particleSystem.isPlaying) { particleSystem.Stop(true, (ParticleSystemStopBehavior)0); } ((Behaviour)localFog).enabled = false; ((Collider)collider).enabled = false; } public void FixedUpdate() { ApplyFogEffects(); _stopwatch += Time.fixedDeltaTime; if (_stopwatch >= destroyAfter - 1.5f) { if (particleSystem.isPlaying) { particleSystem.Stop(); } ((Behaviour)localFog).enabled = false; } if (!(_stopwatch < destroyAfter)) { CleaningDroneAI.FogPool?.Release(((Component)this).gameObject); } } private void ApplyFogEffects() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (Object.op_Implicit((Object)(object)val) && !val.isPlayerDead && val.isPlayerControlled) { Bounds bounds = ((Collider)collider).bounds; if (((Bounds)(ref bounds)).Contains(val.playerEye.position) && !(val.drunknessInertia >= 4.5f)) { float num = val.drunknessInertia + Time.fixedDeltaTime / 2f * val.drunknessSpeed; val.drunknessInertia = Mathf.Clamp(num, 0.1f, 4.5f); val.increasingDrunknessThisFrame = true; } } } } } } 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 __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace MoonsweptTeam.Moonswept.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }