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 Something v0.4.2
plugins/Snowlance.Something.dll
Decompiled a week 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.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using Snowlance.Something.NetcodePatcher; using SnowyLib; using Something.Enemies; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.UI; [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("Snowlance.Something")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.4.2.0")] [assembly: AssemblyInformationalVersion("0.4.2+bed489e941ff9ea5e6b38cd5e264b16d9a00c7f4")] [assembly: AssemblyProduct("Something")] [assembly: AssemblyTitle("Snowlance.Something")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Something { internal static class Configs { public static int goodWeight => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<int>("Good Weight").Value; public static int badWeight => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<int>("Bad Weight").Value; public static int cursedWeight => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<int>("Cursed Weight").Value; public static BoundedRange goodValue => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<BoundedRange>("Good Value").Value; public static BoundedRange badValue => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<BoundedRange>("Bad Value").Value; public static BoundedRange cursedValue => ((AssetBundleLoader<SomethingContentHandler.PolaroidAssets>)(object)ContentHandler<SomethingContentHandler>.Instance.Polaroid).GetConfig<BoundedRange>("Cursed Value").Value; } [BepInPlugin("Snowlance.Something", "Something", "0.4.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static Plugin Instance; private readonly Harmony harmony = new Harmony("Snowlance.Something"); public const float turnCompassSpeedGlobal = 50f; public static ManualLogSource logger { get; private set; } public static DuskMod Mod { get; private set; } public static ConfigEntry<bool> configMinimalSpoilerVersion { get; private set; } public static PlayerControllerB localPlayer => GameNetworkManager.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).First(); } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)Instance).Logger; harmony.PatchAll(); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "something_mainassets")); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); InitializeNetworkBehaviours(); InitConfigs(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.Something v0.4.2 has loaded!"); } private void InitConfigs() { configMinimalSpoilerVersion = ((BaseUnityPlugin)this).Config.Bind<bool>("Spoilers", "Minimal Spoiler Version", true, "Replaces most spoilers for the game with alternatives."); } 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"); } } public class SomethingContentHandler : ContentHandler<SomethingContentHandler> { public class AubreyPlushAssets : AssetBundleLoader<AubreyPlushAssets> { public AubreyPlushAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BasilPlushAssets : AssetBundleLoader<BasilPlushAssets> { public BasilPlushAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class BunnybunAssets : AssetBundleLoader<BunnybunAssets> { public BunnybunAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class KeytarAssets : AssetBundleLoader<KeytarAssets> { public KeytarAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class MailboxAssets : AssetBundleLoader<MailboxAssets> { public MailboxAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class PolaroidAssets : AssetBundleLoader<PolaroidAssets> { public PolaroidAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class RabbitAssets : AssetBundleLoader<RabbitAssets> { public RabbitAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class SomethingAssets : AssetBundleLoader<SomethingAssets> { public SomethingAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public AubreyPlushAssets? AubreyPlush; public BasilPlushAssets? BasilPlush; public BunnybunAssets? Bunnybun; public KeytarAssets? Keytar; public MailboxAssets? Mailbox; public PolaroidAssets? Polaroid; public RabbitAssets? Rabbit; public SomethingAssets? Something; public SomethingContentHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent<AubreyPlushAssets>("aubrey_plush", ref AubreyPlush, false); ((ContentHandler)this).RegisterContent<BasilPlushAssets>("basil_plush", ref BasilPlush, false); ((ContentHandler)this).RegisterContent<BunnybunAssets>("bunnybun", ref Bunnybun, false); ((ContentHandler)this).RegisterContent<KeytarAssets>("keytar", ref Keytar, false); ((ContentHandler)this).RegisterContent<MailboxAssets>("mailbox", ref Mailbox, false); ((ContentHandler)this).RegisterContent<PolaroidAssets>("polaroid", ref Polaroid, false); ((ContentHandler)this).RegisterContent<RabbitAssets>("rabbit", ref Rabbit, false); ((ContentHandler)this).RegisterContent<SomethingAssets>("something", ref Something, false); } } internal class SomethingInputs : LcInputActions { public static SomethingInputs Instance = new SomethingInputs(); public string BreathKey_BindingDisplayString => InputActionRebindingExtensions.GetBindingDisplayString(BreathKey, StartOfRound.Instance.localPlayerUsingController ? 1 : 0, (DisplayStringOptions)0); [InputAction(/*Could not decode attribute arguments.*/)] public InputAction BreathKey { get; set; } = null; } public static class SomethingKeys { public const string Namespace = "something"; internal static NamespacedKey LastVersion = NamespacedKey.From("something", "last_version"); public static readonly NamespacedKey<DawnEnemyInfo> Something = NamespacedKey<DawnEnemyInfo>.From("something", "something"); public static readonly NamespacedKey<DawnEnemyInfo> Rabbit = NamespacedKey<DawnEnemyInfo>.From("something", "rabbit"); public static readonly NamespacedKey<DawnItemInfo> AubreyPlush = NamespacedKey<DawnItemInfo>.From("something", "aubrey_plush"); public static readonly NamespacedKey<DawnItemInfo> BasilPlush = NamespacedKey<DawnItemInfo>.From("something", "basil_plush"); public static readonly NamespacedKey<DawnItemInfo> Bunnybun = NamespacedKey<DawnItemInfo>.From("something", "bunnybun"); public static readonly NamespacedKey<DawnItemInfo> Keytar = NamespacedKey<DawnItemInfo>.From("something", "keytar"); public static readonly NamespacedKey<DawnItemInfo> Mailbox = NamespacedKey<DawnItemInfo>.From("something", "mailbox"); public static readonly NamespacedKey<DawnItemInfo> Polaroid = NamespacedKey<DawnItemInfo>.From("something", "polaroid"); } [HarmonyPatch] public class TESTING : MonoBehaviour { [HarmonyPostfix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] public static void PingScan_performedPostFix() { try { if (Utils.testing) { } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public static void SubmitChat_performedPrefix(HUDManager __instance) { try { if (Utils.testing) { string text = __instance.chatTextField.text; string[] array = text.Split(" "); Plugin.logger.LogDebug((object)text); string text2 = array[0]; string text3 = text2; if (text3 == "/index") { SpringCatAI.SpringCatKillIndex = int.Parse(array[1]); HUDManager.Instance.DisplayTip("SpringCatKillIndex", SpringCatAI.SpringCatKillIndex.ToString(), false, false, "LC_Tip1"); } else { Utils.ChatCommand(array); } } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Snowlance.Something"; public const string PLUGIN_NAME = "Something"; public const string PLUGIN_VERSION = "0.4.2"; } } namespace Something.Items { internal class BunnyBunBehavior : PhysicsProp { public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((PhysicsProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "BunnyBunBehavior"; } } internal class KeytarBehavior : PhysicsProp { public AudioSource ItemAudio; public AudioClip[] songs; private PlayerControllerB previousPlayerHeldBy; private int songIndex; public override void EquipItem() { ((PhysicsProp)this).EquipItem(); previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", true); } public override void DiscardItem() { previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); ((GrabbableObject)this).DiscardItem(); } public override void PocketItem() { previousPlayerHeldBy.playerBodyAnimator.SetBool("reelingUp", false); ((GrabbableObject)this).PocketItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { ItemAudio.Stop(); ItemAudio.clip = songs[songIndex]; ItemAudio.Play(); if (songIndex >= songs.Length - 1) { songIndex = 0; } else { songIndex++; } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((PhysicsProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "KeytarBehavior"; } } public class PolaroidBehavior : PhysicsProp { public AudioSource audioSource = null; public SpriteRenderer renderer = null; public Animator animator = null; public Sprite[] goodPhotos = null; public Sprite[] altGoodPhotos = null; public Sprite[] badPhotos = null; public Sprite[] altBadPhotos = null; private bool isLocalPlayerCursed; private int photoType; private int photoIndex; public override void Start() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ((GrabbableObject)this).Start(); if (!((NetworkBehaviour)this).IsServer) { return; } Utils.OnShipLanded.AddListener(new UnityAction(OnShipLanded)); if (!((GrabbableObject)this).hasBeenHeld) { photoType = RoundManager.Instance.GetRandomWeightedIndex(new int[3] { Configs.goodWeight, Configs.badWeight, Configs.cursedWeight }, (Random)null); BoundedRange val = Configs.cursedValue; if (photoType != 2) { val = ((photoType == 0) ? Configs.goodValue : Configs.badValue); Sprite[] array = ((photoType == 0) ? goodPhotos : badPhotos); photoIndex = Random.Range(0, array.Length); } ChangeSpriteClientRpc(photoType, photoIndex, (int)val.GetRandomInRange(Utils.randomLocal)); } } private void OnShipLanded() { if (isLocalPlayerCursed) { SpawnSomethingServerRpc(Plugin.localPlayer.actualClientId); } } public override void EquipItem() { if (!((GrabbableObject)this).hasBeenHeld && (photoType == 2 || (photoType == 1 && Random.Range(0f, 1f) < 0.5f))) { if (photoType == 2) { string trigger = (Plugin.configMinimalSpoilerVersion.Value ? "playalt" : "play"); ((Behaviour)animator).enabled = true; animator.SetTrigger(trigger); if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)(object)Plugin.localPlayer) { audioSource.Play(); isLocalPlayerCursed = true; } } if (((NetworkBehaviour)this).IsServer) { SpawnSomethingOnServer(((GrabbableObject)this).playerHeldBy); } } ((PhysicsProp)this).EquipItem(); } public override void EnableItemMeshes(bool enable) { ((GrabbableObject)this).EnableItemMeshes(enable); ((Renderer)renderer).enabled = enable; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).hasBeenHeld = true; Decode(saveData, out var type, out var index); ChangeSprite(type, index); } public override int GetItemDataToSave() { return Encode(photoType, photoIndex); } public int GetAltPhotoIndex() { if (photoType == 2) { return -1; } int num = ((photoType == 0) ? goodPhotos.Length : badPhotos.Length); int num2 = ((photoType == 0) ? altGoodPhotos.Length : altBadPhotos.Length); return photoIndex * num2 / num; } private int Encode(int type, int index) { return (type << 8) | index; } private void Decode(int value, out int type, out int index) { index = value & 0xFF; type = (value >> 8) & 3; } public void ChangeSprite(int type, int index) { photoType = type; photoIndex = index; if (photoType != 2) { bool value = Plugin.configMinimalSpoilerVersion.Value; int num = (value ? GetAltPhotoIndex() : index); Sprite[] array = ((photoType != 0) ? (value ? altBadPhotos : badPhotos) : (value ? altGoodPhotos : goodPhotos)); renderer.sprite = array[num]; Plugin.logger.LogDebug((object)$"Changed sprite: {photoType}-{photoIndex}"); } } private void SpawnSomethingOnServer(PlayerControllerB playerToHaunt) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer && !StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving && ContentHandler<SomethingContentHandler>.Instance != null && ContentHandler<SomethingContentHandler>.Instance.Something != null) { SomethingAI somethingAI = (SomethingAI)(object)Utils.SpawnEnemy(SomethingKeys.Something, Vector3.zero, Quaternion.identity); somethingAI.ChangeTargetPlayerClientRpc(playerToHaunt.actualClientId); } } [ClientRpc] public void ChangeSpriteClientRpc(int type, int index, int scrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(137324418u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, type); BytePacker.WriteValueBitPacked(val2, index); BytePacker.WriteValueBitPacked(val2, scrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 137324418u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ChangeSprite(type, index); ((GrabbableObject)this).SetScrapValue(scrapValue); } } } [ServerRpc(RequireOwnership = false)] public void SpawnSomethingServerRpc(ulong hauntedPlayerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(72547334u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, hauntedPlayerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 72547334u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { PlayerControllerB val3 = Plugin.PlayerFromId(hauntedPlayerId); if (!((Object)(object)val3 == (Object)null)) { SpawnSomethingOnServer(val3); } } } 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 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(137324418u, new RpcReceiveHandler(__rpc_handler_137324418), "ChangeSpriteClientRpc"); ((NetworkBehaviour)this).__registerRpc(72547334u, new RpcReceiveHandler(__rpc_handler_72547334), "SpawnSomethingServerRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_137324418(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_003d: 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_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int type = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref type); int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((PolaroidBehavior)(object)target).ChangeSpriteClientRpc(type, index, scrapValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_72547334(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 hauntedPlayerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref hauntedPlayerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PolaroidBehavior)(object)target).SpawnSomethingServerRpc(hauntedPlayerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PolaroidBehavior"; } } internal class SweetheartsMorgenshternBehavior : PhysicsProp { protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((PhysicsProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SweetheartsMorgenshternBehavior"; } } } namespace Something.Enemies { internal class RabbitAI : EnemyAI { public Transform turnCompass; public override void Start() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"Rabbit spawned"); ((EnemyAI)this).Start(); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); } public override void Update() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (Plugin.localPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 0.25f, 80f, 5, 1f, -1)) { Plugin.localPlayer.JumpToFearLevel(1f, true); } } public void LateUpdate() { //IL_0016: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 50f * Time.deltaTime); } public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) ((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID); if ((Object)(object)playerWhoHit != (Object)null && (Object)(object)playerWhoHit == (Object)(object)Plugin.localPlayer) { playerWhoHit.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 7, default(Vector3), false); } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { ((EnemyAI)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RabbitAI"; } } internal class SomethingAI : EnemyAI { public enum State { Inactive, Staring, Chasing } [CompilerGenerated] private sealed class <<OnCollideWithPlayer>g__KillPlayerCoroutine|54_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SomethingAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<OnCollideWithPlayer>g__KillPlayerCoroutine|54_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; Plugin.logger.LogDebug((object)"In KillPlayerCoroutine()"); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.FreezePlayerCoroutine(Plugin.localPlayer, 3f)); <>4__this.SetVisibility(enable: false); ((EnemyAI)<>4__this).creatureVoice.Stop(); <>4__this.hudOverlay.audioSource.volume = 1f; RoundManager.PlayRandomClip(<>4__this.hudOverlay.audioSource, <>4__this.attackSFX, true, 1f, 0, 1000); <>4__this.hudOverlay.JumpscarePlayer(3f, destroy: true); <>2__current = (object)new WaitForSeconds(3f); <>1__state = 2; return true; case 2: <>1__state = -1; Plugin.localPlayer.KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 0, default(Vector3), false); <>4__this.KillPlayerClientRpc(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FreezePlayerCoroutine>d__44 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB player; public float freezeTime; public SomethingAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FreezePlayerCoroutine>d__44(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; PlayerControllerBExtensions.FreezePlayer(player, true); <>2__current = (object)new WaitForSeconds(freezeTime); <>1__state = 1; return true; case 1: <>1__state = -1; PlayerControllerBExtensions.FreezePlayer(player, false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Transform turnCompass; public GameObject lesserSomethingPrefab; public GameObject tinySomethingPrefab; public AudioClip disappearSFX; public AudioClip[] ambientSFX; public AudioClip[] attackSFX; public SpriteRenderer somethingMesh; public GameObject ScanNode; public GameObject BreathingMechanicPrefab; private SomethingHUDOverlay hudOverlay; private bool enemyMeshEnabled; private float nextSpawnTimeLS; private float timeWithoutTargetPlayer; private float timeSinceSpawnLS; private float timeSinceTryStare; private float timeSinceChaseAttempt; private float timeSinceAIUpdate; private float timeSinceSwitchBehaviour; private const float maxInsanity = 50f; private const float lsMinSpawnTime = 10f; private const float lsMaxSpawnTime = 30f; private const float lsAmount = 0.1f; private const float tsAmount = 0.7f; private const float stareCooldown = 20f; private const float stareBufferTime = 5f; private const float maxStareTime = 10f; private const float insanityIncreaseOnLook = 10f; private const float somethingChaseSpeed = 10f; private const float chaseCooldown = 5f; private const float insanityPhase1 = 0f; private const float insanityPhase2 = 0.15f; private const float insanityPhase3 = 0.3f; private const float choosePlayerToHauntCooldown = 5f; private const float AIIntervalTime = 0.2f; private GameObject[] allAINodes => Utils.insideAINodes; private bool isHauntingLocalPlayer => (Object)(object)base.targetPlayer == (Object)(object)Plugin.localPlayer; public override void Update() { if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)base.targetPlayer == (Object)null) { timeWithoutTargetPlayer += Time.deltaTime; } if (timeWithoutTargetPlayer > 5f && (Object)(object)base.targetPlayer == (Object)null) { timeWithoutTargetPlayer = 0f; ChoosePlayerToHaunt(); } } if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerControlled) { base.targetPlayer = null; } if (!((NetworkBehaviour)this).IsOwner) { SetVisibility(enable: false); } else if ((Object)(object)base.targetPlayer != (Object)null && !isHauntingLocalPlayer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } else if (!((Object)(object)base.targetPlayer == (Object)null) && base.targetPlayer.isPlayerControlled) { float num = base.targetPlayer.insanityLevel / 50f; base.targetPlayer.playersManager.fearLevel = Mathf.Max(base.targetPlayer.playersManager.fearLevel, num); timeSinceSpawnLS += Time.deltaTime; timeSinceTryStare += Time.deltaTime; timeSinceChaseAttempt += Time.deltaTime; timeSinceAIUpdate += Time.deltaTime; timeSinceSwitchBehaviour += Time.deltaTime; if (timeSinceAIUpdate > 0.2f) { timeSinceAIUpdate = 0f; ((EnemyAI)this).DoAIInterval(); } } } public void LateUpdate() { //IL_0016: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 50f * Time.deltaTime); } public override void DoAIInterval() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) if (base.inSpecialAnimation || (Object)(object)base.targetPlayer == (Object)null) { StopAgent(); return; } SetVisibility(base.currentBehaviourStateIndex != 0 && base.targetPlayer.isPlayerControlled && isHauntingLocalPlayer); if (((Behaviour)base.agent).enabled && base.moveTowardsDestination) { base.agent.SetDestination(base.destination); } if (timeSinceSpawnLS > nextSpawnTimeLS && 0f <= base.targetPlayer.insanityLevel) { timeSinceSpawnLS = 0f; nextSpawnTimeLS = Random.Range(10f, 30f); SpawnLittleOnes(); if (7.5000005f <= base.targetPlayer.insanityLevel) { SpawnLesserSomethings(); } } switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 0f; if (!base.targetPlayer.isInsideFactory) { break; } if (base.targetPlayer.insanityLevel >= 50f && timeSinceChaseAttempt > 5f && base.targetPlayer.isPlayerAlone) { timeSinceChaseAttempt = 0f; Plugin.logger.LogDebug((object)"Trying to start chase"); base.targetNode = ChoosePositionInFrontOfPlayer(5f); if ((Object)(object)base.targetNode != (Object)null) { ((MonoBehaviour)this).StartCoroutine(FreezePlayerCoroutine(base.targetPlayer, 3f)); Teleport(base.targetNode.position); SetVisibility(enable: true); base.inSpecialAnimation = true; base.creatureAnimator.SetTrigger("spawn"); SwitchToBehaviourStateOnLocalClient(2); break; } } if (15.000001f <= base.targetPlayer.insanityLevel && timeSinceTryStare > 20f) { Plugin.logger.LogDebug((object)"Attempting stare player"); base.targetNode = TryFindingHauntPosition(); if ((Object)(object)base.targetNode != (Object)null) { Teleport(base.targetNode.position); RoundManager.PlayRandomClip(base.creatureVoice, ambientSFX, true, 1f, 0, 1000); SwitchToBehaviourStateOnLocalClient(1); } else { timeSinceTryStare = 15f; } } break; case 1: if (base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f, -1)) { timeSinceTryStare = 0f; PlayerControllerB targetPlayer = base.targetPlayer; targetPlayer.insanityLevel += 10f; if (base.targetPlayer.insanityLevel >= 50f) { SwitchToBehaviourStateOnLocalClient(2); base.creatureVoice.Play(); break; } base.inSpecialAnimation = true; base.creatureAnimator.SetTrigger("despawn"); base.creatureSFX.PlayOneShot(disappearSFX); SwitchToBehaviourStateOnLocalClient(0); } else if (timeSinceSwitchBehaviour > 10f) { SwitchToBehaviourStateOnLocalClient(0); } break; case 2: base.agent.speed = 10f; if (!base.targetPlayer.isPlayerAlone || !base.targetPlayer.isInsideFactory) { base.creatureVoice.Stop(); SwitchToBehaviourStateOnLocalClient(0); } else { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); } break; default: Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex)); break; } } public void StopAgent() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)base.agent).enabled && base.agent.isOnNavMesh) { base.agent.ResetPath(); } base.agent.velocity = Vector3.zero; } public static bool IsPlayerHaunted(PlayerControllerB player) { if (StartOfRound.Instance.inShipPhase) { return false; } foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies) { if (spawnedEnemy is SomethingAI && (Object)(object)spawnedEnemy.targetPlayer == (Object)(object)player) { return true; } } return false; } [IteratorStateMachine(typeof(<FreezePlayerCoroutine>d__44))] private IEnumerator FreezePlayerCoroutine(PlayerControllerB player, float freezeTime) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FreezePlayerCoroutine>d__44(0) { <>4__this = this, player = player, freezeTime = freezeTime }; } private Transform? TryFindingHauntPosition(bool mustBeInLOS = true) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (base.targetPlayer.isInsideFactory) { for (int i = 0; i < allAINodes.Length; i++) { if ((!mustBeInLOS || !Physics.Linecast(((Component)base.targetPlayer.gameplayCamera).transform.position, allAINodes[i].transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) && !base.targetPlayer.HasLineOfSightToPosition(allAINodes[i].transform.position, 80f, 100, 8f, -1)) { return allAINodes[i].transform; } } } return null; } public Transform? ChoosePositionInFrontOfPlayer(float minDistance) { //IL_006b: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"Choosing position in front of player"); Transform result = null; Plugin.logger.LogDebug((object)(allAINodes.Count() + " ai nodes")); GameObject[] array = allAINodes; foreach (GameObject val in array) { if (!((Object)(object)val == (Object)null)) { Vector3 val2 = val.transform.position + Vector3.up * 0.5f; Vector3 position = ((Component)base.targetPlayer.gameplayCamera).transform.position; float num = Vector3.Distance(position, val2); if (!(num < minDistance) && !Physics.Linecast(val2, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault) && base.targetPlayer.HasLineOfSightToPosition(val2, 45f, 60, -1f, -1)) { base.mostOptimalDistance = num; result = val.transform; } } } Plugin.logger.LogDebug((object)"null: {targetNode == null}"); return result; } public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false, bool tamperWithMeshes = false) { } public void SetVisibility(bool enable) { if (enemyMeshEnabled != enable) { Plugin.logger.LogDebug((object)$"SetVisibility({enable})"); ((Renderer)somethingMesh).enabled = enable; ScanNode.SetActive(enable); enemyMeshEnabled = enable; } } private Vector3 FindPositionOutOfLOS() { //IL_000e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) base.targetNode = ((EnemyAI)this).ChooseClosestNodeToPosition(((Component)base.targetPlayer).transform.position, true, 0); return RoundManager.Instance.GetNavMeshPosition(base.targetNode.position, default(NavMeshHit), 5f, -1); } private void ChoosePlayerToHaunt() { if (StartOfRound.Instance.inShipPhase || StartOfRound.Instance.shipIsLeaving) { return; } Plugin.logger.LogDebug((object)"Starting ChoosePlayerToHaunt()"); float num = 0f; float num2 = 0f; int num3 = 0; int num4 = 0; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount > num3) { num3 = StartOfRound.Instance.gameStats.allPlayerStats[i].turnAmount; num4 = i; } if (StartOfRound.Instance.allPlayerScripts[i].insanityLevel > num) { num = StartOfRound.Instance.allPlayerScripts[i].insanityLevel; num2 = i; } } int[] array = new int[StartOfRound.Instance.allPlayerScripts.Length]; for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++) { if (!StartOfRound.Instance.allPlayerScripts[j].isPlayerControlled) { array[j] = 0; Plugin.logger.LogDebug((object)"{StartOfRound.Instance.allPlayerScripts[j].playerUsername}: {playerScores[j]}"); continue; } array[j] += 80; if (num2 == (float)j && num > 1f) { array[j] += 50; } if (num4 == j) { array[j] += 30; } if (!StartOfRound.Instance.allPlayerScripts[j].hasBeenCriticallyInjured) { array[j] += 10; } if ((Object)(object)StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer != (Object)null && StartOfRound.Instance.allPlayerScripts[j].currentlyHeldObjectServer.scrapValue > 150) { array[j] += 30; } Plugin.logger.LogDebug((object)"{StartOfRound.Instance.allPlayerScripts[j].playerUsername}: {playerScores[j]}"); } PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[RoundManager.Instance.GetRandomWeightedIndex(array, (Random)null)]; if (val.isPlayerDead) { for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++) { if (!StartOfRound.Instance.allPlayerScripts[k].isPlayerDead) { val = StartOfRound.Instance.allPlayerScripts[k]; break; } } } Plugin.logger.LogDebug((object)$"Something: Haunting player with playerClientId: {val.playerClientId}; actualClientId: {val.actualClientId}"); base.targetPlayer = val; ChangeTargetPlayerClientRpc(val.actualClientId); } public void Teleport(Vector3 position) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)("Teleporting to " + ((object)(Vector3)(ref position)).ToString())); position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 5f, -1); base.agent.Warp(position); } private void SpawnLesserSomethings() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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) int num = 0; int num2 = (int)((float)allAINodes.Length * 0.1f); List<GameObject> list = allAINodes.ToList(); for (int i = 0; i < num2; i++) { if (list.Count <= 0) { break; } GameObject random = IEnumerableExtensions.GetRandom<GameObject>((IEnumerable<GameObject>)list); list.Remove(random); if ((Object)(object)random == (Object)null || base.targetPlayer.HasLineOfSightToPosition(random.transform.position, 45f, 60, -1f, -1)) { i--; continue; } Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(random.transform.position, 10f, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1, 1f); LesserSomethingAI component = Object.Instantiate<GameObject>(lesserSomethingPrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity).GetComponent<LesserSomethingAI>(); component.spawnNode = random.transform; component.destroyTime = nextSpawnTimeLS; component.targetPlayer = base.targetPlayer; num++; } Plugin.logger.LogDebug((object)$"Spawned {num}/{allAINodes.Length} lesser_somethings which will self destruct in {nextSpawnTimeLS} seconds"); } private void SpawnLittleOnes() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) int num = (int)((float)allAINodes.Length * 0.7f); for (int i = 0; i < num; i++) { GameObject random = IEnumerableExtensions.GetRandom<GameObject>((IEnumerable<GameObject>)allAINodes); if ((Object)(object)random == (Object)null || base.targetPlayer.HasLineOfSightToPosition(random.transform.position, 45f, 60, -1f, -1)) { i--; continue; } Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(random.transform.position, 10f, RoundManager.Instance.navHit, RoundManager.Instance.AnomalyRandom, -1, 1f); TinySomethingAI component = Object.Instantiate<GameObject>(tinySomethingPrefab, randomNavMeshPositionInBoxPredictable, Quaternion.identity).GetComponent<TinySomethingAI>(); component.destroyTime = nextSpawnTimeLS; } } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = default(PlayerControllerB); if (!base.inSpecialAnimation && base.currentBehaviourStateIndex == 2 && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Plugin.localPlayer)) { base.inSpecialAnimation = true; ((MonoBehaviour)this).StartCoroutine(KillPlayerCoroutine()); } [IteratorStateMachine(typeof(<<OnCollideWithPlayer>g__KillPlayerCoroutine|54_0>d))] IEnumerator KillPlayerCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<OnCollideWithPlayer>g__KillPlayerCoroutine|54_0>d(0) { <>4__this = this }; } } private void ResetHallucinations() { Plugin.logger.LogDebug((object)"Resetting Hallucinations"); foreach (TinySomethingAI item in TinySomethingAI.Instances.ToList()) { Object.Destroy((Object)(object)((Component)item).gameObject); } if ((Object)(object)hudOverlay != (Object)null) { Object.Destroy((Object)(object)((Component)hudOverlay).gameObject); } base.creatureVoice.Stop(); } public override void OnDestroy() { ResetHallucinations(); ((EnemyAI)this).OnDestroy(); } public void OnFinishSpawnAnimation() { if (((NetworkBehaviour)this).IsOwner) { Plugin.logger.LogDebug((object)"OnFinishSpawnAnimation()"); base.inSpecialAnimation = false; base.creatureVoice.Play(); PlayerControllerBExtensions.FreezePlayer(base.targetPlayer, false); } } public void OnFinishDespawnAnimation() { if (((NetworkBehaviour)this).IsOwner) { Plugin.logger.LogDebug((object)"OnFinishDespawnAnimation"); base.inSpecialAnimation = false; base.creatureVoice.Stop(); SetVisibility(enable: false); } } public void SwitchToBehaviourStateOnLocalClient(int stateIndex) { if (base.currentBehaviourStateIndex != stateIndex) { base.previousBehaviourStateIndex = base.currentBehaviourStateIndex; base.currentBehaviourStateIndex = stateIndex; base.currentBehaviourState = base.enemyBehaviourStates[stateIndex]; timeSinceSwitchBehaviour = 0f; } } [ClientRpc] public void ChangeTargetPlayerClientRpc(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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(737597221u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 737597221u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ResetHallucinations(); SwitchToBehaviourStateOnLocalClient(0); PlayerControllerB val3 = Plugin.PlayerFromId(clientId); val3.insanityLevel = 0f; base.targetPlayer = val3; Plugin.logger.LogDebug((object)$"Something: Haunting player with playerClientId: {base.targetPlayer.playerClientId}; actualClientId: {base.targetPlayer.actualClientId}"); ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.ChangeOwnership(base.targetPlayer.actualClientId); } if (isHauntingLocalPlayer) { hudOverlay = Object.Instantiate<GameObject>(BreathingMechanicPrefab).GetComponent<SomethingHUDOverlay>(); } } } [ClientRpc] public void KillPlayerClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4258547913u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4258547913u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureVoice.PlayOneShot(disappearSFX, 1f); base.targetPlayer = null; } } } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(737597221u, new RpcReceiveHandler(__rpc_handler_737597221), "ChangeTargetPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(4258547913u, new RpcReceiveHandler(__rpc_handler_4258547913), "KillPlayerClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_737597221(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; ((SomethingAI)(object)target).ChangeTargetPlayerClientRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4258547913(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; ((SomethingAI)(object)target).KillPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SomethingAI"; } } [HarmonyPatch] public class SomethingPatches { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControllerB), "NearOtherPlayers")] public static bool NearOtherPlayersPrefix(PlayerControllerB __instance, ref bool __result) { try { if (SomethingAI.IsPlayerHaunted(__instance)) { __result = false; return false; } return true; } catch { return true; } } } internal class SomethingAnimatorRouter : MonoBehaviour { public SomethingAI mainScript; public void OnFinishSpawnAnimation() { mainScript.OnFinishSpawnAnimation(); } public void OnFinishDespawnAnimation() { mainScript.OnFinishDespawnAnimation(); } } internal class SomethingHUDOverlay : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass22_0 { public SomethingHUDOverlay <>4__this; public bool destroy; } public AudioSource audioSource; public AudioClip breathInSFX; public AudioClip breathOutSFX; public Sprite[] jumpscareSprites; public Sprite[] altJumpscareSprites; public GameObject panelObj; public Image panelImage; public Image breathVisual; [HideInInspector] public Material breathMat; private static readonly int LightSizeId = Shader.PropertyToID("_Inset"); private bool holdingKey; private bool showedTooltip; private float breathProgress; private const float breathMultiplier = 0.5f; private float insanityMultiplier = 2.5f; private const float insanityToShowTooltip = 25f; private const float fillBreathMin = -0.5f; private const float fillBreathMax = 0.15f; private string KeyBind => SomethingInputs.Instance.BreathKey_BindingDisplayString; public void Start() { breathProgress = -0.5f; breathMat = ((Graphic)breathVisual).material; } public void Update() { if (!showedTooltip && Plugin.localPlayer.insanityLevel >= 25f) { HUDManager.Instance.DisplayTip("Hold [" + KeyBind + "] to breath", "Breathe to lower insanity and control hallucinations", false, true, "SomethingBreathingTip"); showedTooltip = true; } bool flag = SomethingInputs.Instance.BreathKey.WasPressedThisFrame(); bool flag2 = SomethingInputs.Instance.BreathKey.WasReleasedThisFrame(); if (flag || flag2) { holdingKey = flag; Plugin.logger.LogDebug((object)(holdingKey ? "Start Breathing" : "Stop Breathing")); audioSource.Stop(); audioSource.clip = (holdingKey ? breathInSFX : breathOutSFX); audioSource.volume = 0.5f; audioSource.Play(); } float num = (holdingKey ? 0.15f : (-0.5f)); float num2 = breathProgress; breathProgress = Mathf.MoveTowards(breathProgress, num, Time.deltaTime * 0.5f); if (holdingKey && breathProgress > num2 && Plugin.localPlayer.insanityLevel > 0f) { insanityMultiplier = ((Plugin.localPlayer.isWalking || Plugin.localPlayer.isSprinting) ? 2f : 3f); Plugin.localPlayer.insanityLevel = Mathf.Max(0f, Plugin.localPlayer.insanityLevel - Time.deltaTime * insanityMultiplier); Plugin.logger.LogDebug((object)("Insanity: " + Plugin.localPlayer.insanityLevel)); } breathMat.SetFloat(LightSizeId, breathProgress); } public void JumpscarePlayer(float time, bool destroy = false) { <>c__DisplayClass22_0 CS$<>8__locals0 = new <>c__DisplayClass22_0(); CS$<>8__locals0.<>4__this = this; CS$<>8__locals0.destroy = destroy; panelObj.SetActive(true); Sprite[] array = (Plugin.configMinimalSpoilerVersion.Value ? altJumpscareSprites : jumpscareSprites); int num = Random.Range(0, array.Length); panelImage.sprite = array[num]; ((MonoBehaviour)this).StartCoroutine(JumpscarePlayerCoroutine(time)); [IteratorStateMachine(typeof(<>c__DisplayClass22_0.<<JumpscarePlayer>g__JumpscarePlayerCoroutine|0>d))] IEnumerator JumpscarePlayerCoroutine(float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass22_0.<<JumpscarePlayer>g__JumpscarePlayerCoroutine|0>d(0) { <>4__this = CS$<>8__locals0, time = time }; } } } internal class LesserSomethingAI : MonoBehaviour { [CompilerGenerated] private sealed class <WanderingCoroutine>d__34 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LesserSomethingAI <>4__this; private float <timeStopped>5__1; private float <idleTime>5__2; private Vector3 <position>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WanderingCoroutine>d__34(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>4__this.targetPlayer != (Object)null)); <>1__state = 2; return true; case 2: <>1__state = -1; goto IL_01bf; case 3: <>1__state = -1; if (!<>4__this.agent.hasPath || <timeStopped>5__1 > 1f) { RoundManager.PlayRandomClip(<>4__this.audioSource, <>4__this.ambientSFX, true, 1f, 0, 1000); <>2__current = (object)new WaitForSeconds(<idleTime>5__2); <>1__state = 4; return true; } if (<>4__this.agent.velocity == Vector3.zero) { <timeStopped>5__1 += 0.2f; } goto IL_01b7; case 4: { <>1__state = -1; goto IL_01bf; } IL_01b7: <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 3; return true; IL_01bf: if ((Object)(object)<>4__this.spawnNode != (Object)null) { <timeStopped>5__1 = 0f; <idleTime>5__2 = Random.Range(3f, 10f); <position>5__3 = RoundManager.Instance.GetRandomNavMeshPositionInRadius(<>4__this.spawnNode.position, 3f, RoundManager.Instance.navHit); <>4__this.agent.SetDestination(<position>5__3); goto IL_01b7; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Transform turnCompass; public NavMeshAgent agent; public AudioSource audioSource; public AudioClip[] ambientSFX; public AudioClip[] alertSFX; public AudioClip[] attackSFX; public GameObject[] variants; [HideInInspector] public PlayerControllerB targetPlayer; [HideInInspector] public Transform spawnNode; private Coroutine wanderRoutine; private float timeSinceAIInterval; private float timeSpawned; private bool chasing; private float stareTime; private int variantIndex; [HideInInspector] public float destroyTime; private const float AITimeInterval = 0.2f; private const float idleMinInterval = 3f; private const float idleMaxInterval = 10f; private const float maxStareTime = 1f; private const float insanityMultiplier = 1f; private const float insanityChaseMultiplier = 1.2f; private const float chaseSpeed = 1.5f; private const float wanderSpeed = 1f; private const float insanityOnCollision = 5f; public static List<LesserSomethingAI> Instances { get; private set; } = new List<LesserSomethingAI>(); public void Start() { Instances.Add(this); variantIndex = Random.Range(0, variants.Length); variants[variantIndex].SetActive(true); wanderRoutine = ((MonoBehaviour)this).StartCoroutine(WanderingCoroutine()); } public void OnDestroy() { Instances.Remove(this); } public void Update() { if (!((Object)(object)targetPlayer == (Object)null)) { timeSinceAIInterval += Time.deltaTime; timeSpawned += Time.deltaTime; if (timeSinceAIInterval >= 0.2f) { timeSinceAIInterval = 0f; DoAIInterval(); } } } public void LateUpdate() { //IL_0029: 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_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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)targetPlayer == (Object)null)) { turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 10f * Time.deltaTime); } } public void DoAIInterval() { //IL_000d: 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) bool flag = targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position, 45f, 60, -1f, -1); if (!flag && timeSpawned > destroyTime) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if (chasing) { agent.speed = 1.5f; agent.SetDestination(((Component)targetPlayer).transform.position); if (flag) { PlayerControllerB obj = targetPlayer; obj.insanityLevel += 0.24000001f; } return; } agent.speed = 1f; if (flag) { PlayerControllerB obj2 = targetPlayer; obj2.insanityLevel += 0.2f; stareTime += 0.2f; if (stareTime >= 1f) { ((MonoBehaviour)this).StopCoroutine(wanderRoutine); chasing = true; RoundManager.PlayRandomClip(audioSource, alertSFX, true, 1f, 0, 1000); } } } [IteratorStateMachine(typeof(<WanderingCoroutine>d__34))] private IEnumerator WanderingCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WanderingCoroutine>d__34(0) { <>4__this = this }; } public void OnCollision(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (((Component)other).CompareTag("Player") && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val != (Object)(object)Plugin.localPlayer)) { Plugin.logger.LogDebug((object)"Player collided with lesser something"); PlayerControllerB localPlayer = Plugin.localPlayer; localPlayer.insanityLevel += 5f; RoundManager.PlayRandomClip(Plugin.localPlayer.statusEffectAudio, attackSFX, true, 1f, 0, 1000); Object.Destroy((Object)(object)((Component)this).gameObject); } } } internal class LesserSomethingCollision : MonoBehaviour { public LesserSomethingAI mainScript; public void OnTriggerEnter(Collider other) { mainScript.OnCollision(other); } } internal class TinySomethingAI : MonoBehaviour { public Transform turnCompass; public AudioSource creatureSFX; public SpriteRenderer renderer; private float timeSpawned; public float destroyTime = 10f; public static List<TinySomethingAI> Instances { get; private set; } = new List<TinySomethingAI>(); public void Start() { Instances.Add(this); } public void OnDestroy() { Instances.Remove(this); } public void Update() { //IL_0028: 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) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) timeSpawned += Time.deltaTime; turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 50f * Time.deltaTime); if (timeSpawned > destroyTime && !((Renderer)renderer).isVisible) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void OnTriggerEnter(Collider other) { PlayerControllerB val = default(PlayerControllerB); if (((Component)other).CompareTag("Player") && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val != (Object)(object)Plugin.localPlayer)) { Plugin.logger.LogDebug((object)"Player stepped on little one"); PlayerControllerB localPlayer = Plugin.localPlayer; localPlayer.insanityLevel += 1f; creatureSFX.pitch = Random.Range(0.9f, 1.06f); creatureSFX.Play(); Object.Destroy((Object)(object)((Component)this).gameObject, 0.5f); } } } internal class SpringCatAI : EnemyAI { public enum State { Inactive, Active } [CompilerGenerated] private sealed class <>c__DisplayClass52_0 { public PlayerControllerB player; public SpringCatAI <>4__this; internal bool <KeepPlayerInMouthForDelay>b__0() { return (!player.isPlayerControlled && (Object)(object)player.deadBody != (Object)null) || !((EnemyAI)<>4__this).inSpecialAnimation; } } [CompilerGenerated] private sealed class <FreezePlayerCoroutine>d__39 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float freezeTime; public SpringCatAI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FreezePlayerCoroutine>d__39(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; PlayerControllerBExtensions.FreezePlayer(((EnemyAI)<>4__this).targetPlayer, true); <>2__current = (object)new WaitForSeconds(freezeTime); <>1__state = 1; return true; case 1: <>1__state = -1; PlayerControllerBExtensions.FreezePlayer(((EnemyAI)<>4__this).targetPlayer, false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <KeepPlayerInMouthForDelay>d__52 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB player; public float delay; public SpringCatAI <>4__this; private <>c__DisplayClass52_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <KeepPlayerInMouthForDelay>d__52(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass52_0(); <>8__1.player = player; <>8__1.<>4__this = <>4__this; Plugin.logger.LogDebug((object)"KeepPlayerInMouthForDelay"); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => (!<>8__1.player.isPlayerControlled && (Object)(object)<>8__1.player.deadBody != (Object)null) || !((EnemyAI)<>8__1.<>4__this).inSpecialAnimation)); <>1__state = 2; return true; case 2: <>1__state = -1; if (!((EnemyAI)<>4__this).inSpecialAnimation) { Plugin.logger.LogError((object)"No longer inspecialanimation"); <>4__this.ResetVariables(); return false; } <>8__1.player.deadBody.attachedTo = <>4__this.MouthTransform; <>8__1.player.deadBody.attachedLimb = <>8__1.player.deadBody.bodyParts[5]; <>8__1.player.deadBody.matchPositionExactly = true; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 3; return true; case 3: <>1__state = -1; <>8__1.player.deadBody.attachedTo = null; <>8__1.player.deadBody.attachedLimb = null; <>8__1.player.deadBody.matchPositionExactly = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static int SpringCatKillIndex = 1; public Transform turnCompass; public GameObject ScanNode; public Transform MeshTransform; public Transform RightHandTransform; public Transform LeftHandTransform; public Transform ChestTransform; public Transform HeadTransform; public Transform MouthTransform; public GameObject Container; public AudioClip GlassBreakSFX; private BreakerBox? breakerBox; private bool grabbingPlayer; private bool grabbingRight; private bool playerInChest; private int bodyPartLeft = -1; private int bodyPartRight = -1; private float timeSinceMeow; private float timeSinceSwitchLights; private float timeSinceRecalcPath; private Queue<Vector3> etchPath = new Queue<Vector3>(); private bool followingPath = false; private const float turnSpeed = 15f; private const float throwForce = 20f; private const float triggerDistance = 5f; private const float meowCooldown = 30f; private const float lightSwitchCooldown = 5f; private const float turnOffLightsDistance = 10f; private const float playerInMouthTime = 5f; private bool targetPlayerDead => (Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerControlled && (Object)(object)base.targetPlayer.deadBody != (Object)null; public override void Start() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_008a: 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) try { base.overlapColliders = (Collider[])(object)new Collider[1]; base.thisNetworkObject = ((NetworkBehaviour)this).NetworkObject; base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene; RoundManager instance = RoundManager.Instance; instance.numberOfEnemiesInScene++; base.allAINodes = Utils.insideAINodes; if (!((NetworkBehaviour)this).IsServer) { RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this); } base.path1 = new NavMeshPath(); base.openDoorSpeedMultiplier = base.enemyType.doorSpeedMultiplier; base.serverPosition = ((Component)this).transform.position; base.ventAnimationFinished = true; } catch (Exception arg) { Plugin.logger.LogError((object)$"Error when initializing enemy variables for {((Object)((Component)this).gameObject).name} : {arg}"); } base.currentBehaviourStateIndex = 0; breakerBox = Object.FindObjectOfType<BreakerBox>(); } public override void Update() { //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) if (base.currentBehaviourStateIndex == 0) { timeSinceMeow += Time.deltaTime; if (timeSinceMeow > 30f) { base.creatureVoice.Play(); timeSinceMeow = 0f; } } if (StartOfRound.Instance.allPlayersDead || base.inSpecialAnimation) { return; } if ((Object)(object)base.targetPlayer != (Object)null) { if (base.currentBehaviourStateIndex == 0) { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); MeshTransform.rotation = Quaternion.Lerp(MeshTransform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 15f * Time.deltaTime); HeadTransform.rotation = Quaternion.Lerp(HeadTransform.rotation, Quaternion.Euler(new Vector3(turnCompass.eulerAngles.x, turnCompass.eulerAngles.y, turnCompass.eulerAngles.z)), 15f * Time.deltaTime); } else { turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); HeadTransform.rotation = Quaternion.Lerp(HeadTransform.rotation, Quaternion.Euler(new Vector3(turnCompass.eulerAngles.x, turnCompass.eulerAngles.y, turnCompass.eulerAngles.z)), 15f * Time.deltaTime); } } else { HeadTransform.rotation = Quaternion.identity; } if (!((NetworkBehaviour)this).IsServer) { return; } timeSinceSwitchLights += Time.deltaTime; if (base.updateDestinationInterval >= 0f) { base.updateDestinationInterval -= Time.deltaTime; } else { ((EnemyAI)this).DoAIInterval(); base.updateDestinationInterval = base.AIIntervalTime + Random.Range(-0.015f, 0.015f); } if (!((Object)(object)base.targetPlayer == (Object)null)) { if (!followingPath && etchPath.Count > 0) { Vector3 destination = etchPath.Dequeue(); base.agent.SetDestination(destination); followingPath = true; } if (followingPath && !base.agent.pathPending && base.agent.remainingDistance < 0.1f) { followingPath = false; } } } public void LateUpdate() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer != (Object)null) { if (playerInChest) { grabbingPlayer = false; if (targetPlayerDead) { ResetVariables(); } else { ((Component)base.targetPlayer).transform.position = ChestTransform.position; } } else if (grabbingPlayer) { if (targetPlayerDead) { if (bodyPartLeft > -1 && bodyPartLeft <= 10) { base.targetPlayer.deadBody.secondaryAttachedTo = LeftHandTransform; base.targetPlayer.deadBody.secondaryAttachedLimb = base.targetPlayer.deadBody.bodyParts[bodyPartLeft]; } if (bodyPartRight > -1 && bodyPartRight <= 10) { base.targetPlayer.deadBody.attachedTo = RightHandTransform; base.targetPlayer.deadBody.attachedLimb = base.targetPlayer.deadBody.bodyParts[bodyPartRight]; } base.targetPlayer.deadBody.matchPositionExactly = true; } else { ((Component)base.targetPlayer).transform.position = (grabbingRight ? RightHandTransform.position : LeftHandTransform.position); Vector3 val = ((Component)base.targetPlayer).transform.position - base.targetPlayer.bodyParts[5].position; Transform transform = ((Component)base.targetPlayer).transform; transform.position += val; } } else { bodyPartLeft = -1; bodyPartRight = -1; } } else { grabbingPlayer = false; bodyPartLeft = -1; bodyPartRight = -1; playerInChest = false; } } private void RecalculatePath() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_006d: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer == (Object)null) { return; } NavMeshPath val = new NavMeshPath(); base.agent.CalculatePath(((Component)base.targetPlayer).transform.position, val); etchPath.Clear(); Vector3 val2 = ((Component)this).transform.position; Vector3[] corners = val.corners; Vector3 val5 = default(Vector3); Vector3 val6 = default(Vector3); foreach (Vector3 val3 in corners) { Vector3 val4 = val3 - val2; if (Mathf.Abs(val4.x) > 0.01f) { ((Vector3)(ref val5))..ctor(val3.x, val2.y, val2.z); etchPath.Enqueue(val5); val2 = val5; } if (Mathf.Abs(val4.z) > 0.01f) { ((Vector3)(ref val6))..ctor(val2.x, val2.y, val3.z); etchPath.Enqueue(val6); val2 = val6; } } } public override void DoAIInterval() { //IL_0054: 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) ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.allPlayersDead || base.inSpecialAnimation) { return; } switch (base.currentBehaviourStateIndex) { case 0: if (TargetClosestPlayerInRange(5f) && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 5f) { ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(1); BreakOutOfContainmentClientRpc(); } break; case 1: if (!TargetClosestPlayer()) { base.targetPlayer = null; base.agent.ResetPath(); break; } if (timeSinceSwitchLights > 5f) { timeSinceSwitchLights = 0f; TurnOffNearbyLightsClientRpc(10f); } RecalculatePath(); break; default: Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex)); break; } } private bool TargetClosestPlayerInRange(float range) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer != (Object)null && !((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true)) { base.targetPlayer = null; } float num = float.PositiveInfinity; PlayerControllerB val = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (!((Object)(object)val2 == (Object)null) && ((EnemyAI)this).PlayerIsTargetable(val2, false, false, true)) { float num2 = Vector3.Distance(((Component)val2).transform.position, ((Component)this).transform.position); if (num2 <= range && num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val != (Object)null) { base.targetPlayer = val; } return (Object)(object)base.targetPlayer != (Object)null; } public bool TargetClosestPlayer(float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f) { //IL_004b: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = 2000f; PlayerControllerB targetPlayer = base.targetPlayer; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++) { if (((EnemyAI)this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[i], false, false, true) && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position, false, false, false) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, viewWidth, 40, -1f, (Transform)null))) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position); if (base.tempDist < base.mostOptimalDistance) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; } } } if ((Object)(object)base.targetPlayer != (Object)null && bufferDistance > 0f && (Object)(object)targetPlayer != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position)) < bufferDistance) { base.targetPlayer = targetPlayer; } return (Object)(object)base.targetPlayer != (Object)null; } [IteratorStateMachine(typeof(<FreezePlayerCoroutine>d__39))] private IEnumerator FreezePlayerCoroutine(float freezeTime) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FreezePlayerCoroutine>d__39(0) { <>4__this = this, freezeTime = freezeTime }; } private GameObject GetRandomAINode(List<GameObject> nodes) { int index = Random.Range(0, nodes.Count); return nodes[index]; } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = default(PlayerControllerB); if (!base.inSpecialAnimation && base.currentBehaviourStateIndex != 0 && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Plugin.localPlayer) && val.isPlayerControlled) { base.inSpecialAnimation = true; KillPlayerServerRpc(val.actualClientId); } } public void ResetVariables() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.targetPlayer != (Object)null) { if (grabbingPlayer || playerInChest) { base.targetPlayer.playerRigidbody.isKinematic = true; ((Component)base.targetPlayer).transform.rotation = Quaternion.identity; if (base.targetPlayer.isPlayerDead && (Object)(object)base.targetPlayer.deadBody != (Object)null) { base.targetPlayer.deadBody.attachedTo = null; base.targetPlayer.deadBody.attachedLimb = null; base.targetPlayer.deadBody.secondaryAttachedTo = null; base.targetPlayer.deadBody.secondaryAttachedLimb = null; base.targetPlayer.deadBody.matchPositionExactly = false; } } b