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 HeavyItemSCPs v2.0.0
plugins/ProjectSCP.HeavyItemSCPs.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using HeavyItemSCPs.SCP.SCP513; using Microsoft.CodeAnalysis; using PSCPLibrary; using PSCPLibrary.Interfaces; using ProjectSCP.HeavyItemSCPs.NetcodePatcher; using SnowyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [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: AssemblyCompany("ProjectSCP.HeavyItemSCPs")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0+8d8b2090ca5ed9e257f8561c6285a60dfc047341")] [assembly: AssemblyProduct("HeavyItemSCPs")] [assembly: AssemblyTitle("ProjectSCP.HeavyItemSCPs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 HeavyItemSCPs { public class HeavyItemSCPsContentHandler : ContentHandler<HeavyItemSCPsContentHandler> { public class HeavyItemSCPsAssetsAssets : AssetBundleLoader<HeavyItemSCPsAssetsAssets> { [LoadFromBundle("HeavyItemSCPsNetworkHandler.prefab")] public GameObject NetworkHandlerPrefab { get; private set; } = null; [LoadFromBundle("SCPDatabase.asset")] public SCPDatabase SCPDatabase { get; private set; } = null; public HeavyItemSCPsAssetsAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SCP178Assets : AssetBundleLoader<SCP178Assets> { [LoadFromBundle("OverlayMaterial.mat")] public Material HighlightMaterial { get; private set; } = null; public SCP178Assets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SCP323Assets : AssetBundleLoader<SCP323Assets> { public SCP323Assets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SCP427Assets : AssetBundleLoader<SCP427Assets> { public SCP427Assets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SCP513Assets : AssetBundleLoader<SCP513Assets> { [LoadFromBundle("SCP513_1.prefab")] public GameObject SCP513_1Prefab { get; private set; } = null; public SCP513Assets(DuskMod mod, string filePath) : base(mod, filePath) { } } public HeavyItemSCPsAssetsAssets? HeavyItemSCPsAssets; public SCP178Assets? SCP178; public SCP323Assets? SCP323; public SCP427Assets? SCP427; public SCP513Assets? SCP513; public HeavyItemSCPsContentHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent<HeavyItemSCPsAssetsAssets>("heavyitemscps_assets", ref HeavyItemSCPsAssets, false); ((ContentHandler)this).RegisterContent<SCP178Assets>("scp178", ref SCP178, false); ((ContentHandler)this).RegisterContent<SCP323Assets>("scp323", ref SCP323, false); ((ContentHandler)this).RegisterContent<SCP427Assets>("scp427", ref SCP427, false); ((ContentHandler)this).RegisterContent<SCP513Assets>("scp513", ref SCP513, false); } } public static class HeavyItemSCPsKeys { public static readonly NamespacedKey<DawnEnemyInfo> SCP323_1 = NamespacedKey<DawnEnemyInfo>.From("heavyitemscps", "scpthreetwothreeone"); public static readonly NamespacedKey<DawnEnemyInfo> SCP427_1 = NamespacedKey<DawnEnemyInfo>.From("heavyitemscps", "scpfourtwosevenone"); public static readonly NamespacedKey<DawnItemInfo> SCP178 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scponeseveneight"); public static readonly NamespacedKey<DawnItemInfo> SCP178_1Part1 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scponeseveneightone_part_one"); public static readonly NamespacedKey<DawnItemInfo> SCP178_1Part2 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scponeseveneightone_part_two"); public static readonly NamespacedKey<DawnItemInfo> SCP178_1Part3 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scponeseveneightone_part_three"); public static readonly NamespacedKey<DawnItemInfo> SCP323 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scpthreetwothree"); public static readonly NamespacedKey<DawnItemInfo> SCP427 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scpfourtwoseven"); public static readonly NamespacedKey<DawnItemInfo> SCP513 = NamespacedKey<DawnItemInfo>.From("heavyitemscps", "scpfiveonethree"); } internal class NetworkHandler : NetworkBehaviour { public static bool spawningBellMan; public static NetworkHandler Instance { get; private set; } public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsServer && (Object)(object)Instance != (Object)null) { ((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } Instance = this; Plugin.logger.LogDebug((object)"NetworkHandler spawned"); ((NetworkBehaviour)this).OnNetworkSpawn(); } public void Update() { if (ContentHandler<HeavyItemSCPsContentHandler>.Instance.SCP513 != null) { DoBellmanStuff(); } } private void DoBellmanStuff() { if (SCP513Behavior.localPlayerHaunted) { if (Plugin.localPlayer.isPlayerDead || StartOfRound.Instance.firingPlayersCutsceneRunning) { Plugin.logger.LogDebug((object)"This player is no longer haunted"); SCP513Behavior.localPlayerHaunted = false; } else if ((Object)(object)SCP513_1AI.Instance != (Object)null) { spawningBellMan = false; } else if (!spawningBellMan && !StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase && Plugin.localPlayer.isPlayerControlled && !Utils.isOnCompanyMoon && Utils.allAINodes.Length != 0) { SpawnBellManOnLocalClient(); } } } public void SpawnBellManOnLocalClient() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)SCP513_1AI.Instance != (Object)null)) { Plugin.logger.LogDebug((object)"Spawning bellman"); spawningBellMan = true; Object.Instantiate<GameObject>(ContentHandler<HeavyItemSCPsContentHandler>.Instance.SCP513.SCP513_1Prefab, Vector3.zero, Quaternion.identity); } } [ServerRpc(RequireOwnership = false)] public void SpawnGhostGirlServerRpc(ulong clientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3410402443u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3410402443u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer && !((Object)(object)Object.FindObjectsOfType<DressGirlAI>().FirstOrDefault() != (Object)null)) { Utils.SpawnEnemy(EnemyKeys.Girl, Vector3.zero, default(Quaternion), (Transform)null, true); } } } [ServerRpc] public void MimicEnemyServerRpc(ulong clientId, string enemyName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Invalid comparison between Unknown and I4 //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3466312826u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clientId); bool flag = enemyName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(enemyName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3466312826u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; string enemyName2 = enemyName; if (!((NetworkBehaviour)this).IsServer) { return; } PlayerControllerB val3 = Plugin.PlayerFromId(clientId); if ((Object)(object)val3 == (Object)null) { Plugin.logger.LogError((object)$"MimicEnemyServerRpc: Couldnt find player with id: {clientId}"); return; } Plugin.logger.LogDebug((object)("Attempting spawn enemy: " + enemyName2)); try { KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> keyValuePair = ((IEnumerable<KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo>>)LethalContent.Enemies).Where((KeyValuePair<NamespacedKey<DawnEnemyInfo>, DawnEnemyInfo> x) => ((Object)x.Value.EnemyType).name == enemyName2).FirstOrDefault(); EnemyVent closestToPosition = IEnumerableExtensions.GetClosestToPosition<EnemyVent>((IEnumerable<EnemyVent>)RoundManager.Instance.allEnemyVents, ((Component)val3).transform.position, (Func<EnemyVent, Vector3>)((EnemyVent x) => ((Component)x).transform.position), false, (IEnumerable<EnemyVent>)null); if ((Object)(object)closestToPosition == (Object)null) { Plugin.logger.LogError((object)"Couldnt find vent for mimic enemy event."); return; } EnemyAI val4 = Utils.SpawnEnemy(keyValuePair.Key, closestToPosition.floorNode.position, default(Quaternion), (Transform)null, true); if ((Object)(object)val4 == (Object)null) { Plugin.logger.LogError((object)$"MimicEnemyServerRpc: Failed to spawn enemy {keyValuePair}"); return; } val4.ChangeOwnershipOfEnemy(clientId); MimicEnemyClientRpc(clientId, NetworkObjectReference.op_Implicit(((NetworkBehaviour)val4).NetworkObject)); } catch (Exception ex) { Plugin.logger.LogError((object)("MimicEnemyServerRpc: " + ex)); } } [ClientRpc] public void MimicEnemyClientRpc(ulong clientId, NetworkObjectReference netRef) { //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_0071: 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_00e9: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3192978992u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clientId); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3192978992u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null)) { Plugin.logger.LogError((object)"Couldnt get netRef in MimicEnemyClientRpc"); return; } EnemyAI val4 = default(EnemyAI); if (!((Component)val3).TryGetComponent<EnemyAI>(ref val4)) { Plugin.logger.LogError((object)"Couldnt get netObj in MimicEnemyClientRpc"); return; } Collider[] componentsInChildren = ((Component)((Component)val4).transform.root).gameObject.GetComponentsInChildren<Collider>(); foreach (Collider val5 in componentsInChildren) { val5.enabled = false; } if (Plugin.localPlayer.actualClientId != clientId) { val4.EnableEnemyMesh(false, true, false); ((Behaviour)val4.creatureSFX).enabled = false; ((Behaviour)val4.creatureVoice).enabled = false; } else if (!((Object)(object)SCP513_1AI.Instance == (Object)null)) { SCP513_1AI.Instance.mimicEnemy = val4; } } [ServerRpc(RequireOwnership = false)] public void ShotgunSuicideServerRpc(NetworkObjectReference netRef, float duration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_010e: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3030506537u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3030506537u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { ShotgunSuicideClientRpc(netRef, duration); } } } [ClientRpc] public void ShotgunSuicideClientRpc(NetworkObjectReference netRef, float duration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1360343187u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref duration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1360343187u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); ShotgunItem shotgun = default(ShotgunItem); if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null)) { Plugin.logger.LogError((object)"Cant get netObj"); } else if (!((Component)val3).TryGetComponent<ShotgunItem>(ref shotgun)) { Plugin.logger.LogError((object)"Cant get ShotgunItem"); } else { ((MonoBehaviour)this).StartCoroutine(RotateShotgunCoroutine(shotgun, duration)); } } static IEnumerator RotateShotgunCoroutine(ShotgunItem val4, float num) { PlayerControllerB player = ((GrabbableObject)val4).playerHeldBy; try { if (!HallucinationManager.overrideShotgunsRotOffsets.ContainsKey((GrabbableObject)(object)val4)) { HallucinationManager.overrideShotgunsRotOffsets.Add((GrabbableObject)(object)val4, ((GrabbableObject)val4).itemProperties.rotationOffset); } if (!HallucinationManager.overrideShotgunsPosOffsets.ContainsKey((GrabbableObject)(object)val4)) { HallucinationManager.overrideShotgunsPosOffsets.Add((GrabbableObject)(object)val4, ((GrabbableObject)val4).itemProperties.positionOffset); } HallucinationManager.overrideShotguns.Add((GrabbableObject)(object)val4); float elapsedTime = 0f; Vector3 startRot = ((GrabbableObject)val4).itemProperties.rotationOffset; Vector3 endRot = new Vector3(105f, -50f, -50f); Vector3 startPos = ((GrabbableObject)val4).itemProperties.positionOffset; Vector3 endPos = new Vector3(0f, 0.7f, -0.1f); while (elapsedTime < num) { float t = elapsedTime / num; Vector3 _rotOffset = Vector3.Lerp(startRot, endRot, t); Vector3 _posOffset = Vector3.Lerp(startPos, endPos, t); HallucinationManager.overrideShotgunsRotOffsets[(GrabbableObject)(object)val4] = _rotOffset; HallucinationManager.overrideShotgunsPosOffsets[(GrabbableObject)(object)val4] = _posOffset; elapsedTime += Time.deltaTime; yield return null; } yield return (object)new WaitForSeconds(3f); if ((Object)(object)player == (Object)(object)Plugin.localPlayer) { Plugin.localPlayer.activatingItem = false; PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, false); val4.ShootGunAndSync(false); yield return null; Plugin.localPlayer.DamagePlayer(100, true, true, (CauseOfDeath)7, 0, false, val4.shotgunRayPoint.forward * 30f); } yield return (object)new WaitForSeconds(1f); } finally { HallucinationManager.overrideShotguns.Remove((GrabbableObject)(object)val4); if ((Object)(object)player == (Object)(object)Plugin.localPlayer) { Plugin.localPlayer.activatingItem = false; PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, false); } } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3410402443u, new RpcReceiveHandler(__rpc_handler_3410402443), "SpawnGhostGirlServerRpc"); ((NetworkBehaviour)this).__registerRpc(3466312826u, new RpcReceiveHandler(__rpc_handler_3466312826), "MimicEnemyServerRpc"); ((NetworkBehaviour)this).__registerRpc(3192978992u, new RpcReceiveHandler(__rpc_handler_3192978992), "MimicEnemyClientRpc"); ((NetworkBehaviour)this).__registerRpc(3030506537u, new RpcReceiveHandler(__rpc_handler_3030506537), "ShotgunSuicideServerRpc"); ((NetworkBehaviour)this).__registerRpc(1360343187u, new RpcReceiveHandler(__rpc_handler_1360343187), "ShotgunSuicideClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3410402443(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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).SpawnGhostGirlServerRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3466312826(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string enemyName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref enemyName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).MimicEnemyServerRpc(clientId, enemyName); target.__rpc_exec_stage = (__RpcExecStage)0; } private static void __rpc_handler_3192978992(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_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_0060: 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) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); NetworkObjectReference netRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).MimicEnemyClientRpc(clientId, netRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3030506537(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).ShotgunSuicideServerRpc(netRef, duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1360343187(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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); float duration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref duration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandler)(object)target).ShotgunSuicideClientRpc(netRef, duration); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetworkHandler"; } } [HarmonyPatch] public static class NetworkHandlerPatches { [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void StartOfRound_Awake_PostFix() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsServerOrHost) { GameObject val = Object.Instantiate<GameObject>(ContentHandler<HeavyItemSCPsContentHandler>.Instance.HeavyItemSCPsAssets.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); } } } [BepInPlugin("ProjectSCP.HeavyItemSCPs", "HeavyItemSCPs", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("ProjectSCP.HeavyItemSCPs"); public static Plugin PluginInstance { get; private set; } public static ManualLogSource logger { get; private set; } public static DuskMod Mod { get; private set; } public static SCPDatabase SCPDatabase { get; private set; } public static PlayerControllerB localPlayer => StartOfRound.Instance.localPlayerController; public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost; public static PlayerControllerB? PlayerFromId(ulong id) { return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).FirstOrDefault(); } private void Awake() { if ((Object)(object)PluginInstance == (Object)null) { PluginInstance = this; } logger = ((BaseUnityPlugin)PluginInstance).Logger; harmony.PatchAll(); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "heavyitemscps_mainassets")); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); SCPDatabase = ContentHandler<HeavyItemSCPsContentHandler>.Instance.HeavyItemSCPsAssets.SCPDatabase; SCPAPI.Register(SCPDatabase); InitializeNetworkBehaviours(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.HeavyItemSCPs v2.0.0 has loaded!"); } private static void InitializeNetworkBehaviours() { 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); } } } logger.LogDebug((object)"Finished initializing network behaviours"); } } [HarmonyPatch] public static class TESTING { public static bool immunity { get; private set; } [HarmonyPostfix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] public static void PingScan_performedPostFix() { if (Utils.testing) { } } [StaticUpdate] public static void Update() { if (Utils.testing) { } } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public static void SubmitChat_performedPrefix(HUDManager __instance) { try { if (Utils.testing && Plugin.IsServerOrHost) { string text = __instance.chatTextField.text; string[] array = text.Split(" "); switch (array[0]) { case "/immunity": immunity = !immunity; HUDManager.Instance.DisplayTip("ItemSCPs", "Immunity: " + immunity, false, false, "LC_Tip1"); break; case "/immune": immunity = !immunity; HUDManager.Instance.DisplayTip("ItemSCPs", "Immunity: " + immunity, false, false, "LC_Tip1"); break; case "/test513": HallucinationManager.Instance?.RunAllEvents(10f); break; } } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ProjectSCP.HeavyItemSCPs"; public const string PLUGIN_NAME = "HeavyItemSCPs"; public const string PLUGIN_VERSION = "2.0.0"; } } namespace HeavyItemSCPs.SCP.SCP513 { public class HallucinationManager : MonoBehaviour { private delegate void MethodDelegate(); public static HashSet<GrabbableObject> overrideShotguns = new HashSet<GrabbableObject>(); public static Dictionary<GrabbableObject, Vector3> overrideShotgunsPosOffsets = new Dictionary<GrabbableObject, Vector3>(); public static Dictionary<GrabbableObject, Vector3> overrideShotgunsRotOffsets = new Dictionary<GrabbableObject, Vector3>(); private List<MethodDelegate> commonEvents = new List<MethodDelegate>(); private List<MethodDelegate> uncommonEvents = new List<MethodDelegate>(); private List<MethodDelegate> rareEvents = new List<MethodDelegate>(); private List<Action> cleanupActions = new List<Action>(); private Coroutine? activeCoroutine; private Action? activeCoroutineCleanup; private int currentCoroutineTier = -1; private bool wasInterrupted = false; public static HallucinationManager? Instance { get; private set; } public void Start() { commonEvents.Add(FlickerLights); commonEvents.Add(PlayAmbientSFXNearby); commonEvents.Add(PlayFakeSoundEffectMinor); commonEvents.Add(PlayBellSFX); commonEvents.Add(HideHazard); commonEvents.Add(Stare); Plugin.logger.LogDebug((object)("CommonEvents: " + commonEvents.Count)); uncommonEvents.Add(FarStare); uncommonEvents.Add(Jumpscare); uncommonEvents.Add(BlockDoor); uncommonEvents.Add(StalkPlayer); uncommonEvents.Add(PlayFakeSoundEffectMajor); uncommonEvents.Add(ShowFakeShipLeavingDisplayTip); uncommonEvents.Add(SpawnFakeBody); uncommonEvents.Add(SlowWalkToPlayer); Plugin.logger.LogDebug((object)("UncommonEvents: " + uncommonEvents.Count)); rareEvents.Add(MimicEnemyChase); rareEvents.Add(MimicPlayer); rareEvents.Add(ChasePlayer); rareEvents.Add(SpawnGhostGirl); rareEvents.Add(TurnOffAllLights); rareEvents.Add(SpawnFakeLandminesAroundPlayer); rareEvents.Add(SpawnMultipleFakeBodies); rareEvents.Add(ForceSuicide); Plugin.logger.LogDebug((object)("RareEvents: " + rareEvents.Count)); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public void OnDestroy() { ((MonoBehaviour)this).StopAllCoroutines(); foreach (Action cleanupAction in cleanupActions) { cleanupAction?.Invoke(); } cleanupActions.Clear(); activeCoroutineCleanup = null; activeCoroutine = null; if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private bool TryStartCoroutine(IEnumerator coroutineMethod, int tier, Action? cleanup = null) { if (activeCoroutine != null) { if (tier < currentCoroutineTier) { Plugin.logger.LogDebug((object)"A higher priority coroutine is already running, don't start this one"); return false; } wasInterrupted = true; ((MonoBehaviour)this).StopCoroutine(activeCoroutine); if (activeCoroutineCleanup != null) { activeCoroutineCleanup(); cleanupActions.Remove(activeCoroutineCleanup); } activeCoroutine = null; activeCoroutineCleanup = null; currentCoroutineTier = -1; } wasInterrupted = false; if (cleanup != null) { cleanupActions.Add(cleanup); activeCoroutineCleanup = cleanup; } activeCoroutine = ((MonoBehaviour)this).StartCoroutine(WrapTierCoroutine(coroutineMethod, tier, cleanup)); currentCoroutineTier = tier; return true; } private IEnumerator WrapTierCoroutine(IEnumerator coroutineMethod, int tier, Action? cleanup) { yield return coroutineMethod; if (!wasInterrupted && tier == currentCoroutineTier) { cleanup?.Invoke(); cleanupActions.Remove(cleanup); SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.InActive); activeCoroutine = null; activeCoroutineCleanup = null; currentCoroutineTier = -1; } } private Coroutine StartSafeCoroutine(IEnumerator coroutineMethod, Action? cleanup = null) { return ((MonoBehaviour)this).StartCoroutine(WrapSafeCoroutine(coroutineMethod, cleanup)); } private IEnumerator WrapSafeCoroutine(IEnumerator coroutineMethod, Action? cleanup) { if (cleanup != null) { cleanupActions.Add(cleanup); } yield return coroutineMethod; if (cleanup != null) { cleanup(); cleanupActions.Remove(cleanup); } } public void RunAllEvents(float timeBetweenEvents) { ((MonoBehaviour)this).StartCoroutine(RunAllEventsCoroutine(timeBetweenEvents)); IEnumerator RunAllEventsCoroutine(float num) { yield return null; List<MethodDelegate> allEvents = new List<MethodDelegate>(); allEvents.AddRange(commonEvents); allEvents.AddRange(uncommonEvents); allEvents.AddRange(rareEvents); foreach (MethodDelegate _event in allEvents) { _event(); yield return (object)new WaitForSeconds(num); } Plugin.logger.LogDebug((object)"All events run successfully"); } } public void RunRandomEvent(int eventRarity) { switch (eventRarity) { case 0: { int index = Random.Range(0, commonEvents.Count); commonEvents[index]?.Invoke(); break; } case 1: { int index = Random.Range(0, uncommonEvents.Count); uncommonEvents[index]?.Invoke(); break; } case 2: { ((MonoBehaviour)this).StopAllCoroutines(); int index = Random.Range(0, rareEvents.Count); rareEvents[index]?.Invoke(); break; } } } public void RunEvent(int eventRarity, int eventIndex) { switch (eventRarity) { case 0: commonEvents[eventIndex]?.Invoke(); break; case 1: uncommonEvents[eventIndex]?.Invoke(); break; case 2: ((MonoBehaviour)this).StopAllCoroutines(); rareEvents[eventIndex]?.Invoke(); break; } } public void FlickerLights() { Plugin.logger.LogDebug((object)"FlickerLights"); if (Plugin.localPlayer.isInsideFactory) { RoundManager.Instance.FlickerLights(true, true); Plugin.localPlayer.JumpToFearLevel(0.9f, true); } } private void PlayAmbientSFXNearby() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) Plugin.logger.LogDebug((object)"PlayAmbientSFXNearby"); Vector3 position = GetClosestNode(((Component)Plugin.localPlayer).transform.position, !Plugin.localPlayer.isInsideFactory).position; PlaySoundAtPosition(position, SCP513_1AI.Instance.ambientSFX); } private void PlayFakeSoundEffectMinor() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"PlaySoundEffectMinor"); AudioClip[] array = SCP513_1AI.Instance.minorSoundEffectSFX.Where((AudioClip clip) => ((Object)clip).name.Length >= 2 && ((Object)clip).name[0] == 'I' == Plugin.localPlayer.isInsideFactory).ToArray(); if (array.Length == 0) { Plugin.logger.LogWarning((object)"No matching sound effects for current environment."); return; } AudioClip val = array[Random.Range(0, array.Length)]; bool flag = ((Object)val).name[1] == '2'; int offset = ((((Object)val).name.Length > 3 && ((Object)val).name[3] == 'F') ? 5 : 0); Transform val2 = SCP513_1AI.Instance?.ChooseClosestNodeToPosition(((Component)Plugin.localPlayer).transform.position, avoidLineOfSight: false, offset); if ((Object)(object)val2 == (Object)null) { Plugin.logger.LogError((object)"Couldnt find closest node to position"); return; } GameObject val3 = Object.Instantiate<GameObject>(SCP513_1AI.Instance.soundObjectPrefab, val2.position, Quaternion.identity); AudioSource component = val3.GetComponent<AudioSource>(); component.spatialBlend = (flag ? 0f : 1f); component.clip = val; component.Play(); Object.Destroy((Object)(object)val3, val.length); } private void PlayBellSFX() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) Plugin.logger.LogDebug((object)"PlayBellSFX"); Vector3 position = GetClosestNode(((Component)Plugin.localPlayer).transform.position, !Plugin.localPlayer.isInsideFactory).position; PlaySoundAtPosition(position, SCP513_1AI.Instance.bellSFX); } private void HideHazard() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"HideHazard"); float hideTime = 30f; Landmine landmine = Vector3Extensions.GetClosestGameObjectOfType<Landmine>(((Component)Plugin.localPlayer).transform.position); Turret closestGameObjectOfType = Vector3Extensions.GetClosestGameObjectOfType<Turret>(((Component)Plugin.localPlayer).transform.position); SpikeRoofTrap spikeTrap = Vector3Extensions.GetClosestGameObjectOfType<SpikeRoofTrap>(((Component)Plugin.localPlayer).transform.position); List<(GameObject, float, string)> list = new List<(GameObject, float, string)>(); if ((Object)(object)landmine != (Object)null) { list.Add((((Component)landmine).gameObject, Vector3.Distance(((Component)Plugin.localPlayer).transform.position, ((Component)landmine).transform.position), "Landmine")); } if ((Object)(object)closestGameObjectOfType != (Object)null) { list.Add((((Component)closestGameObjectOfType).gameObject, Vector3.Distance(((Component)Plugin.localPlayer).transform.position, ((Component)closestGameObjectOfType).transform.position), "Turret")); } if ((Object)(object)spikeTrap != (Object)null) { list.Add((((Component)spikeTrap).gameObject, Vector3.Distance(((Component)Plugin.localPlayer).transform.position, ((Component)spikeTrap).transform.position), "SpikeTrap")); } if (list.Count == 0) { RunRandomEvent(0); return; } (GameObject, float, string) tuple = list.OrderBy<(GameObject, float, string), float>(((GameObject obj, float distance, string type) h) => h.distance).First(); GameObject turretMesh; MeshRenderer[] renderers; switch (tuple.Item3) { case "Landmine": { Action cleanup2 = delegate { if ((Object)(object)landmine != (Object)null) { ((Renderer)((Component)landmine).GetComponent<MeshRenderer>()).forceRenderingOff = false; } }; StartSafeCoroutine(HideLandmineCoroutine(landmine), cleanup2); break; } case "Turret": turretMesh = ((Component)((Component)closestGameObjectOfType).gameObject.transform.root.Find("MeshContainer")).gameObject; StartSafeCoroutine(HideTurretCoroutine(closestGameObjectOfType), delegate { GameObject obj = turretMesh; if (obj != null) { obj.SetActive(true); } }); break; case "SpikeTrap": { renderers = ((Component)((Component)spikeTrap).transform.root).GetComponentsInChildren<MeshRenderer>(); Action cleanup = delegate { MeshRenderer[] componentsInChildren = ((Component)((Component)spikeTrap).transform.root).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { ((Renderer)val).forceRenderingOff = false; } } }; StartSafeCoroutine(HideSpikeTrapCoroutine(spikeTrap), cleanup); break; } } IEnumerator HideLandmineCoroutine(Landmine val) { Plugin.logger.LogDebug((object)"Hiding landmine"); yield return null; ((Renderer)((Component)val).GetComponent<MeshRenderer>()).forceRenderingOff = true; float elapsedTime = 0f; while (elapsedTime < hideTime) { yield return (object)new WaitForSeconds(0.2f); elapsedTime += 0.2f; if (val.localPlayerOnMine) { break; } } } IEnumerator HideSpikeTrapCoroutine(SpikeRoofTrap val) { try { Plugin.logger.LogDebug((object)"Hiding spike trap"); yield return null; MeshRenderer[] array = renderers; foreach (MeshRenderer renderer in array) { ((Renderer)renderer).forceRenderingOff = true; } float elapsedTime = 0f; while (elapsedTime < hideTime) { yield return (object)new WaitForSeconds(0.2f); elapsedTime += 0.2f; if (Plugin.localPlayer.isPlayerDead) { break; } } } finally { MeshRenderer[] array2 = renderers; foreach (MeshRenderer renderer2 in array2) { if (!((Object)(object)renderer2 == (Object)null)) { ((Renderer)renderer2).forceRenderingOff = false; } } } } IEnumerator HideTurretCoroutine(Turret turret) { Plugin.logger.LogDebug((object)"Hiding turret"); yield return null; turretMesh.SetActive(false); float elapsedTime = 0f; while (elapsedTime < hideTime) { yield return null; elapsedTime += Time.deltaTime; if ((int)turret.turretMode > 0) { break; } } } } private void Stare() { Plugin.logger.LogDebug((object)"Stare"); TryStartCoroutine(StareCoroutine(), 0); IEnumerator StareCoroutine() { float stareTime = 15f; yield return null; Vector3 outsideLOS = SCP513_1AI.Instance.GetRandomPositionAroundPlayer(5f, 15f, 10); SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Manifesting); SCP513_1AI.Instance.Teleport(outsideLOS); SCP513_1AI.Instance.facePlayer = true; SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", true); RoundManager.PlayRandomClip(SCP513_1AI.Instance.creatureSFX, SCP513_1AI.Instance.ambientSFX, true, 1f, 0, 1000); float elapsedTime = 0f; while (elapsedTime < stareTime) { yield return (object)new WaitForSeconds(0.2f); elapsedTime += 0.2f; if (SCP513_1AI.Instance.playerHasLOS) { yield return (object)new WaitForSeconds(2.5f); FlickerLights(); break; } } } } private void FarStare() { Plugin.logger.LogDebug((object)"FarStare"); TryStartCoroutine(StareCoroutine(), 1); IEnumerator StareCoroutine() { float stareTime = 15f; yield return null; Transform pos = SCP513_1AI.Instance.TryFindingHauntPosition(); while ((Object)(object)pos == (Object)null) { yield return (object)new WaitForSeconds(0.2f); pos = SCP513_1AI.Instance.TryFindingHauntPosition(); } if (Random.Range(1, 4) == 1) { LogStareArt(); } SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Manifesting); SCP513_1AI.Instance.Teleport(pos.position); SCP513_1AI.Instance.facePlayer = true; SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", true); RoundManager.PlayRandomClip(SCP513_1AI.Instance.creatureSFX, SCP513_1AI.Instance.ambientSFX, true, 1f, 0, 1000); float elapsedTime = 0f; while (elapsedTime < stareTime) { yield return (object)new WaitForSeconds(0.2f); elapsedTime += 0.2f; if (SCP513_1AI.Instance.playerHasLOS) { yield return (object)new WaitForSeconds(2.5f); FlickerLights(); break; } } } } private void Jumpscare() { Plugin.logger.LogDebug((object)"Jumpscare"); TryStartCoroutine(JumpscareCoroutine(), 1); static IEnumerator JumpscareCoroutine() { float runSpeed = 20f; float disappearTime = 5f; yield return null; Transform pos = SCP513_1AI.Instance.ChoosePositionInFrontOfPlayer(1f, 5f); while ((Object)(object)pos == (Object)null) { yield return (object)new WaitForSeconds(0.2f); pos = SCP513_1AI.Instance.ChoosePositionInFrontOfPlayer(1f, 5f); } SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Chasing); SCP513_1AI.Instance.Teleport(pos.position); SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", false); SCP513_1AI.Instance.agent.speed = runSpeed; SCP513_1AI.Instance.facePlayer = true; yield return (object)new WaitForSeconds(disappearTime); } } private void BlockDoor() { Plugin.logger.LogDebug((object)"BlockDoor"); TryStartCoroutine(BlockDoorCoroutine(), 1); static IEnumerator BlockDoorCoroutine() { float doorDistance = 10f; float blockPosOffset = 1f; float disappearDistance = 15f; float disappearTime = 15f; yield return null; DoorLock[] doorLocks = GetDoorLocksNearbyPosition(((Component)Plugin.localPlayer).transform.position, doorDistance).ToArray(); while (doorLocks.Length == 0) { yield return (object)new WaitForSeconds(1f); doorLocks = GetDoorLocksNearbyPosition(((Component)Plugin.localPlayer).transform.position, doorDistance).ToArray(); } int index = Random.Range(0, doorLocks.Length); DoorLock doorLock = doorLocks[index]; GameObject steelDoorObj = ((Component)((Component)((Component)doorLock).transform.parent).transform.parent).gameObject; Vector3 blockPos = RoundManager.Instance.GetNavMeshPosition(steelDoorObj.transform.position + Vector3.forward * blockPosOffset, default(NavMeshHit), 5f, -1); SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Manifesting); SCP513_1AI.Instance.Teleport(blockPos); SCP513_1AI.Instance.SetDestinationToPosition(blockPos); SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", true); SCP513_1AI.Instance.facePlayer = true; float elapsedTime = 0f; while (elapsedTime < disappearTime) { yield return (object)new WaitForSeconds(0.2f); elapsedTime += 0.2f; if (Vector3.Distance(((Component)SCP513_1AI.Instance).transform.position, ((Component)Plugin.localPlayer).transform.position) > disappearDistance || SCP513_1AI.Instance.currentBehaviourState != SCP513_1AI.State.Manifesting) { break; } } } } private void StalkPlayer() { Plugin.logger.LogDebug((object)"StalkPlayer"); TryStartCoroutine(StalkCoroutine(), 1); IEnumerator StalkCoroutine() { yield return null; Transform teleportTransform = SCP513_1AI.Instance.ChooseClosestNodeToPosition(((Component)Plugin.localPlayer).transform.position, avoidLineOfSight: true); while ((Object)(object)teleportTransform == (Object)null) { yield return (object)new WaitForSeconds(1f); teleportTransform = SCP513_1AI.Instance.ChooseClosestNodeToPosition(((Component)Plugin.localPlayer).transform.position, avoidLineOfSight: true); } Vector3 teleportPos = teleportTransform.position; SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Stalking); SCP513_1AI.Instance.Teleport(teleportPos); SCP513_1AI.Instance.SetDestinationToPosition(teleportPos); SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", false); while (SCP513_1AI.Instance.currentBehaviourState == SCP513_1AI.State.Stalking && Plugin.localPlayer.isInsideFactory != SCP513_1AI.Instance.isOutside) { yield return (object)new WaitForSeconds(1f); } FlickerLights(); } } private void PlayFakeSoundEffectMajor() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"PlayFakeSoundEffectMajor"); AudioClip[] array = SCP513_1AI.Instance.majorSoundEffectSFX.Where((AudioClip clip) => ((Object)clip).name.Length >= 2 && ((Object)clip).name[0] == 'I' == Plugin.localPlayer.isInsideFactory).ToArray(); if (array.Length == 0) { Plugin.logger.LogWarning((object)"No matching sound effects for current environment."); return; } AudioClip val = array[Random.Range(0, array.Length)]; bool flag = ((Object)val).name[1] == '2'; int offset = ((((Object)val).name.Length > 3 && ((Object)val).name[3] == 'F') ? 5 : 0); Vector3 position = SCP513_1AI.Instance.ChooseClosestNodeToPosition(((Component)Plugin.localPlayer).transform.position, avoidLineOfSight: false, offset).position; GameObject val2 = Object.Instantiate<GameObject>(SCP513_1AI.Instance.soundObjectPrefab, position, Quaternion.identity); AudioSource component = val2.GetComponent<AudioSource>(); component.spatialBlend = (flag ? 0f : 1f); component.clip = val; component.Play(); Object.Destroy((Object)(object)val2, val.length); } private void ShowFakeShipLeavingDisplayTip() { Plugin.logger.LogDebug((object)"ShowFakeShipLeavingDisplayTip"); TimeOfDay.Instance.shipLeavingEarlyDialogue[0].bodyText = "WARNING! Please return by " + GetClock(TimeOfDay.Instance.normalizedTimeOfDay + 0.1f, TimeOfDay.Instance.numberOfHours, createNewLine: false) + ". A vote has been cast, and the autopilot ship will leave early."; HUDManager.Instance.ReadDialogue(TimeOfDay.Instance.shipLeavingEarlyDialogue); } private void SpawnFakeBody() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0038: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"SpawnFakeBody"); float num = 3f; int deathAnimation = Random.Range(0, 8); Vector2 val = Random.insideUnitCircle * num; Vector3 positionOffset = default(Vector3); ((Vector3)(ref positionOffset))..ctor(val.x, 0f, val.y); GameObject val2 = SpawnDeadBody(Plugin.localPlayer, ((Component)Plugin.localPlayer).transform.position, 0, deathAnimation, positionOffset); Object.Destroy((Object)(object)val2, 30f); } private void SlowWalkToPlayer() { Plugin.logger.LogDebug((object)"SlowWalkToPlayer"); TryStartCoroutine(SlowWalkCoroutine(), 1); IEnumerator SlowWalkCoroutine() { yield return null; Transform teleportTransform = SCP513_1AI.Instance.ChooseClosestNodeToPosition(((Component)Plugin.localPlayer).transform.position, avoidLineOfSight: false, 3); while ((Object)(object)teleportTransform == (Object)null) { yield return (object)new WaitForSeconds(1f); teleportTransform = SCP513_1AI.Instance.ChooseClosestNodeToPosition(((Component)Plugin.localPlayer).transform.position, avoidLineOfSight: false, 3); } Vector3 teleportPos = teleportTransform.position; SCP513_1AI.Instance.Teleport(teleportPos); SCP513_1AI.Instance.agent.speed = 5f; SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", true); SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Chasing); while (SCP513_1AI.Instance.currentBehaviourState == SCP513_1AI.State.Chasing && Plugin.localPlayer.isInsideFactory != SCP513_1AI.Instance.isOutside) { yield return (object)new WaitForSeconds(5f); FlickerLights(); } } } private void MimicEnemyChase() { Plugin.logger.LogDebug((object)"MimicEnemyChase"); string[] array = new string[5] { "Flowerman", "SpringMan", "MaskedPlayerEnemy", "Crawler", "Butler" }; int num = Random.Range(0, array.Length); SCP513_1AI.Instance.MimicEnemy(array[num]); } private void MimicPlayer() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"MimicPlayer"); if (!Plugin.localPlayer.NearOtherPlayers(10f)) { RunRandomEvent(2); return; } List<PlayerControllerB> list = new List<PlayerControllerB> { Plugin.localPlayer }; PlayerControllerB[] nearbyPlayers = Vector3Extensions.GetNearbyPlayers(((Component)Plugin.localPlayer).transform.position, 10f, list); if (nearbyPlayers.Length == 0) { RunRandomEvent(2); return; } int num = Random.Range(0, nearbyPlayers.Length); PlayerControllerB component = ((Component)nearbyPlayers[num]).gameObject.GetComponent<PlayerControllerB>(); TryStartCoroutine(MimicPlayerCoroutine(component), 2); static IEnumerator MimicPlayerCoroutine(PlayerControllerB mimicPlayer) { yield return null; PlayerControllerBExtensions.MakePlayerInvisible(mimicPlayer, true); yield return null; SCP513_1AI.Instance.mimicPlayer = mimicPlayer; SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.MimicPlayer); yield return (object)new WaitForSeconds(30f); } } private void ChasePlayer() { Plugin.logger.LogDebug((object)"ChasePlayer"); TryStartCoroutine(ChaseCoroutine(), 2); IEnumerator ChaseCoroutine() { yield return null; Transform teleportPos = SCP513_1AI.Instance.ChooseFarthestNodeFromPosition(((Component)Plugin.localPlayer).transform.position); if ((Object)(object)teleportPos == (Object)null) { Plugin.logger.LogError((object)"Couldnt find farthest node from position"); } else { SCP513_1AI.Instance.Teleport(teleportPos.position); SCP513_1AI.Instance.agent.speed = 10f; SCP513_1AI.Instance.creatureAnimator.SetBool("armsCrossed", false); SCP513_1AI.Instance.SwitchToBehavior(SCP513_1AI.State.Chasing); while (SCP513_1AI.Instance.currentBehaviourState == SCP513_1AI.State.Chasing && Plugin.localPlayer.isInsideFactory != SCP513_1AI.Instance.isOutside) { yield return (object)new WaitForSeconds(2.5f); FlickerLights(); } } } } private void SpawnGhostGirl() { Plugin.logger.LogDebug((object)"SpawnGhostGirl"); NetworkHandler.Instance?.SpawnGhostGirlServerRpc(Plugin.localPlayer.actualClientId); } private void TurnOffAllLights() { Plugin.logger.LogDebug((object)"TurnOffAllLights"); FlickerLights(); RoundManager.Instance.TurnOnAllLights(false); } private void SpawnFakeLandminesAroundPlayer() { Plugin.logger.LogDebug((object)"SpawnFakeLandminesAroundPlayer"); float spawnTime = 10f; ((MonoBehaviour)this).StartCoroutine(SpawnLandminesAroundPlayerCoroutine()); IEnumerator DespawnLandmineConditionCoroutine(Landmine landmine) { yield return null; float elapsedTime = 0f; while (elapsedTime < spawnTime) { yield return null; elapsedTime += Time.deltaTime; if (landmine.localPlayerOnMine) { break; } } } IEnumerator SpawnLandminesAroundPlayerCoroutine() { int minToSpawn = 5; int maxToSpawn = 20; int spawnAmount = Random.Range(minToSpawn, maxToSpawn + 1); List<Vector3> positions = Utils.GetEvenlySpacedNavMeshPositions(((Component)Plugin.localPlayer).transform.position, spawnAmount, 3f, 5f); foreach (Vector3 position in positions) { yield return null; NamespacedKey<DawnMapObjectInfo> landmine = MapObjectKeys.Landmine; Transform transform = RoundManager.Instance.mapPropsContainer.transform; GameObject landmineObj = Utils.SpawnMapObject(landmine, position, default(Quaternion), transform, true); if ((Object)(object)landmineObj == (Object)null) { Plugin.logger.LogError((object)"Couldnt spawn landmine object"); } else { Landmine landmine2 = landmineObj.GetComponentInChildren<Landmine>(); landmine2.mineActivated = true; landmine2.mineAudio.PlayOneShot(landmine2.mineDeactivate); StartSafeCoroutine(DespawnLandmineConditionCoroutine(landmine2), delegate { Object.Destroy((Object)(object)((Component)landmine2).gameObject); }); } } } } private void SpawnMultipleFakeBodies() { //IL_0035: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"SpawnMultipleFakeBodies"); float num = 3f; int num2 = 5; int num3 = 10; int num4 = Random.Range(num2, num3 + 1); Vector3 positionOffset = default(Vector3); for (int i = 0; i < num4; i++) { int deathAnimation = Random.Range(0, 8); Vector2 val = Random.insideUnitCircle * num; ((Vector3)(ref positionOffset))..ctor(val.x, 0f, val.y); GameObject val2 = SpawnDeadBody(Plugin.localPlayer, ((Component)Plugin.localPlayer).transform.position, 0, deathAnimation, positionOffset); Object.Destroy((Object)(object)val2, 30f); } } private void ForceSuicide() { Plugin.logger.LogDebug((object)"ForceSuicide"); bool flag = false; bool flag2 = false; bool flag3 = false; GrabbableObject[] itemSlots = Plugin.localPlayer.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (!((Object)(object)val == (Object)null)) { if (((Object)val.itemProperties).name == "Shotgun") { flag = true; } if (((Object)val.itemProperties).name == "Knife") { flag2 = true; } if (((Object)val.itemProperties).name == "ComedyMask" || ((Object)val.itemProperties).name == "TragedyMask") { flag3 = true; } } } if (!flag2 && !flag && !flag3) { RunRandomEvent(2); return; } Action cleanup = delegate { PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, false); }; TryStartCoroutine(ForceSuicideCoroutine(flag, flag3), 2, cleanup); static IEnumerator ForceSuicideCoroutine(bool hasShotgun, bool hasMask) { yield return null; int itemSlotIndex = 0; if (hasShotgun) { PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, true); Plugin.localPlayer.activatingItem = true; ShotgunItem shotgun = null; GrabbableObject[] itemSlots2 = Plugin.localPlayer.ItemSlots; foreach (GrabbableObject slot in itemSlots2) { if (!((Object)(object)slot == (Object)null) && ((Object)slot.itemProperties).name == "Shotgun") { shotgun = (ShotgunItem)slot; itemSlotIndex = MiscHelpers.IndexOf<GrabbableObject>((IEnumerable<GrabbableObject>)Plugin.localPlayer.ItemSlots, (GrabbableObject)(object)shotgun); } } if ((Object)(object)shotgun == (Object)null) { Plugin.logger.LogError((object)"Couldnt find shotgun"); yield break; } Plugin.localPlayer.SwitchToItemSlot(itemSlotIndex, (GrabbableObject)(object)shotgun); NetworkHandler.Instance?.ShotgunSuicideServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)shotgun).NetworkObject), 5f); yield return (object)new WaitForSeconds(10f); } else if (hasMask) { PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, true); Plugin.localPlayer.activatingItem = true; HauntedMaskItem mask = null; GrabbableObject[] itemSlots3 = Plugin.localPlayer.ItemSlots; foreach (GrabbableObject slot2 in itemSlots3) { if (!((Object)(object)slot2 == (Object)null) && (((Object)slot2.itemProperties).name == "ComedyMask" || ((Object)slot2.itemProperties).name == "TragedyMask")) { mask = (HauntedMaskItem)slot2; itemSlotIndex = MiscHelpers.IndexOf<GrabbableObject>((IEnumerable<GrabbableObject>)Plugin.localPlayer.ItemSlots, (GrabbableObject)(object)mask); } } if ((Object)(object)mask == (Object)null) { Plugin.logger.LogError((object)"Couldnt find mask"); yield break; } Plugin.localPlayer.SwitchToItemSlot(itemSlotIndex, (GrabbableObject)(object)mask); yield return (object)new WaitForSeconds(1f); mask.maskOn = true; Plugin.localPlayer.activatingItem = true; mask.BeginAttachment(); yield return (object)new WaitForSeconds(1f); } else { PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, true); Plugin.localPlayer.activatingItem = true; KnifeItem knife = null; GrabbableObject[] itemSlots4 = Plugin.localPlayer.ItemSlots; foreach (GrabbableObject slot3 in itemSlots4) { if (!((Object)(object)slot3 == (Object)null) && ((Object)slot3.itemProperties).name == "Knife") { knife = (KnifeItem)slot3; itemSlotIndex = MiscHelpers.IndexOf<GrabbableObject>((IEnumerable<GrabbableObject>)Plugin.localPlayer.ItemSlots, (GrabbableObject)(object)knife); } } if ((Object)(object)knife == (Object)null) { Plugin.logger.LogError((object)"Couldnt find knife"); yield break; } Plugin.localPlayer.SwitchToItemSlot(itemSlotIndex, (GrabbableObject)(object)knife); float elapsedTime = 0f; while (!Plugin.localPlayer.isPlayerDead) { yield return null; elapsedTime += Time.deltaTime; Transform camTransform = ((Component)Plugin.localPlayer.gameplayCamera).transform; Vector3 currentAngles = camTransform.localEulerAngles; float targetX = 90f; float smoothedX = Mathf.LerpAngle(currentAngles.x, targetX, Time.deltaTime * 5f); camTransform.localEulerAngles = new Vector3(smoothedX, currentAngles.y, 0f); if (elapsedTime > 1f) { elapsedTime = 0f; ((GrabbableObject)knife).UseItemOnClient(true); Plugin.localPlayer.activatingItem = true; yield return (object)new WaitForSeconds(0.25f); Plugin.localPlayer.DamagePlayer(25, true, true, (CauseOfDeath)14, 0, false, default(Vector3)); } } } PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, false); } } public static void LogStareArt() { Plugin.logger.LogError((object)" I SEE YOU\r\n;;;;;+++xXxxxxxxxxxxXXXXXXXXXxx+++++;;;;;::....:;::.................::\r\n;+++++++xXXXXXXXxXXX$$$$$$$$$Xxx+++;;;+;:::...::::................:::.\r\n+++++++xXXXXXXX$$X$$$$$$$$$$$XXxx+;;;;::::;::.........................\r\n++++++xxX$$$$X$$$$$&$&&&&&$XXXXx+;;;;;;;;;;;::........................\r\n+++++xxx$$$$$$$$XX$$&$$&&&&$$Xx++;;;;;;;++;;;::.....::..........:.....\r\n++++xxxX$$$$$&&&$XXX$$XX$&$$&X;:::::;;:::::::::......:................\r\n+++x+xxX$$$XxXX$x++x$$$&&$&&&X+;:::::::...........::..................\r\n+++xxxxXXx+;;+;;;;;xxX$&&$xxXxxxx+;:...:x+;...........................\r\n++xxxxXXX+;;::..::;;+xxX$$$X&&&$+;;::..;X$x:..........................\r\n+++xxxXXXx+::.;X&&X;+x$&&$$&&&&&x;:::...::............................\r\n+++++xxX$$X;:::+X$+++X$$&&&&&&$XX+;:...::::::;+;;;:...................\r\n+x+xxxxX$&&$+;;:::;;+X&&&&&&$XXx;........:;+xx++;:....................\r\n+xxxxxxxX$&&&$$XxxxxX$&&&&&&$XXx;:......::;+x+;+;:....:...............\r\n++xxxxxxxX$&&&&&&X+x$&&&&&&&&Xxx;.........:;;;::.......:..............\r\n+++xxxxxxxX$$&&&$XxXXX$XxX&&&$X+:.:;;::::::;;::.......................\r\n++++xxxxx+xxXXXX$$$$xx$$+x$Xx++;;:.:::::;;:.:.........................\r\n++++xxxxxxxxXXxX&&&$$&&&XX$Xx;;;;;::....:;;;:..........:..............\r\n++xxxxxxxxxX$X++$&&&&&$$$$&&X+;::::::...::;;;;:.........:::...........\r\n+xxXXXXXXx+xXXx+xX$&&&&&XX&&$x+;;:++;;;:;;;;:::;:.....................\r\n+xxXXXXXXxxxxXXX$x;;;xX&&$$&&x+Xx;xx;;+;x+;:....::;;:::.....::::......\r\n++xXXXXXXxXXxX$X$x:;:::;$$XXX;:+x:;;:;;::::.......:;+x+;;;;;;;::..::::\r\n++xXXXXXXxXxxxxxx++;::..:;;::;::;:.................:;+;:::::::;;;;;;::\r\n+xXXXXXXxxxxxxxxXXXX+;:....:........................::::..............\r\nxxxXXxxxxxxXXxxXXXX&$x+:............................::::..............\r\nxxxxXXXXxxxxXXXXXXX$&$Xx;:::........................:;:::::...........\r\nxxxxXXXXXxxXxxxxxxxxX$$XX$x+:.......................:::;::............\r\nXXXXXXXXxxxXXXxx++xXXXXX$&$Xx;;;;:::::...................::::.........\r\nXXXXXXXXXxxxxxx++x++XXXXXX$$xXXxxX$X+;:..............................."); } public void PlaySoundAtPosition(Vector3 pos, AudioClip clip, bool randomize = true, bool spatial3D = true) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(SCP513_1AI.Instance.soundObjectPrefab, pos, Quaternion.identity); AudioSource component = val.GetComponent<AudioSource>(); if (randomize) { component.pitch = Random.Range(0.94f, 1.06f); } if (!spatial3D) { component.spatialBlend = 0f; } component.clip = clip; component.Play(); Object.Destroy((Object)(object)val, component.clip.length); } public void PlaySoundAtPosition(Vector3 pos, AudioClip[] clips, bool randomize = true, bool spatial3D = true) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(SCP513_1AI.Instance.soundObjectPrefab, pos, Quaternion.identity); AudioSource component = val.GetComponent<AudioSource>(); if (randomize) { component.pitch = Random.Range(0.94f, 1.06f); } if (!spatial3D) { component.spatialBlend = 0f; } int num = Random.Range(0, clips.Length); component.clip = clips[num]; component.Play(); Object.Destroy((Object)(object)val, component.clip.length); } public static List<DoorLock> GetDoorLocksNearbyPosition(Vector3 pos, float distance) { //IL_0026: 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) List<DoorLock> list = new List<DoorLock>(); DoorLock[] array = Object.FindObjectsOfType<DoorLock>(); foreach (DoorLock val in array) { if (!((Object)(object)val == (Object)null) && Vector3.Distance(pos, ((Component)val).transform.position) < distance) { list.Add(val); } } return list; } public Transform GetClosestNode(Vector3 pos, bool outside = true) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) GameObject[] array; if (outside && !Utils.inTestRoom) { if (RoundManager.Instance.outsideAINodes == null || RoundManager.Instance.outsideAINodes.Length == 0) { RoundManager.Instance.outsideAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); Plugin.logger.LogDebug((object)("Found OutsideAINodes: " + RoundManager.Instance.outsideAINodes.Length)); } array = RoundManager.Instance.outsideAINodes; } else { if (RoundManager.Instance.insideAINodes == null || RoundManager.Instance.insideAINodes.Length == 0) { RoundManager.Instance.insideAINodes = GameObject.FindGameObjectsWithTag("AINode"); Plugin.logger.LogDebug((object)("Found AINodes: " + RoundManager.Instance.insideAINodes.Length)); } array = RoundManager.Instance.insideAINodes; } Plugin.logger.LogDebug((object)("Node count: " + array.Length)); float num = float.PositiveInfinity; GameObject val = null; GameObject[] array2 = array; foreach (GameObject val2 in array2) { if (!((Object)(object)val2 == (Object)null)) { float num2 = Vector3.Distance(pos, val2.transform.position); if (num2 < num) { num = num2; val = val2; } } } return val.transform; } public string GetClock(float timeNormalized, float numberOfHours, bool createNewLine = true) { int num = (int)(timeNormalized * (60f * numberOfHours)) + 360; int num2 = (int)Mathf.Floor((float)(num / 60)); string text = (createNewLine ? "\n" : " "); string text2 = text + "AM"; if (num2 >= 24) { return "12:00\nAM"; } text2 = ((num2 >= 12) ? (text + "PM") : (text + "AM")); if (num2 > 12) { num2 %= 12; } int num3 = num % 60; return $"{num2:00}:{num3:00}".TrimStart('0') + text2; } public unsafe static GameObject SpawnDeadBody(PlayerControllerB deadPlayerController, Vector3 spawnPosition, int causeOfDeath = 0, int deathAnimation = 0, Vector3 positionOffset = default(Vector3)) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Invalid comparison between Unknown and I4 float num = 1.32f; GameObject val = Object.Instantiate<GameObject>(deadPlayerController.playersManager.playerRagdolls[deathAnimation], spawnPosition + Vector3.up * num + positionOffset, Quaternion.identity); DeadBodyInfo component = val.GetComponent<DeadBodyInfo>(); component.overrideSpawnPosition = true; if ((Object)(object)deadPlayerController.physicsParent != (Object)null) { component.SetPhysicsParent(deadPlayerController.physicsParent, (Collider)null); } component.parentedToShip = false; component.playerObjectId = (int)deadPlayerController.actualClientId; for (int i = 0; i < deadPlayerController.bodyBloodDecals.Length; i++) { component.bodyBloodDecals[i].SetActive(deadPlayerController.bodyBloodDecals[i].activeSelf); } ScanNodeProperties componentInChildren = ((Component)component).gameObject.GetComponentInChildren<ScanNodeProperties>(); componentInChildren.headerText = "Body of " + deadPlayerController.playerUsername; CauseOfDeath val2 = (CauseOfDeath)causeOfDeath; componentInChildren.subText = "Cause of death: " + ((object)(*(CauseOfDeath*)(&val2))/*cast due to .constrained prefix*/).ToString(); component.causeOfDeath = val2; if ((int)val2 == 1 || (int)val2 == 6 || (int)val2 == 7) { component.MakeCorpseBloody(); } return val; } } [HarmonyPatch] public class HallucinationManagerPatches { [HarmonyPrefix] [HarmonyPatch(typeof(GrabbableObject), "LateUpdate")] public static bool LateUpdatePrefix(GrabbableObject __instance) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_005e: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) try { if (HallucinationManager.overrideShotguns.Contains(__instance)) { if ((Object)(object)__instance.parentObject != (Object)null) { Vector3 val = HallucinationManager.overrideShotgunsRotOffsets[__instance]; Vector3 val2 = HallucinationManager.overrideShotgunsPosOffsets[__instance]; ((Component)__instance).transform.rotation = __instance.parentObject.rotation; ((Component)__instance).transform.Rotate(val); ((Component)__instance).transform.position = __instance.parentObject.position; Vector3 val3 = val2; val3 = __instance.parentObject.rotation * val3; Transform transform = ((Component)__instance).transform; transform.position += val3; } if ((Object)(object)__instance.radarIcon != (Object)null) { __instance.radarIcon.position = ((Component)__instance).transform.position; } return false; } return true; } catch { return true; } } } public class SCP513Behavior : PhysicsProp, ISingletonItem, ISCP { public SCPInfo info = null; public AudioSource audioSource = null; public AudioClip[] bellSFX = null; public GameObject SCP513_1Prefab = null; private const float maxFallDistance = 1f; private const float ringCooldown = 3f; private float timeSinceLastRing; private float timeHeldByPlayer; private Vector2 lastCameraAngles; public static bool localPlayerHaunted; private const float maxTurnSpeed = 1000f; public static SCP513Behavior? Instance { get; private set; } SCPInfo ISCP.SCPInfo => info; public static bool unhauntedOnBellDespawn { get; private set; } [InitConfig] public static void InitConfigs() { unhauntedOnBellDespawn = ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<bool>("SCP-513 Options", "SCP-513 | Unhaunted on bell despawn", false, "When true, if the bell is despawned or sold to the company, all haunted players will become unhaunted.").Value; } public override void Update() { ((GrabbableObject)this).Update(); if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || (Object)(object)Plugin.localPlayer != (Object)(object)((GrabbableObject)this).playerHeldBy) { timeHeldByPlayer = 0f; return; } timeSinceLastRing += Time.deltaTime; timeHeldByPlayer += Time.deltaTime; TrackCameraMovement(); if ((((GrabbableObject)this).playerHeldBy.isJumping || ((GrabbableObject)this).playerHeldBy.isFallingFromJump || ((GrabbableObject)this).playerHeldBy.isSprinting || ((GrabbableObject)this).playerHeldBy.takingFallDamage) && !(timeSinceLastRing < 3f) && !((GrabbableObject)this).playerHeldBy.isCrouching && !((GrabbableObject)this).playerHeldBy.inSpecialInteractAnimation) { RingBellRpc(); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (!((Object)(object)Instance != (Object)null) || !((Object)(object)Instance != (Object)(object)this)) { Instance = this; } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; PlayerControllerBExtensions.FreezePlayer(Plugin.localPlayer, false); if (unhauntedOnBellDespawn) { localPlayerHaunted = false; } } } public override void OnHitGround() { ((GrabbableObject)this).OnHitGround(); if (Plugin.IsServerOrHost) { float num = ((GrabbableObject)this).startFallingPosition.y - ((GrabbableObject)this).targetFloorPosition.y; Plugin.logger.LogDebug((object)("FallDistance: " + num)); if (num > 1f) { RingBellRpc(); } } } private void TrackCameraMovement() { //IL_0013: 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_0047: 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) //IL_006c: 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_0082: 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) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.eulerAngles.x, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.eulerAngles.y); float num = Mathf.DeltaAngle(lastCameraAngles.x, val.x); float num2 = Mathf.DeltaAngle(lastCameraAngles.y, val.y); Vector2 val2 = new Vector2(num, num2); float num3 = ((Vector2)(ref val2)).magnitude / Time.deltaTime; lastCameraAngles = val; if (num3 > 1000f && timeHeldByPlayer > 1f && !(timeSinceLastRing < 3f) && !((GrabbableObject)this).playerHeldBy.isClimbingLadder && !((GrabbableObject)this).playerHeldBy.inSpecialInteractAnimation) { RingBellRpc(); } } [Rpc(/*Could not decode attribute arguments.*/)] public void RingBellRpc() { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(454832042u, val3, val, (SendTo)6, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 454832042u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; timeSinceLastRing = 0f; RoundManager.PlayRandomClip(audioSource, bellSFX, true, 1f, 0, 1000); if (!localPlayerHaunted && Vector3.Distance(((Component)this).transform.position, ((Component)Plugin.localPlayer.bodyParts[0]).transform.position) <= audioSource.maxDistance) { Plugin.logger.LogDebug((object)"This player is haunted"); localPlayerHaunted = true; } } } protected override void __initializeVariables() { ((PhysicsProp)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 ((NetworkBehaviour)this).__registerRpc(454832042u, new RpcReceiveHandler(__rpc_handler_454832042), "RingBellRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_454832042(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; ((SCP513Behavior)(object)target).RingBellRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SCP513Behavior"; } } [HarmonyPatch] internal class SCP513Patches { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void ConnectClientToPlayerObjectPostfix() { try { if (ES3.KeyExists("LocalPlayerHauntedByBell", GameNetworkManager.Instance.currentSaveFileName)) { SCP513Behavior.localPlayerHaunted = ES3.Load<bool>("LocalPlayerHauntedByBell", GameNetworkManager.Instance.currentSaveFileName); } } catch { } } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "SaveLocalPlayerValues")] public static void SaveLocalPlayerValuesPostfix() { try { ES3.Save<bool>("LocalPlayerHauntedByBell", SCP513Behavior.localPlayerHaunted, GameNetworkManager.Instance.currentSaveFileName); } catch { } } } public class SCP513_1AI : MonoBehaviour { public enum State { InActive, Manifesting, Chasing, Stalking, MimicPlayer } public NavMeshAgent agent = null; public Animator creatureAnimator = null; public AudioSource creatureSFX = null; public AudioSource creatureVoice = null; public Transform turnCompass = null; public GameObject enemyMesh = null; public GameObject scanNode = null; public AudioClip[] bellSFX = null; public AudioClip[] ambientSFX = null; public AudioClip[] scareSFX = null; public AudioClip[] stepChaseSFX = null; public AudioClip[] minorSoundEffectSFX = null; public AudioClip[] majorSoundEffectSFX = null; public GameObject soundObjectPrefab = null; [HideInInspector] public float AIIntervalTime = 0.2f; [HideInInspector] public bool gotFarthestNodeAsync; [HideInInspector] public float updateDestinationInterval; [HideInInspector] public NavMeshPath? path1; [HideInInspector] public bool moveTowardsDestination; [HideInInspector] public Vector3 destination; [HideInInspector] public float mostOptimalDistance; [HideInInspector] public Transform? targetNode; [HideInInspector] public GameObject[] nodesTempArray = Array.Empty<GameObject>(); [HideInInspector] public float pathDistance; [HideInInspector] public int getFarthestNodeAsyncBookmark; public State currentBehaviourState; [HideInInspector] public EnemyAI? mimicEnemy; private Coroutine? mimicEnemyRoutine; [HideInInspector] public PlayerControllerB? mimicPlayer; private bool enemyMeshEnabled; [HideInInspector] public bool facePlayer; private float cooldownMultiplier; private float timeSinceCommonEvent; private float timeSinceUncommonEvent; private float timeSinceRareEvent; private float nextCommonEventTime; private float nextUncommonEventTime; private float nextRareEventTime; private int currentFootstepSurfaceIndex; private int previousFootstepClip; private float stareTime; public bool playerHasLOS; private Transform? farthestNodeFromTargetPlayer; private bool gettingFarthestNodeFromPlayerAsync; private int maxAsync; private bool stalkRetreating; private float evadeStealthTimer; private bool wasInEvadeMode; private int hashRunSpeed; private const float maxInsanity = 50f; private const float maxInsanityThreshold = 35f; private const float minCooldown = 0.5f; private const float maxCooldown = 1f; public const float LOSAngle = 45f; public const float LOSOffset = 1f; private float commonEventMinCooldown = 5f; private float commonEventMaxCooldown = 15f; private float uncommonEventMinCooldown = 15f; private float uncommonEventMaxCooldown = 30f; private float rareEventMinCooldown = 100f; private float rareEventMaxCooldown = 200f; public static SCP513_1AI? Instance { get; private set; } [HideInInspector] public bool isOutside => !Plugin.localPlayer.isInsideFactory; [HideInInspector] public GameObject[] allAINodes => isOutside ? Utils.outsideAINodes : Utils.insideAINodes; public void Start() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown Plugin.logger.LogDebug((object)"SCP-513-1 spawned"); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; path1 = new NavMeshPath(); hashRunSpeed = Animator.StringToHash("speed"); currentBehaviourState = State.InActive; nextCommonEventTime = commonEventMaxCooldown; nextUncommonEventTime = uncommonEventMaxCooldown; nextRareEventTime = rareEventMaxCooldown; } public void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null;