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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using com.github.zehsteam.ToilHead.Compatibility; using com.github.zehsteam.ToilHead.MonoBehaviours; using com.github.zehsteam.ToilHead.MonoBehaviours.TurretHeads; using com.github.zehsteam.ToilHead.NetcodePatcher; using com.github.zehsteam.ToilHead.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Zehs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 Zehs")] [assembly: AssemblyDescription("[v81+] CoilHeads, Manticoils, and other entities can sometimes spawn with a turret on their head. Highly Configurable.")] [assembly: AssemblyFileVersion("1.9.1.0")] [assembly: AssemblyInformationalVersion("1.9.1+6ad373a695477ab74224e1012f441abf586aae0c")] [assembly: AssemblyProduct("ToilHead")] [assembly: AssemblyTitle("com.github.zehsteam.ToilHead")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.9.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace com.github.zehsteam.ToilHead { public static class Api { public static Dictionary EnemyTurretHeadControllerPairs => TurretHeadManager.EnemyTurretHeadControllerPairs; public static Dictionary PlayerTurretHeadControllerPairs => TurretHeadManager.PlayerTurretHeadControllerPairs; public static Dictionary DeadBodyTurretHeadControllerPairs => TurretHeadManager.DeadBodyTurretHeadControllerPairs; public static TurretHeadData ToilHeadData => TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false); public static bool ForceToilHeadSpawns { get { return ToilHeadData.ForceSpawns; } set { ToilHeadData.ForceSpawns = value; } } public static int ForceToilHeadMaxSpawnCount { get { return ToilHeadData.ForceMaxSpawnCount; } set { ToilHeadData.ForceMaxSpawnCount = value; } } public static TurretHeadData MantiToilData => TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: false); public static bool ForceMantiToilSpawns { get { return MantiToilData.ForceSpawns; } set { MantiToilData.ForceSpawns = value; } } public static int ForceMantiToilMaxSpawnCount { get { return MantiToilData.ForceMaxSpawnCount; } set { MantiToilData.ForceMaxSpawnCount = value; } } public static TurretHeadData ToilSlayerData => TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: true); public static bool ForceToilSlayerSpawns { get { return ToilSlayerData.ForceSpawns; } set { ToilSlayerData.ForceSpawns = value; } } public static int ForceToilSlayerMaxSpawnCount { get { return ToilSlayerData.ForceMaxSpawnCount; } set { ToilSlayerData.ForceMaxSpawnCount = value; } } public static TurretHeadData MantiSlayerData => TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: true); public static bool ForceMantiSlayerSpawns { get { return MantiSlayerData.ForceSpawns; } set { MantiSlayerData.ForceSpawns = value; } } public static int ForceMantiSlayerMaxSpawnCount { get { return MantiSlayerData.ForceMaxSpawnCount; } set { MantiSlayerData.ForceMaxSpawnCount = value; } } public static TurretHeadData ToilPlayerData => TurretHeadManager.PlayerTurretHeadData; public static bool ForceToilPlayerSpawns { get { return ToilPlayerData.ForceSpawns; } set { ToilPlayerData.ForceSpawns = value; } } public static int ForceToilPlayerMaxSpawnCount { get { return ToilPlayerData.ForceMaxSpawnCount; } set { ToilPlayerData.ForceMaxSpawnCount = value; } } public static TurretHeadData ToilMaskedData => TurretHeadManager.GetEnemyTurretHeadData("Masked", isSlayer: false); public static bool ForceToilMaskedSpawns { get { return ToilMaskedData.ForceSpawns; } set { ToilMaskedData.ForceSpawns = value; } } public static int ForceToilMaskedMaxSpawnCount { get { return ToilMaskedData.ForceMaxSpawnCount; } set { ToilMaskedData.ForceMaxSpawnCount = value; } } public static TurretHeadData SlayerMaskedData => TurretHeadManager.GetEnemyTurretHeadData("Masked", isSlayer: true); public static bool ForceSlayerMaskedSpawns { get { return SlayerMaskedData.ForceSpawns; } set { SlayerMaskedData.ForceSpawns = value; } } public static int ForceSlayerMaskedMaxSpawnCount { get { return SlayerMaskedData.ForceMaxSpawnCount; } set { SlayerMaskedData.ForceMaxSpawnCount = value; } } [Obsolete("EnemyTurretPairs is deprecated, please use EnemyTurretHeadControllerPairs instead.", true)] public static Dictionary EnemyTurretPairs => new Dictionary(); [Obsolete("PlayerTurretPairs is deprecated, please use PlayerTurretHeadControllerPairs instead.", true)] public static Dictionary PlayerTurretPairs => new Dictionary(); [Obsolete("enemyTurretPairs is deprecated, please use EnemyTurretHeadControllerPairs instead.", true)] public static Dictionary enemyTurretPairs => new Dictionary(); [Obsolete("MaxSpawnCount is deprecated, please use ToilHeadMaxSpawnCount instead.", true)] public static int MaxSpawnCount => TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).GetSpawnDataForCurrentMoon().MaxSpawnCount; [Obsolete("SpawnChance is deprecated, please use ToilHeadSpawnChance instead.", true)] public static float SpawnChance => TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).GetSpawnDataForCurrentMoon().SpawnChance; [Obsolete("spawnCount is deprecated, please use ToilHeadSpawnCount instead.", true)] public static int spawnCount => TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).SpawnCount; [Obsolete("forceSpawns is deprecated, please use ForceToilHeadSpawns instead.", true)] public static bool forceSpawns { get { return TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).ForceSpawns; } set { TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).ForceSpawns = value; } } [Obsolete("forceMaxSpawnCount is deprecated, please use ForceToilHeadMaxSpawnCount instead.", true)] public static int forceMaxSpawnCount { get { return TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).ForceMaxSpawnCount; } set { TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: false).ForceMaxSpawnCount = value; } } [Obsolete("mantiToilSpawnCount is deprecated, please use MantiToilSpawnCount instead.", true)] public static int mantiToilSpawnCount => TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: false).SpawnCount; [Obsolete("forceMantiToilSpawns is deprecated, please use ForceMantiToilSpawns instead.", true)] public static bool forceMantiToilSpawns { get { return TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: false).ForceSpawns; } set { TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: false).ForceSpawns = value; } } [Obsolete("forceMantiToilMaxSpawnCount is deprecated, please use ForceMantiToilMaxSpawnCount instead.", true)] public static int forceMantiToilMaxSpawnCount { get { return TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: false).ForceMaxSpawnCount; } set { TurretHeadManager.GetEnemyTurretHeadData("Manticoil", isSlayer: false).ForceMaxSpawnCount = value; } } [Obsolete("toilSlayerSpawnCount is deprecated, please use ToilSlayerSpawnCount instead.", true)] public static int toilSlayerSpawnCount => TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: true).SpawnCount; [Obsolete("forceToilSlayerSpawns is deprecated, please use ForceToilSlayerSpawns instead.", true)] public static bool forceToilSlayerSpawns { get { return TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: true).ForceSpawns; } set { TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: true).ForceSpawns = value; } } [Obsolete("forceToilSlayerMaxSpawnCount is deprecated, please use ForceToilSlayerMaxSpawnCount instead.", true)] public static int forceToilSlayerMaxSpawnCount { get { return TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: true).ForceMaxSpawnCount; } set { TurretHeadManager.GetEnemyTurretHeadData("Spring", isSlayer: true).ForceMaxSpawnCount = value; } } public static bool SetToilHeadOnServer(EnemyAI enemyScript) { return TurretHeadManager.SetEnemyTurretHeadOnServer(enemyScript, isSlayer: false); } public static bool SetMantiToilOnServer(EnemyAI enemyScript) { return TurretHeadManager.SetEnemyTurretHeadOnServer(enemyScript, isSlayer: false); } public static bool SetToilSlayerOnServer(EnemyAI enemyScript) { return TurretHeadManager.SetEnemyTurretHeadOnServer(enemyScript, isSlayer: true); } public static bool SetMantiSlayerOnServer(EnemyAI enemyScript) { return TurretHeadManager.SetEnemyTurretHeadOnServer(enemyScript, isSlayer: true); } public static bool SetToilPlayerOnServer(PlayerControllerB playerScript, bool isSlayer = false) { return TurretHeadManager.SetPlayerTurretHeadOnServer(playerScript, isSlayer); } public static bool SetToilMaskedOnServer(EnemyAI enemyScript) { return TurretHeadManager.SetEnemyTurretHeadOnServer(enemyScript, isSlayer: false); } public static bool SetSlayerMaskedOnServer(EnemyAI enemyScript) { return TurretHeadManager.SetEnemyTurretHeadOnServer(enemyScript, isSlayer: true); } } internal static class Content { public static GameObject NetworkHandlerPrefab; public static GameObject TurretPropPrefab; public static GameObject MinigunPropPrefab; public static GameObject ToilPlayerControllerPrefab; public static GameObject SlayerPlayerControllerPrefab; public static GameObject ToiledDeadBodyControllerPrefab; public static GameObject SlayedDeadBodyControllerPrefab; public static GameObject ToilHeadControllerPrefab; public static GameObject ToilSlayerControllerPrefab; public static GameObject MantiToilControllerPrefab; public static GameObject MantiSlayerControllerPrefab; public static GameObject ToilMaskedControllerPrefab; public static GameObject SlayerMaskedControllerPrefab; public static Item ToilHeadPlush; public static Item ToilSlayerPlush; public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, "toilhead_assets"); AssetBundle val = AssetBundle.LoadFromFile(text); NetworkHandlerPrefab = val.LoadAsset("NetworkHandler"); NetworkHandlerPrefab.AddComponent(); TurretPropPrefab = val.LoadAsset("TurretHeadTurretProp"); MinigunPropPrefab = val.LoadAsset("MinigunTurretHeadTurretProp"); ToilPlayerControllerPrefab = val.LoadAsset("ToilPlayerController"); SlayerPlayerControllerPrefab = val.LoadAsset("SlayerPlayerController"); ToiledDeadBodyControllerPrefab = val.LoadAsset("ToiledDeadBodyController"); SlayedDeadBodyControllerPrefab = val.LoadAsset("SlayedDeadBodyController"); ToilHeadControllerPrefab = val.LoadAsset("ToilHeadController"); ToilSlayerControllerPrefab = val.LoadAsset("ToilSlayerController"); MantiToilControllerPrefab = val.LoadAsset("MantiToilController"); MantiSlayerControllerPrefab = val.LoadAsset("MantiSlayerController"); ToilMaskedControllerPrefab = val.LoadAsset("ToilMaskedController"); SlayerMaskedControllerPrefab = val.LoadAsset("SlayerMaskedController"); ToilHeadPlush = val.LoadAsset("ToilHeadPlush"); ToilSlayerPlush = val.LoadAsset("ToilSlayerPlush"); Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } catch (Exception arg) { Plugin.logger.LogError((object)$"Error: Failed to load assets from AssetBundle.\n\n{arg}"); } } } public class ExtendedConfigEntry { public ConfigEntry ConfigEntry; public Func GetValue; public Action SetValue; public bool UseEnableConfiguration = true; public T DefaultValue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue; public T Value { get { return GetValue(); } set { SetValue(value); } } public ExtendedConfigEntry(string section, string key, T defaultValue, string description, bool useEnableConfiguration = true) { ConfigEntry = ((BaseUnityPlugin)Plugin.Instance).Config.Bind(section, key, defaultValue, description); UseEnableConfiguration = useEnableConfiguration; Initialize(); } public ExtendedConfigEntry(string section, string key, T defaultValue, ConfigDescription configDescription = null, bool useEnableConfiguration = true) { ConfigEntry = ((BaseUnityPlugin)Plugin.Instance).Config.Bind(section, key, defaultValue, configDescription); UseEnableConfiguration = useEnableConfiguration; Initialize(); } private void Initialize() { if (GetValue == null) { GetValue = () => (UseEnableConfiguration && !Plugin.ConfigManager.EnableConfiguration.Value) ? DefaultValue : ConfigEntry.Value; } if (SetValue == null) { SetValue = delegate(T value) { ConfigEntry.Value = value; }; } } public void ResetToDefault() { ConfigEntry.Value = (T)((ConfigEntryBase)ConfigEntry).DefaultValue; } } internal static class NetworkUtils { public static bool IsServer { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsServer; } } public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsHost; } } public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static bool IsLocalClientId(ulong clientId) { return clientId == GetLocalClientId(); } } internal static class PlayerUtils { public static bool IsLocalPlayer(PlayerControllerB playerScript) { return (Object)(object)playerScript == (Object)(object)GetLocalPlayerScript(); } public static int GetPlayerId(PlayerControllerB playerScript) { return (int)playerScript.playerClientId; } public static int GetLocalPlayerId() { return (int)GetLocalPlayerScript().playerClientId; } public static PlayerControllerB GetPlayerScript(int playerId) { try { return StartOfRound.Instance.allPlayerScripts[playerId]; } catch { return null; } } public static PlayerControllerB GetLocalPlayerScript() { return GameNetworkManager.Instance.localPlayerController; } } [BepInPlugin("com.github.zehsteam.ToilHead", "ToilHead", "1.9.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.github.zehsteam.ToilHead"); internal static Plugin Instance; internal static ManualLogSource logger; internal static SyncedConfigManager ConfigManager; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("com.github.zehsteam.ToilHead"); logger.LogInfo((object)"ToilHead has awoken!"); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(TerminalPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(RagdollGrabbableObjectPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); harmony.PatchAll(typeof(SpringManAIPatch)); harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); harmony.PatchAll(typeof(TurretPatch)); ConfigManager = new SyncedConfigManager(); Content.Load(); TurretHeadManager.Initialize(); RegisterScrapItems(); NetcodePatcherAwake(); } private void NetcodePatcherAwake() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public void OnLocalDisconnect() { logger.LogInfo((object)"Local player disconnected. Removing hostConfigData."); ConfigManager.SetHostConfigData(null); TurretHeadManager.Reset(); } public void OnNewLevelLoaded() { Secret.SpawnSecrets(); } public void OnNewLevelFinishedLoading() { TurretHeadManager.TrySetPlayerTurretHeadsOnServer(); } public void OnShipHasLeft() { TurretHeadManager.Reset(); } private void RegisterScrapItems() { if (!LethalLibProxy.HasMod || !MonsterPlushiesProxy.HasMod) { return; } try { ScrapHelper.RegisterScrap(Content.ToilHeadPlush, ConfigManager.ToilHeadPlushieSpawnWeight.Value, ConfigManager.ToilHeadPlushieSpawnAllMoons.Value, ConfigManager.ToilHeadPlushieMoonSpawnList.Value, twoHanded: false, ConfigManager.ToilHeadPlushieCarryWeight.Value, ConfigManager.ToilHeadPlushieMinValue.Value, ConfigManager.ToilHeadPlushieMaxValue.Value); ScrapHelper.RegisterScrap(Content.ToilSlayerPlush, ConfigManager.ToilSlayerPlushieSpawnWeight.Value, ConfigManager.ToilSlayerPlushieSpawnAllMoons.Value, ConfigManager.ToilSlayerPlushieMoonSpawnList.Value, twoHanded: false, ConfigManager.ToilSlayerPlushieCarryWeight.Value, ConfigManager.ToilSlayerPlushieMinValue.Value, ConfigManager.ToilSlayerPlushieMaxValue.Value); } catch (Exception arg) { logger.LogWarning((object)$"Warning: Failed to register scrap items.\n\n{arg}"); } } public void LogInfoExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { logger.LogInfo(data); } } public void LogWarningExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { logger.LogWarning(data); } } public void LogErrorExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { logger.LogError(data); } } } internal static class ScrapHelper { public static void RegisterScrap(Item item, int iRarity, bool spawnAllMoons, string moonSpawnList, bool twoHanded, int carryWeight, int minValue, int maxValue) { if (!LethalLibProxy.HasMod) { return; } try { item.twoHanded = twoHanded; item.weight = (float)carryWeight / 105f + 1f; item.minValue = minValue; item.maxValue = maxValue; Utilities.FixMixerGroups(item.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); if (spawnAllMoons) { Items.RegisterScrap(item, iRarity, (LevelTypes)(-1)); Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {iRarity} rarity."); } else { RegisterScrapForMoons(item, iRarity, moonSpawnList); } } catch (Exception arg) { Plugin.logger.LogError((object)$"Error: Failed to register \"{item.itemName}\" scrap item.\n\n{arg}"); } } private static void RegisterScrapForMoons(Item item, int iRarity, string moonSpawnList) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); dictionary.Add("Experimentation", (LevelTypes)4); dictionary.Add("Assurance", (LevelTypes)8); dictionary.Add("Vow", (LevelTypes)16); dictionary.Add("Offense", (LevelTypes)32); dictionary.Add("March", (LevelTypes)64); dictionary.Add("Adamance", (LevelTypes)2048); dictionary.Add("Rend", (LevelTypes)128); dictionary.Add("Dine", (LevelTypes)256); dictionary.Add("Titan", (LevelTypes)512); dictionary.Add("Artifice", (LevelTypes)4096); dictionary.Add("Embrion", (LevelTypes)8192); foreach (string item2 in from _ in moonSpawnList.Split(',') select GetFormattedSting(_.Trim())) { if (dictionary.TryGetValue(item2, out var value)) { Items.RegisterScrap(item, iRarity, value); Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item on moon \"{item2}\" with {iRarity} rarity."); } } } private static string GetFormattedSting(string value) { if (value.Length <= 1) { return value.ToUpper(); } return value.Substring(0, 1).ToUpper() + value.Substring(1, value.Length - 1).ToLower(); } } internal static class Secret { public static void SpawnSecrets() { string planetName = StartOfRound.Instance.currentLevel.PlanetName; if (planetName == "57 Asteroid-13") { SpawnAsteroid13Secrets(); } } public static void SpawnAsteroid13Secrets() { //IL_0027: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a2: 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_00a4: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Content.TurretPropPrefab == (Object)null) { Plugin.Instance.LogWarningExtended("Warning: Failed to spawn Asteroid13 secrets. turretPropPrefab is null."); return; } Vector3 val = Content.TurretPropPrefab.transform.localScale * 1.3f; Vector3 positionOffset = default(Vector3); ((Vector3)(ref positionOffset))..ctor(0f, 3.031f, -0.464f); Vector3 rotationOffset = default(Vector3); ((Vector3)(ref rotationOffset))..ctor(-27.2f, 0f, 0f); Vector3 positionOffset2 = default(Vector3); ((Vector3)(ref positionOffset2))..ctor(0f, 3.105f, -0.11f); Vector3 zero = Vector3.zero; Vector3 positionOffset3 = default(Vector3); ((Vector3)(ref positionOffset3))..ctor(0f, 6.217f, -0.225f); Vector3 zero2 = Vector3.zero; SpawnTurretProp("coilheadstuck_model", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadrigged", positionOffset3, zero2, val * 2f); SpawnTurretProp("coilheadstuck_model (5)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (7)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (8)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (9)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (10)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (6)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (29)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (24)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (25)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (26)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (27)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (28)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (23)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (18)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (19)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (20)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (21)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadstuck_model (22)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (17)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (12)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (13)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (14)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (15)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_model (16)", positionOffset, rotationOffset, val); SpawnTurretProp("asteroid(Clone)/coilheadstuck_2_model (7)", positionOffset2, zero, val); SpawnTurretProp("coilheadstuck_2_model (1)", positionOffset2, zero, val); SpawnTurretProp("coilheadstuck_model (11)", positionOffset, rotationOffset, val); SpawnTurretProp("coilheadrigged (1)", positionOffset3, zero2, val * 2f); Plugin.Instance.LogInfoExtended("Spawned Asteroid13 secrets."); } private static void SpawnTurretProp(string parentName, Vector3 positionOffset, Vector3 rotationOffset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) SpawnTurretProp(parentName, positionOffset, rotationOffset, Content.TurretPropPrefab.transform.localScale); } private static void SpawnTurretProp(string parentName, Vector3 positionOffset, Vector3 rotationOffset, Vector3 scale) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0078: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Content.TurretPropPrefab == (Object)null) { Plugin.Instance.LogWarningExtended("Warning: Failed to Instantiate turretPropPrefab. turretPropPrefab is null."); return; } GameObject val = GameObject.Find(parentName); if ((Object)(object)val == (Object)null) { Plugin.Instance.LogWarningExtended("Warning: Failed to Instantiate turretPropPrefab. Parent GameObject is null."); return; } Transform transform = Object.Instantiate(Content.TurretPropPrefab, Vector3.zero, Quaternion.identity, val.transform).transform; transform.localScale = scale; transform.localRotation = Quaternion.identity; transform.Rotate(rotationOffset, (Space)1); transform.localPosition = positionOffset; Utils.DisableColliders(((Component)transform).gameObject); } } public class SpawnData { public int MaxSpawnCount; public float SpawnChance; public SpawnData(string value) { ParseValue(value); } protected virtual void ParseValue(string value) { string[] array = (from _ in value.Split(':') select _.Trim()).ToArray(); int num = 2; if (array.Length != num) { Plugin.logger.LogError((object)$"ParseValue Error: Invalid item length for string \"{value}\". Length is {array.Length} but should have been {num}."); return; } TryParseInt(array[0], out MaxSpawnCount); TryParseFloat(array[1], out SpawnChance); Plugin.Instance.LogInfoExtended($"Parsed SpawnData value string. MaxSpawnCount: {MaxSpawnCount}, SpawnChance: {SpawnChance}"); } protected bool TryParseInt(string value, out int parsedInt) { if (int.TryParse(value, out parsedInt)) { return true; } Plugin.logger.LogError((object)("TryParseItem Error: Failed to parse int from string \"" + value + "\".")); return false; } protected bool TryParseFloat(string value, out float parsedFloat) { if (float.TryParse(value, out parsedFloat)) { return true; } Plugin.logger.LogError((object)("TryParseItem Error: Failed to parse float from string \"" + value + "\".")); return false; } } public class MoonSpawnData : SpawnData { public string PlanetName; public MoonSpawnData(string value) : base(value) { } protected override void ParseValue(string value) { string[] array = (from _ in value.Split(':') select _.Trim()).ToArray(); int num = 3; if (array.Length != num) { Plugin.logger.LogError((object)$"ParseValue Error: Invalid item length for string \"{value}\". Length is {array.Length} but should have been {num}."); return; } PlanetName = array[0]; TryParseInt(array[1], out MaxSpawnCount); TryParseFloat(array[2], out SpawnChance); Plugin.Instance.LogInfoExtended($"Parsed MoonSpawnData value string. PlanetName: \"{PlanetName}\", MaxSpawnCount: {MaxSpawnCount}, SpawnChance: {SpawnChance}"); } } public class MoonSpawnDataList { public List List = new List(); public SpawnData DefaultSpawnData; public MoonSpawnDataList(string value) { ParseValue(value); } public MoonSpawnDataList(string value, SpawnData defaultSpawnData) { ParseValue(value); DefaultSpawnData = defaultSpawnData; } private void ParseValue(string value) { if (value == string.Empty) { return; } if (string.IsNullOrWhiteSpace(value)) { Plugin.logger.LogError((object)"ParseValue Error: MoonSpawnDataList value is null or whitespace."); return; } string[] array = (from _ in value.Split(',') select _.Trim()).ToArray(); List = new List(); string[] array2 = array; foreach (string value2 in array2) { List.Add(new MoonSpawnData(value2)); } } public SpawnData GetSpawnDataForCurrentMoon() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return DefaultSpawnData; } return GetSpawnDataForMoon(StartOfRound.Instance.currentLevel.PlanetName); } public SpawnData GetSpawnDataForMoon(string planetName) { foreach (MoonSpawnData item in List) { if (item.PlanetName == planetName) { return item; } } return DefaultSpawnData; } } [Serializable] public class SyncedConfigData : INetworkSerializable { public float TurretLostLOSDuration; public float TurretRotationRange; public float TurretCodeAccessCooldownDuration; public bool TurretDetectionRotation; public float TurretDetectionRotationSpeed; public float TurretChargingDuration; public float TurretChargingRotationSpeed; public float TurretFiringRotationSpeed; public float TurretBerserkDuration; public float TurretBerserkRotationSpeed; public SyncedConfigData() { } public SyncedConfigData(SyncedConfigManager configManager) { TurretLostLOSDuration = configManager.TurretLostLOSDuration.Value; TurretRotationRange = configManager.TurretRotationRange.Value; TurretCodeAccessCooldownDuration = configManager.TurretCodeAccessCooldownDuration.Value; TurretDetectionRotation = configManager.TurretDetectionRotation.Value; TurretDetectionRotationSpeed = configManager.TurretDetectionRotationSpeed.Value; TurretChargingDuration = configManager.TurretChargingDuration.Value; TurretChargingRotationSpeed = configManager.TurretChargingRotationSpeed.Value; TurretFiringRotationSpeed = configManager.TurretFiringRotationSpeed.Value; TurretBerserkDuration = configManager.TurretBerserkDuration.Value; TurretBerserkRotationSpeed = configManager.TurretBerserkRotationSpeed.Value; } public unsafe void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0078: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretLostLOSDuration, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretRotationRange, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretCodeAccessCooldownDuration, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretDetectionRotation, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretDetectionRotationSpeed, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretChargingDuration, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretChargingRotationSpeed, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretFiringRotationSpeed, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretBerserkDuration, default(ForPrimitives)); ((BufferSerializer*)(&serializer))->SerializeValue(ref TurretBerserkRotationSpeed, default(ForPrimitives)); } } public class SyncedConfigManager { public SyncedConfigData HostConfigData { get; private set; } public ExtendedConfigEntry EnableConfiguration { get; private set; } public ExtendedConfigEntry ExtendedLogging { get; private set; } public ExtendedConfigEntry ToilationToilPlayerSpawnSettings { get; private set; } public ExtendedConfigEntry ToilationToilPlayerSlayerChance { get; private set; } public ExtendedConfigEntry ToilationToilHeadSpawnSettings { get; private set; } public ExtendedConfigEntry ToilationToilSlayerSpawnSettings { get; private set; } public ExtendedConfigEntry ToilationMantiToilSpawnSettings { get; private set; } public ExtendedConfigEntry ToilationMantiSlayerSpawnSettings { get; private set; } public ExtendedConfigEntry ToilationToilMaskedSpawnSettings { get; private set; } public ExtendedConfigEntry ToilationSlayerMaskedSpawnSettings { get; private set; } public ExtendedConfigEntry ToilPlayerDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry ToilPlayerSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry ToilPlayerSlayerChance { get; private set; } public ExtendedConfigEntry SpawnToiledPlayerRagdolls { get; private set; } public ExtendedConfigEntry SpawnRealToiledPlayerRagdolls { get; private set; } public ExtendedConfigEntry ToilHeadDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry ToilHeadSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry MantiToilDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry MantiToilSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry ToilSlayerDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry ToilSlayerSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry MantiSlayerDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry MantiSlayerSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry ToilMaskedDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry ToilMaskedSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry SlayerMaskedDefaultSpawnSettings { get; private set; } public ExtendedConfigEntry SlayerMaskedSpawnSettingsMoonList { get; private set; } public ExtendedConfigEntry ToilHeadPlushieSpawnWeight { get; private set; } public ExtendedConfigEntry ToilHeadPlushieSpawnAllMoons { get; private set; } public ExtendedConfigEntry ToilHeadPlushieMoonSpawnList { get; private set; } public ExtendedConfigEntry ToilHeadPlushieCarryWeight { get; private set; } public ExtendedConfigEntry ToilHeadPlushieMinValue { get; private set; } public ExtendedConfigEntry ToilHeadPlushieMaxValue { get; private set; } public ExtendedConfigEntry ToilSlayerPlushieSpawnWeight { get; private set; } public ExtendedConfigEntry ToilSlayerPlushieSpawnAllMoons { get; private set; } public ExtendedConfigEntry ToilSlayerPlushieMoonSpawnList { get; private set; } public ExtendedConfigEntry ToilSlayerPlushieCarryWeight { get; private set; } public ExtendedConfigEntry ToilSlayerPlushieMinValue { get; private set; } public ExtendedConfigEntry ToilSlayerPlushieMaxValue { get; private set; } public ExtendedConfigEntry TurretLostLOSDuration { get; private set; } public ExtendedConfigEntry TurretRotationRange { get; private set; } public ExtendedConfigEntry TurretCodeAccessCooldownDuration { get; private set; } public ExtendedConfigEntry TurretDetectionRotation { get; private set; } public ExtendedConfigEntry TurretDetectionRotationSpeed { get; private set; } public ExtendedConfigEntry TurretChargingDuration { get; private set; } public ExtendedConfigEntry TurretChargingRotationSpeed { get; private set; } public ExtendedConfigEntry TurretFiringRotationSpeed { get; private set; } public ExtendedConfigEntry TurretBerserkDuration { get; private set; } public ExtendedConfigEntry TurretBerserkRotationSpeed { get; private set; } public SyncedConfigManager() { BindConfigs(); ClearUnusedEntries(); } private void BindConfigs() { EnableConfiguration = new ExtendedConfigEntry("General Settings", "EnableConfiguration", defaultValue: false, "Enable if you want to use custom set config setting values. If disabled, the default config setting values will be used.", useEnableConfiguration: false); ExtendedLogging = new ExtendedConfigEntry("General Settings", "ExtendedLogging", defaultValue: false, "Enable extended logging.", useEnableConfiguration: false); ToilationToilPlayerSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "ToilPlayerSpawnSettings", "1:7", GetDescriptionForMoonSpawnSettings("Toil-Player", "69-Toilation")); ToilationToilPlayerSlayerChance = new ExtendedConfigEntry("Toilation Settings", "ToilPlayerSlayerChance", 20f, "The percent chance a Toil-Player will become a Slayer-Player for 69-Toilation."); ToilationToilHeadSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "ToilHeadSpawnSettings", "6:75", GetDescriptionForMoonSpawnSettings("Toil-Head", "69-Toilation")); ToilationMantiToilSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "MantiToilSpawnSettings", "50:90", GetDescriptionForMoonSpawnSettings("Manti-Toil", "69-Toilation")); ToilationToilSlayerSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "ToilSlayerSpawnSettings", "2:10", GetDescriptionForMoonSpawnSettings("Toil-Slayer", "69-Toilation")); ToilationMantiSlayerSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "MantiSlayerSpawnSettings", "2:20", GetDescriptionForMoonSpawnSettings("Manti-Slayer", "69-Toilation")); ToilationToilMaskedSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "ToilMaskedSpawnSettings", "2:15", GetDescriptionForMoonSpawnSettings("Toil-Masked", "69-Toilation")); ToilationSlayerMaskedSpawnSettings = new ExtendedConfigEntry("Toilation Settings", "SlayerMaskedSpawnSettings", "1:5", GetDescriptionForMoonSpawnSettings("Slayer-Masked", "69-Toilation")); ToilPlayerDefaultSpawnSettings = new ExtendedConfigEntry("Toil-Player Settings", "ToilPlayerDefaultSpawnSettings", "1:3", GetDescriptionForDefaultSpawnSettings("Toil-Player")); string defaultValue = "85 Rend:1:4, 7 Dine:1:4, 8 Titan:1:5, 68 Artifice:1:5, 57 Asteroid-13:1:5, 523 Ooblterra:1:6"; ToilPlayerSpawnSettingsMoonList = new ExtendedConfigEntry("Toil-Player Settings", "ToilPlayerSpawnSettingsMoonList", defaultValue, GetDescriptionForMoonSpawnSettingsList("Toil-Player")); ToilPlayerSlayerChance = new ExtendedConfigEntry("Toil-Player Settings", "ToilPlayerSlayerChance", 10f, "The percent chance a Toil-Player will become a Slayer-Player."); SpawnToiledPlayerRagdolls = new ExtendedConfigEntry("Player Ragdoll Settings", "SpawnToiledPlayerRagdolls", defaultValue: true, "If enabled, will spawn a Toiled player ragdoll when a player dies to a Turret-Head in any way."); SpawnRealToiledPlayerRagdolls = new ExtendedConfigEntry("Player Ragdoll Settings", "SpawnRealToiledPlayerRagdolls", defaultValue: true, "If enabled, will spawn a real turret on the Toiled player ragdoll."); ToilHeadDefaultSpawnSettings = new ExtendedConfigEntry("Toil-Head Settings", "ToilHeadDefaultSpawnSettings", "1:30", GetDescriptionForDefaultSpawnSettings("Toil-Head")); string defaultValue2 = "41 Experimentation:1:10, 220 Assurance:1:20, 56 Vow:1:20, 21 Offense:1:20, 61 March:1:20, 20 Adamance:1:30, 85 Rend:1:40, 7 Dine:1:45, 8 Titan:1:50, 68 Artifice:2:70, 5 Embrion:1:30, 57 Asteroid-13:2:30, 523 Ooblterra:2:70"; ToilHeadSpawnSettingsMoonList = new ExtendedConfigEntry("Toil-Head Settings", "ToilHeadSpawnSettingsMoonList", defaultValue2, GetDescriptionForMoonSpawnSettingsList("Toil-Head")); MantiToilDefaultSpawnSettings = new ExtendedConfigEntry("Manti-Toil Settings", "MantiToilDefaultSpawnSettings", "5:50", GetDescriptionForDefaultSpawnSettings("Manti-Toil")); string defaultValue3 = "20 Adamance:5:60, 85 Rend:5:60, 7 Dine:5:65, 8 Titan:5:70, 68 Artifice:8:75"; MantiToilSpawnSettingsMoonList = new ExtendedConfigEntry("Manti-Toil Settings", "MantiToilSpawnSettingsMoonList", defaultValue3, GetDescriptionForMoonSpawnSettingsList("Manti-Toil")); ToilSlayerDefaultSpawnSettings = new ExtendedConfigEntry("Toil-Slayer Settings", "ToilSlayerDefaultSpawnSettings", "1:10", GetDescriptionForDefaultSpawnSettings("Toil-Slayer")); string defaultValue4 = "20 Adamance:1:15, 85 Rend:1:15, 7 Dine:1:15, 8 Titan:1:20, 68 Artifice:1:20, 57 Asteroid-13:1:15, 523 Ooblterra:1:25"; ToilSlayerSpawnSettingsMoonList = new ExtendedConfigEntry("Toil-Slayer Settings", "ToilSlayerSpawnSettingsMoonList", defaultValue4, GetDescriptionForMoonSpawnSettingsList("Toil-Slayer")); MantiSlayerDefaultSpawnSettings = new ExtendedConfigEntry("Manti-Slayer Settings", "MantiSlayerDefaultSpawnSettings", "1:10", GetDescriptionForDefaultSpawnSettings("Manti-Slayer")); string defaultValue5 = "20 Adamance:1:15, 85 Rend:1:15, 7 Dine:1:15, 8 Titan:1:20, 68 Artifice:1:20, 57 Asteroid-13:1:15, 523 Ooblterra:1:25"; MantiSlayerSpawnSettingsMoonList = new ExtendedConfigEntry("Manti-Slayer Settings", "MantiSlayerSpawnSettingsMoonList", defaultValue5, GetDescriptionForMoonSpawnSettingsList("Manti-Slayer")); ToilMaskedDefaultSpawnSettings = new ExtendedConfigEntry("Toil-Masked Settings", "ToilMaskedDefaultSpawnSettings", "1:10", GetDescriptionForDefaultSpawnSettings("Toil-Masked")); string defaultValue6 = ""; ToilMaskedSpawnSettingsMoonList = new ExtendedConfigEntry("Toil-Masked Settings", "ToilMaskedSpawnSettingsMoonList", defaultValue6, GetDescriptionForMoonSpawnSettingsList("Toil-Masked")); SlayerMaskedDefaultSpawnSettings = new ExtendedConfigEntry("Slayer-Masked Settings", "SlayerMaskedDefaultSpawnSettings", "1:5", GetDescriptionForDefaultSpawnSettings("Slayer-Masked")); string defaultValue7 = ""; SlayerMaskedSpawnSettingsMoonList = new ExtendedConfigEntry("Slayer-Masked Settings", "SlayerMaskedSpawnSettingsMoonList", defaultValue7, GetDescriptionForMoonSpawnSettingsList("Slayer-Masked")); ToilHeadPlushieSpawnWeight = new ExtendedConfigEntry("Toil-Head Plushie Settings", "SpawnWeight", 10, "Toil-Head plushie spawn chance weight."); ToilHeadPlushieSpawnAllMoons = new ExtendedConfigEntry("Toil-Head Plushie Settings", "SpawnAllMoons", defaultValue: true, "If true, the Toil-Head plushie will spawn on all moons. If false, the Toil-Head plushie will only spawn on moons set in the moons list."); ToilHeadPlushieMoonSpawnList = new ExtendedConfigEntry("Toil-Head Plushie Settings", "MoonSpawnList", "Experimentation, Assurance, Vow, Offense, March, Adamance, Rend, Dine, Titan, Artifice, Embrion", "The list of moons the Toil-Head plushie will spawn on.\nCurrently only works for vanilla moons.\nOnly works if PlushieSpawnAllMoons is false."); ToilHeadPlushieCarryWeight = new ExtendedConfigEntry("Toil-Head Plushie Settings", "CarryWeight", 6, "Toil-Head plushie carry weight in pounds."); ToilHeadPlushieMinValue = new ExtendedConfigEntry("Toil-Head Plushie Settings", "MinValue", 80, "Toil-Head plushie min scrap value."); ToilHeadPlushieMaxValue = new ExtendedConfigEntry("Toil-Head Plushie Settings", "MaxValue", 250, "Toil-Head plushie max scrap value."); ToilSlayerPlushieSpawnWeight = new ExtendedConfigEntry("Toil-Slayer Plushie Settings", "SpawnWeight", 5, "Toil-Slayer plushie spawn chance weight."); ToilSlayerPlushieSpawnAllMoons = new ExtendedConfigEntry("Toil-Slayer Plushie Settings", "SpawnAllMoons", defaultValue: true, "If true, the Toil-Slayer plushie will spawn on all moons. If false, the Toil-Slayer plushie will only spawn on moons set in the moons list."); ToilSlayerPlushieMoonSpawnList = new ExtendedConfigEntry("Toil-Slayer Plushie Settings", "MoonSpawnList", "Experimentation, Assurance, Vow, Offense, March, Adamance, Rend, Dine, Titan, Artifice, Embrion", "The list of moons the Toil-Slayer plushie will spawn on.\nCurrently only works for vanilla moons.\nOnly works if PlushieSpawnAllMoons is false."); ToilSlayerPlushieCarryWeight = new ExtendedConfigEntry("Toil-Slayer Plushie Settings", "CarryWeight", 12, "Toil-Slayer plushie carry weight in pounds."); ToilSlayerPlushieMinValue = new ExtendedConfigEntry("Toil-Slayer Plushie Settings", "MinValue", 150, "Toil-Slayer plushie min scrap value."); ToilSlayerPlushieMaxValue = new ExtendedConfigEntry("Toil-Slayer Plushie Settings", "MaxValue", 380, "Toil-Slayer plushie max scrap value."); TurretLostLOSDuration = new ExtendedConfigEntry("Turret Settings", "LostLOSDuration", 0.75f, "The duration until the turret loses the target player when not in line of sight.\nVanilla Turret Default value: 2"); TurretLostLOSDuration.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretLostLOSDuration : TurretLostLOSDuration.ConfigEntry.Value; TurretRotationRange = new ExtendedConfigEntry("Turret Settings", "RotationRange", 75f, "The rotation range of the turret in degrees.\nVanilla Turret Default value: 75"); TurretRotationRange.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretRotationRange : TurretRotationRange.ConfigEntry.Value; TurretCodeAccessCooldownDuration = new ExtendedConfigEntry("Turret Settings", "CodeAccessCooldownDuration", 7f, "The duration of the turret being disabled from the terminal in seconds.\nVanilla Turret Default value: 7"); TurretCodeAccessCooldownDuration.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretCodeAccessCooldownDuration : TurretCodeAccessCooldownDuration.ConfigEntry.Value; TurretDetectionRotation = new ExtendedConfigEntry("Turret Detection Settings", "Rotation", defaultValue: false, "If enabled, the turret will rotate when searching for players.\nVanilla Turret Default value: true"); TurretDetectionRotation.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretDetectionRotation : TurretDetectionRotation.ConfigEntry.Value; TurretDetectionRotationSpeed = new ExtendedConfigEntry("Turret Detection Settings", "RotationSpeed", 28f, "The rotation speed of the turret when in detection state.\nVanilla Turret Default value: 28"); TurretDetectionRotationSpeed.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretDetectionRotationSpeed : TurretDetectionRotationSpeed.ConfigEntry.Value; TurretChargingDuration = new ExtendedConfigEntry("Turret Charging Settings", "ChargingDuration", 2f, "The duration of the turret charging state.\nVanilla Turret Default value: 1.5"); TurretChargingDuration.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretChargingDuration : TurretChargingDuration.ConfigEntry.Value; TurretChargingRotationSpeed = new ExtendedConfigEntry("Turret Charging Settings", "RotationSpeed", 95f, "The rotation speed of the turret when in charging state.\nVanilla Turret Default value: 95"); TurretChargingRotationSpeed.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretChargingRotationSpeed : TurretChargingRotationSpeed.ConfigEntry.Value; TurretFiringRotationSpeed = new ExtendedConfigEntry("Turret Firing Settings", "RotationSpeed", 95f, "The rotation speed of the turret when in firing state.\nVanilla Turret Default value: 95"); TurretFiringRotationSpeed.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretFiringRotationSpeed : TurretFiringRotationSpeed.ConfigEntry.Value; TurretBerserkDuration = new ExtendedConfigEntry("Turret Berserk Settings", "BerserkDuration", 9f, "The duration of the turret berserk state.\nVanilla Turret Default value: 9"); TurretBerserkDuration.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretBerserkDuration : TurretBerserkDuration.ConfigEntry.Value; TurretBerserkRotationSpeed = new ExtendedConfigEntry("Turret Berserk Settings", "RotationSpeed", 77f, "The rotation speed of the turret when in berserk state.\nVanilla Turret Default value: 77"); TurretBerserkRotationSpeed.GetValue = () => (HostConfigData != null) ? HostConfigData.TurretBerserkRotationSpeed : TurretBerserkRotationSpeed.ConfigEntry.Value; } private string GetDescriptionForSpawnSettings(string enemyName) { string text = enemyName + " spawn settings.\n"; text += "MaxSpawnCount,SpawnChance\n"; return text + ","; } private string GetDescriptionForMoonSpawnSettings(string enemyName, string planetName) { string text = enemyName + " spawn settings for " + planetName + ".\n"; text += "MaxSpawnCount,SpawnChance\n"; return text + ","; } private string GetDescriptionForMoonSpawnSettingsList(string enemyName) { string text = enemyName + " spawn settings list for moons.\n"; text += "Separate each entry with a comma.\n"; text += "PlanetName:MaxSpawnCount:SpawnChance\n"; return text + "::"; } private string GetDescriptionForDefaultSpawnSettings(string enemyName) { string text = enemyName + " default spawn settings for all moons.\n"; text += "MaxSpawnCount:SpawnChance\n"; return text + ":"; } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary dictionary = (Dictionary)property.GetValue(config, null); dictionary.Clear(); config.Save(); } internal void SetHostConfigData(SyncedConfigData syncedConfigData) { HostConfigData = syncedConfigData; } private void SyncedConfigsChanged() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { PluginNetworkBehaviour.Instance.SendConfigToPlayerClientRpc(new SyncedConfigData(this)); } } } public class TurretHeadData { public bool ForceSpawns; public int ForceMaxSpawnCount = -1; public string EnemyName { get; private set; } public bool IsSlayer { get; private set; } public GameObject ControllerPrefab { get; private set; } public MoonSpawnDataList MoonSpawnDataList { get; private set; } public SpawnData ToilationSpawnData { get; private set; } public int SpawnCount { get; private set; } public TurretHeadData(string enemyName, bool isSlayer, GameObject controllerPrefab, MoonSpawnDataList moonSpawnDataList, SpawnData toilationSpawnData) { EnemyName = enemyName; IsSlayer = isSlayer; ControllerPrefab = controllerPrefab; MoonSpawnDataList = moonSpawnDataList; ToilationSpawnData = toilationSpawnData; } public void Reset() { SpawnCount = 0; ForceSpawns = false; ForceMaxSpawnCount = -1; } public void AddToSpawnCount() { SpawnCount++; } public SpawnData GetSpawnDataForCurrentMoon() { if (Utils.IsCurrentMoonToilation()) { return ToilationSpawnData; } return MoonSpawnDataList.GetSpawnDataForCurrentMoon(); } } public static class TurretHeadManager { [CompilerGenerated] private sealed class <>c__DisplayClass30_0 { public PlayerControllerB playerScript; public GameObject ragdollObject; internal bool b__0() { return (Object)(object)playerScript.deadBody != (Object)null; } internal bool b__1() { return (Object)(object)ragdollObject.GetComponentInChildren() != (Object)null; } } [CompilerGenerated] private sealed class d__30 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerControllerB playerScript; private <>c__DisplayClass30_0 <>8__1; public bool isSlayer; public bool isReal; private string 5__2; private DeadBodyInfo 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass30_0(); <>8__1.playerScript = playerScript; if (!NetworkUtils.IsServer) { return false; } 5__2 = <>8__1.playerScript.playerUsername; <>2__current = Utils.WaitUntil(() => (Object)(object)<>8__1.playerScript.deadBody != (Object)null); <>1__state = 1; return true; case 1: <>1__state = -1; 5__3 = <>8__1.playerScript.deadBody; if ((Object)(object)5__3 == (Object)null) { Plugin.logger.LogError((object)$"Error: Failed to set player \"{5__2}\" ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {isReal}) on server. DeadBodyInfo is null."); return false; } <>8__1.ragdollObject = ((Component)5__3).gameObject; if (((Object)<>8__1.ragdollObject).name != "PlayerRagdollSpring Variant(Clone)") { Plugin.logger.LogError((object)$"Error: Failed to set player \"{5__2}\" ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {isReal}) on server. Player ragdoll is not of type \"PlayerRagdollSpring Variant\"."); return false; } <>2__current = Utils.WaitUntil(() => (Object)(object)<>8__1.ragdollObject.GetComponentInChildren() != (Object)null); <>1__state = 2; return true; case 2: { <>1__state = -1; NetworkObject componentInChildren = <>8__1.ragdollObject.GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Plugin.logger.LogError((object)$"Error: Failed to set player \"{5__2}\" ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {isReal}) on server. NetworkObject is null."); return false; } if (Utils.IsTurretHead(5__3)) { Plugin.logger.LogError((object)$"Error: Failed to set player \"{5__2}\" ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {isReal}) on server. Player is already a player ragdoll Turret-Head."); return false; } GameObject controllerPrefab = (isSlayer ? Content.SlayedDeadBodyControllerPrefab : Content.ToiledDeadBodyControllerPrefab); SpawnTurretHeadControllerOnServer(controllerPrefab, ((Component)componentInChildren).transform); Plugin.Instance.LogInfoExtended($"Set player \"{5__2}\" ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {isReal}) on server."); 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(); } } private static Coroutine _setDeadBodyTurretHeadOnServerCoroutine; public static List TurretHeadDataList { get; private set; } = new List(); public static TurretHeadData PlayerTurretHeadData { get; private set; } public static Dictionary EnemyTurretHeadControllerPairs { get; private set; } = new Dictionary(); public static Dictionary PlayerTurretHeadControllerPairs { get; private set; } = new Dictionary(); public static Dictionary DeadBodyTurretHeadControllerPairs { get; private set; } = new Dictionary(); internal static void Initialize() { TurretHeadDataList = new List(6) { new TurretHeadData("Spring", isSlayer: false, Content.ToilHeadControllerPrefab, new MoonSpawnDataList(Plugin.ConfigManager.ToilHeadSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.ToilHeadDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationToilHeadSpawnSettings.Value)), new TurretHeadData("Spring", isSlayer: true, Content.ToilSlayerControllerPrefab, new MoonSpawnDataList(Plugin.ConfigManager.ToilSlayerSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.ToilSlayerDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationToilSlayerSpawnSettings.Value)), new TurretHeadData("Manticoil", isSlayer: false, Content.MantiToilControllerPrefab, new MoonSpawnDataList(Plugin.ConfigManager.MantiToilSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.MantiToilDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationMantiToilSpawnSettings.Value)), new TurretHeadData("Manticoil", isSlayer: true, Content.MantiSlayerControllerPrefab, new MoonSpawnDataList(Plugin.ConfigManager.MantiSlayerSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.MantiSlayerDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationMantiSlayerSpawnSettings.Value)), new TurretHeadData("Masked", isSlayer: false, Content.ToilMaskedControllerPrefab, new MoonSpawnDataList(Plugin.ConfigManager.ToilMaskedSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.ToilMaskedDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationToilMaskedSpawnSettings.Value)), new TurretHeadData("Masked", isSlayer: true, Content.SlayerMaskedControllerPrefab, new MoonSpawnDataList(Plugin.ConfigManager.SlayerMaskedSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.SlayerMaskedDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationSlayerMaskedSpawnSettings.Value)) }; PlayerTurretHeadData = new TurretHeadData(string.Empty, isSlayer: false, null, new MoonSpawnDataList(Plugin.ConfigManager.ToilPlayerSpawnSettingsMoonList.Value, new SpawnData(Plugin.ConfigManager.ToilPlayerDefaultSpawnSettings.Value)), new SpawnData(Plugin.ConfigManager.ToilationToilPlayerSpawnSettings.Value)); EnemyTurretHeadControllerPairs = new Dictionary(); PlayerTurretHeadControllerPairs = new Dictionary(); DeadBodyTurretHeadControllerPairs = new Dictionary(); _setDeadBodyTurretHeadOnServerCoroutine = null; } internal static void Reset() { TurretHeadDataList.ForEach(delegate(TurretHeadData _) { _.Reset(); }); PlayerTurretHeadData.Reset(); EnemyTurretHeadControllerPairs.Clear(); PlayerTurretHeadControllerPairs.Clear(); DeadBodyTurretHeadControllerPairs.Clear(); _setDeadBodyTurretHeadOnServerCoroutine = null; DespawnAllControllersOnServer(); } internal static bool TrySetEnemyTurretHeadOnServer(EnemyAI enemyScript, bool isSlayer) { if (!NetworkUtils.IsServer) { return false; } string enemyName = enemyScript.enemyType.enemyName; TurretHeadData enemyTurretHeadData = GetEnemyTurretHeadData(enemyName, isSlayer); if (enemyTurretHeadData == null) { Plugin.logger.LogError((object)("Error: Failed to try set \"" + enemyName + "\" Turret-Head on server. TurretHeadData is null.")); return false; } SpawnData spawnDataForCurrentMoon = enemyTurretHeadData.GetSpawnDataForCurrentMoon(); int num = spawnDataForCurrentMoon.MaxSpawnCount; if (enemyTurretHeadData.ForceMaxSpawnCount > -1) { num = enemyTurretHeadData.ForceMaxSpawnCount; } if (!enemyTurretHeadData.ForceSpawns) { if (enemyTurretHeadData.SpawnCount >= num) { return false; } if (!Utils.RandomPercent(spawnDataForCurrentMoon.SpawnChance)) { return false; } } return SetEnemyTurretHeadOnServer(enemyScript, isSlayer); } internal static void TrySetPlayerTurretHeadsOnServer() { if (!NetworkUtils.IsServer || !StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap || GameNetworkManager.Instance.connectedPlayers == 1) { return; } List list = StartOfRound.Instance.allPlayerScripts.ToList(); for (int num = list.Count - 1; num >= 0; num--) { int index = Random.Range(0, num); bool isSlayer = Utils.RandomPercent(Plugin.ConfigManager.ToilPlayerSlayerChance.Value); PlayerControllerB val = list[index]; if (((Component)val).gameObject.activeSelf && val.isPlayerControlled) { TrySetPlayerTurretHeadOnServer(val, isSlayer); list.RemoveAt(index); } } } internal static bool TrySetPlayerTurretHeadOnServer(PlayerControllerB playerScript, bool isSlayer) { if (!NetworkUtils.IsServer) { return false; } TurretHeadData playerTurretHeadData = PlayerTurretHeadData; SpawnData spawnDataForCurrentMoon = playerTurretHeadData.GetSpawnDataForCurrentMoon(); int num = spawnDataForCurrentMoon.MaxSpawnCount; if (playerTurretHeadData.ForceMaxSpawnCount > -1) { num = playerTurretHeadData.ForceMaxSpawnCount; } if (!playerTurretHeadData.ForceSpawns) { if (playerTurretHeadData.SpawnCount >= num) { return false; } if (!Utils.RandomPercent(spawnDataForCurrentMoon.SpawnChance)) { return false; } } return SetPlayerTurretHeadOnServer(playerScript, isSlayer); } public static bool SetEnemyTurretHeadOnServer(EnemyAI enemyScript, bool isSlayer) { if (!NetworkUtils.IsServer) { return false; } if ((Object)(object)enemyScript == (Object)null) { Plugin.logger.LogError((object)$"Error: Failed to set enemy Turret-Head (isSlayer? {isSlayer}) on server. EnemyAI is null."); return false; } string enemyName = enemyScript.enemyType.enemyName; if (enemyScript.isEnemyDead) { Plugin.logger.LogError((object)$"Error: Failed to set enemy \"{enemyName}\" Turret-Head (isSlayer? {isSlayer}) on server. Enemy is already dead."); return false; } if (Utils.IsTurretHead(enemyScript)) { Plugin.logger.LogError((object)$"Error: Failed to set enemy \"{enemyName}\" Turret-Head (isSlayer? {isSlayer}) on server. Enemy is already a Turret-Head."); return false; } TurretHeadData enemyTurretHeadData = GetEnemyTurretHeadData(enemyName, isSlayer); if (enemyTurretHeadData == null) { Plugin.logger.LogError((object)$"Error: Failed to set enemy \"{enemyName}\" Turret-Head (isSlayer? {isSlayer}) on server. TurretHeadData is null."); return false; } SpawnTurretHeadControllerOnServer(enemyTurretHeadData.ControllerPrefab, ((Component)enemyScript).transform); Plugin.Instance.LogInfoExtended($"Set enemy \"{enemyName}\" Turret-Head (isSlayer? {isSlayer}) on server."); return true; } public static bool SetPlayerTurretHeadOnServer(PlayerControllerB playerScript, bool isSlayer) { if (!NetworkUtils.IsServer) { return false; } string playerUsername = playerScript.playerUsername; if ((Object)(object)playerScript == (Object)null) { Plugin.logger.LogError((object)$"Error: Failed to set player \"{playerUsername}\" Turret-Head (isSlayer? {isSlayer}) on server. PlayerControllerB is null."); return false; } if (playerScript.isPlayerDead) { Plugin.logger.LogError((object)$"Error: Failed to set player \"{playerUsername}\" Turret-Head (isSlayer? {isSlayer}) on server. Player is already dead."); return false; } if (Utils.IsTurretHead(playerScript)) { Plugin.logger.LogError((object)$"Error: Failed to set player \"{playerUsername}\" Turret-Head (isSlayer? {isSlayer}) on server. Player is already a Turret-Head."); return false; } GameObject controllerPrefab = (isSlayer ? Content.SlayerPlayerControllerPrefab : Content.ToilPlayerControllerPrefab); SpawnTurretHeadControllerOnServer(controllerPrefab, ((Component)playerScript).transform); Plugin.Instance.LogInfoExtended($"Set player \"{playerUsername}\" Turret-Head (isSlayer? {isSlayer}) on server."); return true; } public static void SetDeadBodyTurretHead(PlayerControllerB playerScript, bool isSlayer) { if (NetworkUtils.IsServer) { SetDeadBodyTurretHeadOnServer(playerScript, isSlayer); } else { PluginNetworkBehaviour.Instance.SetToilHeadPlayerRagdollServerRpc(PlayerUtils.GetPlayerId(playerScript), isSlayer); } } public static void SetDeadBodyTurretHeadOnServer(PlayerControllerB playerScript, bool isSlayer) { if (!NetworkUtils.IsServer) { return; } bool value = Plugin.ConfigManager.SpawnRealToiledPlayerRagdolls.Value; if (!Plugin.ConfigManager.SpawnToiledPlayerRagdolls.Value) { Plugin.Instance.LogErrorExtended($"Error: Failed to set player ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {value}) on server. Spawning player ragdoll Turret-Heads is disabled in the config settings."); return; } if ((Object)(object)playerScript == (Object)null) { Plugin.logger.LogError((object)$"Error: Failed to set player ragdoll Turret-Head (isSlayer? {isSlayer}, isReal? {value}) on server. PlayerControllerB is null."); return; } if (_setDeadBodyTurretHeadOnServerCoroutine != null) { ((MonoBehaviour)StartOfRound.Instance).StopCoroutine(_setDeadBodyTurretHeadOnServerCoroutine); } _setDeadBodyTurretHeadOnServerCoroutine = ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(SetDeadBodyTurretHeadOnServerCO(playerScript, isSlayer, value)); } [IteratorStateMachine(typeof(d__30))] private static IEnumerator SetDeadBodyTurretHeadOnServerCO(PlayerControllerB playerScript, bool isSlayer, bool isReal) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0) { playerScript = playerScript, isSlayer = isSlayer, isReal = isReal }; } private static void SpawnTurretHeadControllerOnServer(GameObject controllerPrefab, Transform parentTransform) { if (NetworkUtils.IsServer) { GameObject val = Object.Instantiate(controllerPrefab, parentTransform); val.GetComponent().Spawn(false); val.transform.SetParent(parentTransform); val.GetComponent().SetupTurret(); } } public static void AddEnemyTurretHeadControllerPair(EnemyAI enemyScript, TurretHeadControllerBehaviour behaviour) { EnemyTurretHeadControllerPairs.Add(enemyScript, behaviour); } public static void AddPlayerTurretHeadControllerPair(PlayerControllerB playerScript, TurretHeadControllerBehaviour behaviour) { PlayerTurretHeadControllerPairs.Add(playerScript, behaviour); } public static void AddDeadBodyTurretHeadControllerPair(PlayerControllerB playerScript, TurretHeadControllerBehaviour behaviour) { DeadBodyTurretHeadControllerPairs.Add(playerScript, behaviour); } internal static void AddToEnemySpawnCount(EnemyAI enemyScript, bool isSlayer) { string enemyName = enemyScript.enemyType.enemyName; TurretHeadData enemyTurretHeadData = GetEnemyTurretHeadData(enemyName, isSlayer); if (enemyTurretHeadData == null) { Plugin.logger.LogError((object)("Error: Failed to add to spawn count for enemy \"" + enemyName + "\". TurretHeadData is null.")); return; } enemyTurretHeadData.AddToSpawnCount(); Plugin.Instance.LogInfoExtended($"AddToEnemySpawnCount(); Enemy \"{enemyName}\" SpawnCount: {enemyTurretHeadData.SpawnCount}, MaxSpawnCount: {enemyTurretHeadData.GetSpawnDataForCurrentMoon().MaxSpawnCount}, SpawnChance: {enemyTurretHeadData.GetSpawnDataForCurrentMoon().SpawnChance}"); } internal static void AddToPlayerSpawnCount() { TurretHeadData playerTurretHeadData = PlayerTurretHeadData; playerTurretHeadData.AddToSpawnCount(); } public static TurretHeadData GetEnemyTurretHeadData(string enemyName, bool isSlayer) { foreach (TurretHeadData turretHeadData in TurretHeadDataList) { if (turretHeadData.EnemyName.Equals(enemyName, StringComparison.OrdinalIgnoreCase) && turretHeadData.IsSlayer == isSlayer) { return turretHeadData; } } return null; } public static void DespawnEnemyControllerOnServer(EnemyAI enemyScript) { if (!NetworkUtils.IsServer) { return; } string enemyName = enemyScript.enemyType.enemyName; if (EnemyTurretHeadControllerPairs.TryGetValue(enemyScript, out var value)) { NetworkObject val = default(NetworkObject); if (((Component)value).TryGetComponent(ref val)) { val.Despawn(true); Plugin.Instance.LogInfoExtended("Despawned enemy \"" + enemyName + "\" Turret-Head controller."); } else { Plugin.logger.LogError((object)("Error: Failed to despawn enemy \"" + enemyName + "\" Turret-Head controller. NetworkObject is null.")); } EnemyTurretHeadControllerPairs.Remove(enemyScript); } else { Plugin.logger.LogError((object)("Error: Failed to despawn enemy \"" + enemyName + "\" Turret-Head controller. Could not find value from key.")); } } public static void DespawnPlayerControllerOnServer(PlayerControllerB playerScript) { if (!NetworkUtils.IsServer) { return; } string playerUsername = playerScript.playerUsername; if (PlayerTurretHeadControllerPairs.TryGetValue(playerScript, out var value)) { NetworkObject val = default(NetworkObject); if (((Component)value).TryGetComponent(ref val)) { val.Despawn(true); Plugin.Instance.LogInfoExtended("Despawned player \"" + playerUsername + "\" Turret-Head controller."); } else { Plugin.logger.LogError((object)("Error: Failed to despawn player \"" + playerUsername + "\" Turret-Head controller. NetworkObject is null.")); } PlayerTurretHeadControllerPairs.Remove(playerScript); } else { Plugin.logger.LogError((object)("Error: Failed to despawn player \"" + playerUsername + "\" Turret-Head controller. Could not find value from key.")); } } public static void DespawnDeadBodyControllerOnServer(PlayerControllerB playerScript) { if (!NetworkUtils.IsServer) { return; } string playerUsername = playerScript.playerUsername; if (DeadBodyTurretHeadControllerPairs.TryGetValue(playerScript, out var value)) { NetworkObject val = default(NetworkObject); if (((Component)value).TryGetComponent(ref val)) { val.Despawn(true); Plugin.Instance.LogInfoExtended("Despawned player \"" + playerUsername + "\" ragdoll Turret-Head controller."); } else { Plugin.logger.LogError((object)("Error: Failed to despawn player \"" + playerUsername + "\" ragdoll Turret-Head controller. NetworkObject is null.")); } DeadBodyTurretHeadControllerPairs.Remove(playerScript); } else { Plugin.logger.LogError((object)("Error: Failed to despawn player \"" + playerUsername + "\" ragdoll Turret-Head controller. Could not find value from key.")); } } private static void DespawnAllControllersOnServer() { if (!NetworkUtils.IsServer) { return; } try { TurretHeadControllerBehaviour[] array = Object.FindObjectsByType((FindObjectsSortMode)0); NetworkObject val = default(NetworkObject); foreach (TurretHeadControllerBehaviour turretHeadControllerBehaviour in array) { if (!((Component)turretHeadControllerBehaviour).TryGetComponent(ref val)) { Plugin.logger.LogError((object)"Error: Failed to despawn TurretHeadBehaviour. NetworkObject is null."); } else { val.Despawn(true); } } Plugin.Instance.LogInfoExtended("Finished despawning all TurretHeadBehaviour(s)."); } catch (Exception arg) { Plugin.logger.LogError((object)$"Error: Failed to despawn all TurretHeadBehaviour(s).\n\n{arg}"); } } public static bool IsEnemyTurretHead(EnemyAI enemyScript) { return EnemyTurretHeadControllerPairs.ContainsKey(enemyScript); } public static bool IsPlayerTurretHead(PlayerControllerB playerScript) { return PlayerTurretHeadControllerPairs.ContainsKey(playerScript); } public static bool IsDeadBodyTurretHead(PlayerControllerB playerScript) { return DeadBodyTurretHeadControllerPairs.ContainsKey(playerScript); } } public static class Utils { [CompilerGenerated] private sealed class d__3 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int iterationsPerSecond; public Func predicate; public float maxDuration; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 0f; 5__3 = 1f / (float)iterationsPerSecond; break; case 1: <>1__state = -1; 5__2 += Time.deltaTime; break; } if (5__2 < maxDuration && !predicate()) { <>2__current = (object)new WaitForSeconds(5__3); <>1__state = 1; return true; } 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 bool RandomPercent(float percent) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return Random.value * 100f <= percent; } public static void DisableColliders(GameObject gameObject, bool keepScanNodeEnabled = false) { Collider[] componentsInChildren = gameObject.GetComponentsInChildren(); Collider[] array = componentsInChildren; foreach (Collider val in array) { if (!keepScanNodeEnabled || !(((Object)((Component)val).gameObject).name == "ScanNode")) { val.enabled = false; } } } public static void DisableRenderers(GameObject gameObject) { MeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren(); foreach (MeshRenderer val in componentsInChildren) { ((Renderer)val).enabled = false; } SkinnedMeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } } [IteratorStateMachine(typeof(d__3))] public static IEnumerator WaitUntil(Func predicate, float maxDuration = 5f, int iterationsPerSecond = 10) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { predicate = predicate, maxDuration = maxDuration, iterationsPerSecond = iterationsPerSecond }; } public static bool IsValidEnemy(EnemyAI enemyScript) { if (IsSpring(enemyScript)) { return true; } if (IsManticoil(enemyScript)) { return true; } if (IsMasked(enemyScript)) { return true; } return false; } public static bool IsSpring(EnemyAI enemyScript) { return enemyScript.enemyType.enemyName == "Spring"; } public static bool IsManticoil(EnemyAI enemyScript) { return enemyScript.enemyType.enemyName == "Manticoil"; } public static bool IsMasked(EnemyAI enemyScript) { return enemyScript.enemyType.enemyName == "Masked"; } public static bool IsTurretHead(EnemyAI enemyScript) { return (Object)(object)((Component)enemyScript).GetComponentInChildren() != (Object)null; } public static bool IsTurretHead(PlayerControllerB playerScript) { return (Object)(object)((Component)playerScript).GetComponentInChildren() != (Object)null; } public static bool IsTurretHead(DeadBodyInfo deadBodyScript) { return (Object)(object)((Component)deadBodyScript).GetComponentInChildren() != (Object)null; } public static bool IsCurrentMoonToilation() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } string planetName = StartOfRound.Instance.currentLevel.PlanetName; if (planetName.Equals("69 Toilation", StringComparison.OrdinalIgnoreCase)) { return true; } if (planetName.Contains("Toilation", StringComparison.OrdinalIgnoreCase)) { return true; } return false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.ToilHead"; public const string PLUGIN_NAME = "ToilHead"; public const string PLUGIN_VERSION = "1.9.1"; } } namespace com.github.zehsteam.ToilHead.Patches { [HarmonyPatch(typeof(EnemyAI))] internal static class EnemyAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref EnemyAI __instance) { if (Utils.IsValidEnemy(__instance) && !TurretHeadManager.TrySetEnemyTurretHeadOnServer(__instance, isSlayer: true)) { TurretHeadManager.TrySetEnemyTurretHeadOnServer(__instance, isSlayer: false); } } [HarmonyPatch("HitEnemyServerRpc")] [HarmonyPostfix] private static void HitEnemyServerRpcPatch(ref EnemyAI __instance, int playerWhoHit) { if (!__instance.isEnemyDead && TurretHeadManager.EnemyTurretHeadControllerPairs.TryGetValue(__instance, out var value) && value.TurretBehaviour.turretActive) { value.TurretBehaviour.EnterBerserkModeClientRpc(); } } [HarmonyPatch("KillEnemy")] [HarmonyPrefix] private static void KillEnemyPatch(ref EnemyAI __instance, bool destroy) { if (NetworkUtils.IsServer && destroy && TurretHeadManager.IsEnemyTurretHead(__instance)) { TurretHeadManager.DespawnEnemyControllerOnServer(__instance); } } } [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { AddNetworkPrefabs(); } private static void AddNetworkPrefabs() { AddNetworkPrefab(Content.NetworkHandlerPrefab); AddNetworkPrefab(Content.ToilHeadControllerPrefab); AddNetworkPrefab(Content.ToilSlayerControllerPrefab); AddNetworkPrefab(Content.MantiToilControllerPrefab); AddNetworkPrefab(Content.MantiSlayerControllerPrefab); AddNetworkPrefab(Content.ToilPlayerControllerPrefab); AddNetworkPrefab(Content.SlayerPlayerControllerPrefab); AddNetworkPrefab(Content.ToiledDeadBodyControllerPrefab); AddNetworkPrefab(Content.SlayedDeadBodyControllerPrefab); AddNetworkPrefab(Content.ToilMaskedControllerPrefab); AddNetworkPrefab(Content.SlayerMaskedControllerPrefab); } private static void AddNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Plugin.logger.LogError((object)"Error: Failed to register network prefab. Prefab is null."); return; } NetworkManager.Singleton.AddNetworkPrefab(prefab); Plugin.logger.LogInfo((object)("Registered \"" + ((Object)prefab).name + "\" network prefab.")); } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal static class MaskedPlayerEnemyPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref EnemyAI __instance) { if (!TurretHeadManager.TrySetEnemyTurretHeadOnServer(__instance, isSlayer: true)) { TurretHeadManager.TrySetEnemyTurretHeadOnServer(__instance, isSlayer: false); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("KillPlayerServerRpc")] [HarmonyPrefix] private static void KillPlayerServerRpcPatch(ref PlayerControllerB __instance) { if (TurretHeadManager.IsPlayerTurretHead(__instance)) { TurretHeadManager.DespawnPlayerControllerOnServer(__instance); } } [HarmonyPatch("OnDestroy")] [HarmonyPrefix] private static void OnDestroyPatch(ref PlayerControllerB __instance) { if (NetworkUtils.IsServer && TurretHeadManager.IsPlayerTurretHead(__instance)) { TurretHeadManager.DespawnPlayerControllerOnServer(__instance); } } } [HarmonyPatch(typeof(RagdollGrabbableObject))] internal static class RagdollGrabbableObjectPatch { [HarmonyPatch("OnDestroy")] [HarmonyPrefix] private static void OnDestroyPatch(ref RagdollGrabbableObject __instance) { if (NetworkUtils.IsServer && !((Object)(object)__instance.ragdoll == (Object)null) && !((Object)(object)__instance.ragdoll.playerScript == (Object)null)) { PlayerControllerB playerScript = __instance.ragdoll.playerScript; if (TurretHeadManager.IsDeadBodyTurretHead(playerScript)) { TurretHeadManager.DespawnDeadBodyControllerOnServer(playerScript); } } } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatch { [HarmonyPatch("LoadNewLevel")] [HarmonyPostfix] private static void LoadNewLevelPatch() { Plugin.Instance.OnNewLevelLoaded(); } [HarmonyPatch("GenerateNewLevelClientRpc")] [HarmonyPrefix] private static void GenerateNewLevelClientRpcPatch() { if (!NetworkUtils.IsServer) { Plugin.Instance.OnNewLevelLoaded(); } } [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpcPatch() { Plugin.Instance.OnNewLevelFinishedLoading(); } } [HarmonyPatch(typeof(SpringManAI))] internal static class SpringManAIPatch { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPostfix] private static void OnCollideWithPlayerPatch(ref SpringManAI __instance, ref Collider other) { TurretHeadControllerBehaviour componentInChildren = ((Component)__instance).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { PlayerControllerB component = ((Component)other).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null) && PlayerUtils.IsLocalPlayer(component) && component.AllowPlayerDeath()) { bool isMinigun = componentInChildren.TurretBehaviour.IsMinigun; Plugin.Instance.LogInfoExtended($"SpringManAI OnCollideWithPlayer \"{component.playerUsername}\" isSlayer? {isMinigun}"); TurretHeadManager.SetDeadBodyTurretHead(component, isMinigun); } } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch() { SpawnNetworkHandler(); } private static void SpawnNetworkHandler() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { GameObject val = Object.Instantiate(Content.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } [HarmonyPatch("OnClientConnect")] [HarmonyPrefix] private static void OnClientConnectPatch(ref ulong clientId) { SendConfigToNewConnectedPlayer(clientId); } private static void SendConfigToNewConnectedPlayer(ulong clientId) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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) //IL_0028: 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_002e: 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 (NetworkUtils.IsServer) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; Plugin.logger.LogInfo((object)$"Sending config to client: {clientId}"); PluginNetworkBehaviour.Instance.SendConfigToPlayerClientRpc(new SyncedConfigData(Plugin.ConfigManager), clientRpcParams); } } [HarmonyPatch("ShipHasLeft")] [HarmonyPostfix] private static void ShipHasLeftPatch() { Plugin.Instance.OnShipHasLeft(); } [HarmonyPatch("OnLocalDisconnect")] [HarmonyPrefix] private static void OnLocalDisconnectPatch() { Plugin.Instance.OnLocalDisconnect(); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { [HarmonyPatch("CallFunctionInAccessibleTerminalObject")] [HarmonyPostfix] private static void CallFunctionInAccessibleTerminalObjectPatch(string word, ref bool ___broadcastedCodeThisFrame) { FollowTerminalAccessibleObjectBehaviour[] array = Object.FindObjectsByType((FindObjectsSortMode)0); FollowTerminalAccessibleObjectBehaviour[] array2 = array; foreach (FollowTerminalAccessibleObjectBehaviour followTerminalAccessibleObjectBehaviour in array2) { if (!(followTerminalAccessibleObjectBehaviour.objectCode != word)) { Plugin.Instance.LogInfoExtended("Found accessible terminal object with corresponding string, calling function."); ___broadcastedCodeThisFrame = true; followTerminalAccessibleObjectBehaviour.CallFunctionFromTerminal(); } } } } [HarmonyPatch(typeof(Turret))] internal static class TurretPatch { [HarmonyPatch("CheckForPlayersInLineOfSight")] [HarmonyPostfix] private static void CheckForPlayersInLineOfSightPatch(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && TurretHeadManager.IsPlayerTurretHead(__result)) { __result = null; } } } } namespace com.github.zehsteam.ToilHead.MonoBehaviours { public class FollowTerminalAccessibleObjectBehaviour : NetworkBehaviour { [CompilerGenerated] private sealed class d__27 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FollowTerminalAccessibleObjectBehaviour <>4__this; private Image 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0105: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_008f: 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) int num = <>1__state; FollowTerminalAccessibleObjectBehaviour followTerminalAccessibleObjectBehaviour = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; followTerminalAccessibleObjectBehaviour.inCooldown = true; if (!followTerminalAccessibleObjectBehaviour.initializedValues) { followTerminalAccessibleObjectBehaviour.InitializeValues(); } 5__2 = followTerminalAccessibleObjectBehaviour.mapRadarBox; Image[] componentsInChildren = ((Component)followTerminalAccessibleObjectBehaviour.mapRadarText).gameObject.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((int)componentsInChildren[i].type == 3) { 5__2 = componentsInChildren[i]; } } ((Behaviour)5__2).enabled = true; ((Graphic)followTerminalAccessibleObjectBehaviour.mapRadarText).color = Color.red; ((Graphic)followTerminalAccessibleObjectBehaviour.mapRadarBox).color = Color.red; goto IL_00ec; } case 1: <>1__state = -1; followTerminalAccessibleObjectBehaviour.currentCooldownTimer -= Time.deltaTime; 5__2.fillAmount = followTerminalAccessibleObjectBehaviour.currentCooldownTimer / followTerminalAccessibleObjectBehaviour.codeAccessCooldownTimer; goto IL_00ec; case 2: { <>1__state = -1; followTerminalAccessibleObjectBehaviour.currentCooldownTimer -= Time.deltaTime; 5__2.fillAmount = Mathf.Abs(followTerminalAccessibleObjectBehaviour.currentCooldownTimer / 1.5f - 1f); 5__3++; if (5__3 % 7 == 0) { ((Behaviour)followTerminalAccessibleObjectBehaviour.mapRadarText).enabled = !((Behaviour)followTerminalAccessibleObjectBehaviour.mapRadarText).enabled; } break; } IL_00ec: if (followTerminalAccessibleObjectBehaviour.currentCooldownTimer > 0f) { <>2__current = null; <>1__state = 1; return true; } followTerminalAccessibleObjectBehaviour.TerminalCodeCooldownReached(); ((Graphic)followTerminalAccessibleObjectBehaviour.mapRadarText).color = Color.green; ((Graphic)followTerminalAccessibleObjectBehaviour.mapRadarBox).color = Color.green; followTerminalAccessibleObjectBehaviour.currentCooldownTimer = 1.5f; 5__3 = 0; break; } if (followTerminalAccessibleObjectBehaviour.currentCooldownTimer > 0f) { <>2__current = null; <>1__state = 2; return true; } ((Behaviour)followTerminalAccessibleObjectBehaviour.mapRadarText).enabled = true; ((Behaviour)5__2).enabled = false; followTerminalAccessibleObjectBehaviour.inCooldown = 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(); } } [HideInInspector] public string objectCode; [HideInInspector] public float codeAccessCooldownTimer = 7f; public InteractEvent terminalCodeEvent; public InteractEvent terminalCodeCooldownEvent; [Space(3f)] [HideInInspector] public MeshRenderer[] codeMaterials; [HideInInspector] public int rows; [HideInInspector] public int columns; private bool initializedValues; private TextMeshProUGUI mapRadarText; private Image mapRadarBox; [HideInInspector] public bool inCooldown { get; private set; } [HideInInspector] public float currentCooldownTimer { get; private set; } [HideInInspector] public RectTransform mapRadarRectTransform { get; private set; } private void Start() { InitializeValues(); codeAccessCooldownTimer = Plugin.ConfigManager.TurretCodeAccessCooldownDuration.Value; } public void InitializeValues() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (!initializedValues) { initializedValues = true; GameObject val = Object.Instantiate(StartOfRound.Instance.objectCodePrefab, StartOfRound.Instance.mapScreen.mapCameraStationaryUI, false); mapRadarRectTransform = val.GetComponent(); ((Transform)mapRadarRectTransform).position = ((Component)this).transform.position + Vector3.up * 4.35f; RectTransform obj = mapRadarRectTransform; ((Transform)obj).position = ((Transform)obj).position + (((Transform)mapRadarRectTransform).up * 1.2f - ((Transform)mapRadarRectTransform).right * 1.2f); mapRadarText = val.GetComponentInChildren(); ((TMP_Text)mapRadarText).text = objectCode; mapRadarBox = val.GetComponentInChildren(); } } private void Update() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0074: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)mapRadarRectTransform == (Object)null)) { ((Transform)mapRadarRectTransform).position = ((Component)this).transform.position + Vector3.up * 4.35f; RectTransform obj = mapRadarRectTransform; ((Transform)obj).position = ((Transform)obj).position + (((Transform)mapRadarRectTransform).up * 1.2f - ((Transform)mapRadarRectTransform).right * 1.2f); } } public void CallFunctionFromTerminal() { if (!inCooldown) { ((UnityEvent)(object)terminalCodeEvent).Invoke(GameNetworkManager.Instance.localPlayerController); if (codeAccessCooldownTimer > 0f) { currentCooldownTimer = codeAccessCooldownTimer; ((MonoBehaviour)this).StartCoroutine(countCodeAccessCooldown()); } Plugin.Instance.LogInfoExtended("calling terminal function for code : " + objectCode + "; object name: " + ((Object)((Component)this).gameObject).name); } } public void TerminalCodeCooldownReached() { ((UnityEvent)(object)terminalCodeCooldownEvent).Invoke((PlayerControllerB)null); Plugin.Instance.LogInfoExtended("cooldown reached for object with code : " + objectCode + "; object name: " + ((Object)((Component)this).gameObject).name); } [IteratorStateMachine(typeof(d__27))] private IEnumerator countCodeAccessCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__27(0) { <>4__this = this }; } public void SetCodeTo(int codeIndex) { if (codeIndex > RoundManager.Instance.possibleCodesForBigDoors.Length) { Plugin.logger.LogError((object)"Attempted setting code to an index higher than the amount of possible codes in FollowTerminalAccessibleObjectBehaviour."); return; } objectCode = RoundManager.Instance.possibleCodesForBigDoors[codeIndex]; SetMaterialUV(codeIndex); if ((Object)(object)mapRadarText == (Object)null) { InitializeValues(); } ((TMP_Text)mapRadarText).text = objectCode; } public override void OnDestroy() { if ((Object)(object)mapRadarText != (Object)null && (Object)(object)((Component)mapRadarText).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)mapRadarText).gameObject); } ((NetworkBehaviour)this).OnDestroy(); } private void SetMaterialUV(int codeIndex) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) float num = 0f; float num2 = 0f; for (int i = 0; i < codeIndex; i++) { num += 1f / (float)columns; if (num >= 1f) { num = 0f; num2 += 1f / (float)rows; if (num2 >= 1f) { num2 = 0f; } } } if (codeMaterials != null && codeMaterials.Length != 0) { Material material = ((Renderer)codeMaterials[0]).material; material.SetTextureOffset("_BaseColorMap", new Vector2(num, num2)); for (int j = 0; j < codeMaterials.Length; j++) { ((Renderer)codeMaterials[j]).sharedMaterial = material; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "FollowTerminalAccessibleObjectBehaviour"; } } public class ParentToTransformBehaviour : MonoBehaviour { private Transform _targetTransform; private Transform _parentTransform; private Vector3 _positionOffset; private Vector3 _rotationOffset; private void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_00a6: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) if (!((Object)(object)_targetTransform == (Object)null) && !((Object)(object)_parentTransform == (Object)null) && ((Component)_parentTransform).gameObject.activeSelf) { _targetTransform.rotation = _parentTransform.rotation; _targetTransform.Rotate(_rotationOffset, (Space)1); Vector3 position = _parentTransform.position; position += _targetTransform.right * _positionOffset.x + _targetTransform.up * _positionOffset.y + _targetTransform.forward * _positionOffset.z; _targetTransform.position = position; } } public void SetTargetAndParentTransform(Transform targetTransform, Transform parentTransform) { _targetTransform = targetTransform; _parentTransform = parentTransform; } public void SetPositionAndRotationOffset(Vector3 positionOffset, Vector3 rotationOffset) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _positionOffset = positionOffset; _rotationOffset = rotationOffset; } } public class PluginNetworkBehaviour : NetworkBehaviour { public static PluginNetworkBehaviour Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } [ClientRpc] internal void SendConfigToPlayerClientRpc(SyncedConfigData syncedConfigData, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4024047205u, clientRpcParams, (RpcDelivery)0); bool flag = syncedConfigData != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(ref syncedConfigData, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4024047205u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) { Plugin.logger.LogInfo((object)"Syncing config with host."); Plugin.ConfigManager.SetHostConfigData(syncedConfigData); } } } [ServerRpc(RequireOwnership = false)] public void SetToilHeadPlayerRagdollServerRpc(int fromPlayerId, bool isSlayer) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3293182545u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, fromPlayerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isSlayer, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3293182545u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TurretHeadManager.SetDeadBodyTurretHeadOnServer(PlayerUtils.GetPlayerScript(fromPlayerId), isSlayer); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4024047205u, new RpcReceiveHandler(__rpc_handler_4024047205), "SendConfigToPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(3293182545u, new RpcReceiveHandler(__rpc_handler_3293182545), "SetToilHeadPlayerRagdollServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4024047205(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); SyncedConfigData syncedConfigData = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref syncedConfigData, default(ForNetworkSerializable)); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SendConfigToPlayerClientRpc(syncedConfigData, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3293182545(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int fromPlayerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref fromPlayerId); bool isSlayer = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isSlayer, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetToilHeadPlayerRagdollServerRpc(fromPlayerId, isSlayer); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PluginNetworkBehaviour"; } } public class SyncYRotationBehaviour : MonoBehaviour { public Transform TargetTransform; private void Update() { //IL_0020: 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_0034: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)TargetTransform == (Object)null)) { ((Component)this).transform.rotation = Quaternion.Euler(new Vector3(0f, TargetTransform.eulerAngles.y, 0f)); } } } public class ToilHeadTurretBehaviour : NetworkBehaviour { [CompilerGenerated] private sealed class d__67 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ToilHeadTurretBehaviour <>4__this; private float 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__67(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown int num = <>1__state; ToilHeadTurretBehaviour toilHeadTurretBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = toilHeadTurretBehaviour.bulletCollisionAudio.volume; 5__3 = 0; break; case 1: <>1__state = -1; toilHeadTurretBehaviour.bulletCollisionAudio.volume = Mathf.Lerp(5__2, 0f, (float)5__3 / 30f); 5__3++; break; } if (5__3 <= 30) { <>2__current = (object)new WaitForSeconds(0.012f); <>1__state = 1; return true; } toilHeadTurretBehaviour.bulletCollisionAudio.Stop(); 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(); } } [Header("Audio Sources")] [Space(5f)] public AudioSource mainAudio; public AudioSource farAudio; public AudioSource bulletCollisionAudio; public AudioSource berserkAudio; [Header("Audio Clips")] [Space(5f)] public AudioClip firingSFX; public AudioClip chargingSFX; public AudioClip detectPlayerSFX; public AudioClip firingFarSFX; public AudioClip bulletsHitWallSFX; public AudioClip turretActivate; public AudioClip turretDeactivate; [Header("Transforms")] [Space(5f)] public Transform turretRod; public Transform turnTowardsObjectCompass; public Transform forwardFacingPos; public Transform aimPoint; public Transform aimTurretCenterPoint; public Transform centerPoint; public Transform tempTransform; [HideInInspector] public Transform targetTransform; [Header("Turret Properties")] [Space(5f)] public Animator turretAnimator; public ParticleSystem bulletParticles; public float rotationRange = 75f; public float chargingDelay = 0.5f; [HideInInspector] public TurretMode turretMode; [HideInInspector] public bool turretActive = true; [HideInInspector] public float targetRotation; [HideInInspector] public float rotationSpeed = 28f; [HideInInspector] public PlayerControllerB targetPlayerWithRotation; [Header("Line Of Sight")] [Space(5f)] public float LOSRange = 30f; public float LOSDistance = 30f; public int LOSVerticalRays = 3; public int LOSHorizontalRays = 7; public float LOSXRotationOffsetStart = -5f; public float LOSXRotationOffsetAmountPerRay = 5f; [Header("Turrer Head Properties")] [Space(5f)] public bool IsMinigun; public Transform SyncToHeadTransform; private TurretMode _turretModeLastFrame; private bool _targetingDeadPlayer; private bool _rotatingRight; private float _switchRotationTimer; private bool _hasLineOfSight; private float _lostLOSTimer; private RaycastHit _hit; private bool _wasTargetingPlayerLastFrame; private float _turretInterval; private bool _rotatingSmoothly = true; private Ray _shootRay; private Coroutine _fadeBulletAudioCoroutine; private bool _rotatingClockwise; private float _berserkTimer; private bool _enteringBerserkMode; private float _chargingTimer; private bool _playedChargingSFX; private int _damage = 25; private float _damageRate = 0.21f; [HideInInspector] public bool CanTargetPlayers = true; [HideInInspector] public bool UseMantiToilSettings; [HideInInspector] public float LostLOSDuration = 0.75f; [HideInInspector] public bool DetectionRotation; [HideInInspector] public float DetectionRotationSpeed = 28f; [HideInInspector] public float ChargingDuration = 2f; [HideInInspector] public float ChargingRotationSpeed = 95f; [HideInInspector] public float FiringRotationSpeed = 95f; [HideInInspector] public float BerserkDuration = 9f; [HideInInspector] public float BerserkRotationSpeed = 77f; private void Start() { SetCustomVariables(); if (NetworkUtils.IsServer) { SetObjectCodeOnServer(); } } private void SetCustomVariables() { SyncedConfigManager configManager = Plugin.ConfigManager; LostLOSDuration = configManager.TurretLostLOSDuration.Value; rotationRange = Mathf.Abs(configManager.TurretRotationRange.Value); if (UseMantiToilSettings) { LostLOSDuration = 5f; } if (IsMinigun && !UseMantiToilSettings) { LostLOSDuration = 3f; } DetectionRotation = configManager.TurretDetectionRotation.Value; DetectionRotationSpeed = configManager.TurretDetectionRotationSpeed.Value; ChargingDuration = configManager.TurretChargingDuration.Value; ChargingRotationSpeed = configManager.TurretChargingRotationSpeed.Value; if (IsMinigun) { ChargingDuration = detectPlayerSFX.length + chargingDelay + chargingSFX.length; ChargingRotationSpeed *= 0.5f; } FiringRotationSpeed = configManager.TurretFiringRotationSpeed.Value; if (IsMinigun) { FiringRotationSpeed *= 0.5f; } _damage = (IsMinigun ? 15 : 25); _damageRate = (IsMinigun ? 0.105f : 0.21f); BerserkDuration = configManager.TurretBerserkDuration.Value; BerserkRotationSpeed = configManager.TurretBerserkRotationSpeed.Value; if (IsMinigun) { BerserkDuration *= 2f; BerserkRotationSpeed *= 0.5f; } rotationSpeed = DetectionRotationSpeed; if (UseMantiToilSettings && !IsMinigun) { LOSVerticalRays = 6; } if (IsMinigun && !IsOnEnemy()) { LOSRange = 30f; LOSVerticalRays = 3; LOSXRotationOffsetStart = -5f; LOSXRotationOffsetAmountPerRay = 5f; } } [IteratorStateMachine(typeof(d__67))] private IEnumerator FadeBulletAudio() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__67(0) { <>4__this = this }; } private void Update() { if (OtherUpdateStuff() && TurretModeLogic()) { RotateTurretRod(); } } private bool OtherUpdateStuff() { //IL_0019: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!turretActive || !CanTargetPlayers) { _wasTargetingPlayerLastFrame = false; turretMode = (TurretMode)0; targetPlayerWithRotation = null; return false; } if ((Object)(object)targetPlayerWithRotation != (Object)null) { if (!_wasTargetingPlayerLastFrame) { _wasTargetingPlayerLastFrame = true; if ((int)turretMode == 0) { turretMode = (TurretMode)1; } } SetTargetToPlayerBody(); TurnTowardsTargetIfHasLOS(); } else if (_wasTargetingPlayerLastFrame) { _wasTargetingPlayerLastFrame = false; turretMode = (TurretMode)0; } return true; } private bool TurretModeLogic() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown TurretMode val = turretMode; switch ((int)val) { case 0: TurretModeDetectionLogic(); break; case 1: TurretModeChargingLogic(); break; case 2: TurretModeFiringLogic(); break; case 3: TurretModeBerserkLogic(); break; } return true; } private void TurretModeDetectionLogic() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if ((int)_turretModeLastFrame != 0) { _turretModeLastFrame = (TurretMode)0; _rotatingClockwise = false; mainAudio.Stop(); farAudio.Stop(); berserkAudio.Stop(); if (_fadeBulletAudioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_fadeBulletAudioCoroutine); } _fadeBulletAudioCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeBulletAudio()); bulletParticles.Stop(true, (ParticleSystemStopBehavior)1); rotationSpeed = DetectionRotationSpeed; _rotatingSmoothly = true; if ((Object)(object)turretAnimator != (Object)null) { turretAnimator.SetInteger("TurretMode", 0); } _turretInterval = Random.Range(0f, 0.15f); } if (!((NetworkBehaviour)this).IsServer) { return; } if (_switchRotationTimer >= 7f) { _switchRotationTimer = 0f; bool setRotateRight = !_rotatingRight; SwitchRotationClientRpc(setRotateRight); } else { _switchRotationTimer += Time.deltaTime; } if (_turretInterval >= 0.25f) { _turretInterval = 0f; PlayerControllerB val = CheckForPlayersInLineOfSight(-1f, -1, -1, angleRangeCheck: true); if ((Object)(object)val != (Object)null && !val.isPlayerDead) { targetPlayerWithRotation = val; SwitchTurretMode(1); SwitchTargetedPlayerClientRpc((int)val.playerClientId, setModeToCharging: true); } } else { _turretInterval += Time.deltaTime; } } private void TurretModeChargingLogic() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((int)_turretModeLastFrame != 1) { _turretModeLastFrame = (TurretMode)1; _rotatingClockwise = false; mainAudio.PlayOneShot(detectPlayerSFX); berserkAudio.Stop(); WalkieTalkie.TransmitOneShotAudio(mainAudio, detectPlayerSFX, 1f); rotationSpeed = ChargingRotationSpeed; _rotatingSmoothly = false; _lostLOSTimer = 0f; if ((Object)(object)turretAnimator != (Object)null) { turretAnimator.SetInteger("TurretMode", 1); } _chargingTimer = 0f; _playedChargingSFX = false; } if (IsMinigun && _chargingTimer > detectPlayerSFX.length && !_playedChargingSFX) { mainAudio.PlayOneShot(chargingSFX); WalkieTalkie.TransmitOneShotAudio(mainAudio, chargingSFX, 1f); _playedChargingSFX = true; } _chargingTimer += Time.deltaTime; if (!((NetworkBehaviour)this).IsServer) { return; } if (_turretInterval >= ChargingDuration) { _turretInterval = 0f; Plugin.Instance.LogInfoExtended("Charging timer is up, setting to firing mode."); if (!_hasLineOfSight) { Plugin.Instance.LogInfoExtended("hasLineOfSight is false"); targetPlayerWithRotation = null; RemoveTargetedPlayerClientRpc(); } else { SwitchTurretMode(2); SetToModeClientRpc(2); } } else { _turretInterval += Time.deltaTime; } } private void TurretModeFiringLogic() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) if ((int)_turretModeLastFrame != 2) { _turretModeLastFrame = (TurretMode)2; berserkAudio.Stop(); mainAudio.clip = firingSFX; mainAudio.Play(); farAudio.clip = firingFarSFX; farAudio.Play(); bulletParticles.Play(true); bulletCollisionAudio.Play(); if (_fadeBulletAudioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_fadeBulletAudioCoroutine); } bulletCollisionAudio.volume = 1f; rotationSpeed = FiringRotationSpeed; _rotatingSmoothly = false; _lostLOSTimer = 0f; if ((Object)(object)turretAnimator != (Object)null) { turretAnimator.SetInteger("TurretMode", 2); } } if (_turretInterval >= _damageRate) { PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript(); _turretInterval = 0f; if ((Object)(object)CheckForPlayersInLineOfSight(5f, 1) == (Object)(object)localPlayerScript) { if (localPlayerScript.health > _damage) { localPlayerScript.DamagePlayer(_damage, true, true, (CauseOfDeath)7, 2, false, default(Vector3)); } else { localPlayerScript.KillPlayer(aimPoint.forward * 40f, true, (CauseOfDeath)7, 2, default(Vector3), false); TurretHeadManager.SetDeadBodyTurretHead(localPlayerScript, IsMinigun); } } _shootRay = new Ray(aimPoint.position, aimPoint.forward); if (Physics.Raycast(_shootRay, ref _hit, 30f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { ((Component)bulletCollisionAudio).transform.position = ((Ray)(ref _shootRay)).GetPoint(((RaycastHit)(ref _hit)).distance - 0.5f); } } else { _turretInterval += Time.deltaTime; } } private void TurretModeBerserkLogic() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) if ((int)_turretModeLastFrame != 3) { _turretModeLastFrame = (TurretMode)3; if ((Object)(object)turretAnimator != (Object)null) { turretAnimator.SetInteger("TurretMode", 1); } _berserkTimer = 1.3f; berserkAudio.Play(); rotationSpeed = BerserkRotationSpeed; _enteringBerserkMode = true; _rotatingSmoothly = true; _lostLOSTimer = 0f; _wasTargetingPlayerLastFrame = false; targetPlayerWithRotation = null; } if (_enteringBerserkMode) { _berserkTimer -= Time.deltaTime; if (_berserkTimer <= 0f) { _enteringBerserkMode = false; _rotatingClockwise = true; _berserkTimer = BerserkDuration; if ((Object)(object)turretAnimator != (Object)null) { turretAnimator.SetInteger("TurretMode", 2); } mainAudio.clip = firingSFX; mainAudio.Play(); farAudio.clip = firingFarSFX; farAudio.Play(); bulletParticles.Play(true); bulletCollisionAudio.Play(); if (_fadeBulletAudioCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_fadeBulletAudioCoroutine); } bulletCollisionAudio.volume = 1f; } return; } if (_turretInterval >= _damageRate) { PlayerControllerB localPlayerScript = PlayerUtils.GetLocalPlayerScript(); _turretInterval = 0f; if ((Object)(object)CheckForPlayersInLineOfSight(5f, 1) == (Object)(object)localPlayerScript) { if (localPlayerScript.health > _damage) { localPlayerScript.DamagePlayer(_damage, true, true, (CauseOfDeath)7, 2, false, default(Vector3)); } else { localPlayerScript.KillPlayer(aimPoint.forward * 40f, true, (CauseOfDeath)7, 2, default(Vector3), false); TurretHeadManager.SetDeadBodyTurretHead(localPlayerScript, IsMinigun); } } _shootRay = new Ray(aimPoint.position, aimPoint.forward); if (Physics.Raycast(_shootRay, ref _hit, 30f, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { ((Component)bulletCollisionAudio).transform.position = ((Ray)(ref _shootRay)).GetPoint(((RaycastHit)(ref _hit)).distance - 0.5f); } } else { _turretInterval += Time.deltaTime; } if (((NetworkBehaviour)this).IsServer) { _berserkTimer -= Time.deltaTime; if (_berserkTimer <= 0f || !turretActive) { SwitchTurretMode(0); SetToModeClientRpc(0); } } } private bool RotateTurretRod() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if (_rotatingClockwise) { turnTowardsObjectCompass.localEulerAngles = new Vector3(25f, turretRod.localEulerAngles.y - Time.deltaTime * rotationSpeed, 0f); turretRod.localRotation = Quaternion.RotateTowards(turretRod.localRotation, turnTowardsObjectCompass.localRotation, rotationSpeed * Time.deltaTime); return false; } if (_rotatingSmoothly) { if (DetectionRotation) { turnTowardsObjectCompass.localEulerAngles = new Vector3(0f, Mathf.Clamp(targetRotation, 0f - rotationRange, rotationRange), 0f); } else { turnTowardsObjectCompass.localEulerAngles = Vector3.zero; } } turretRod.localRotation = Quaternion.RotateTowards(turretRod.localRotation, turnTowardsObjectCompass.localRotation, rotationSpeed * Time.deltaTime); return true; } private void SetTargetToPlayerBody() { if (targetPlayerWithRotation.isPlayerDead) { if (!_targetingDeadPlayer) { _targetingDeadPlayer = true; } if ((Object)(object)targetPlayerWithRotation.deadBody != (Object)null) { targetTransform = ((Component)targetPlayerWithRotation.deadBody.bodyParts[5]).transform; } } else { _targetingDeadPlayer = false; targetTransform = ((Component)targetPlayerWithRotation.gameplayCamera).transform; } } private void TurnTowardsTargetIfHasLOS() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00aa: 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) bool flag = true; if (_targetingDeadPlayer || Vector3.Angle(targetTransform.position - centerPoint.position, forwardFacingPos.forward) > rotationRange) { flag = false; } if (Physics.Linecast(aimPoint.position, targetTransform.position, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1)) { flag = false; } if (flag) { _hasLineOfSight = true; _lostLOSTimer = 0f; tempTransform.position = targetTransform.position; Transform obj = tempTransform; obj.position -= Vector3.up * 0.15f; turnTowardsObjectCompass.LookAt(tempTransform); return; } if (_hasLineOfSight) { _hasLineOfSight = false; _lostLOSTimer = 0f; } if (!((NetworkBehaviour)this).IsServer) { return; } _lostLOSTimer += Time.deltaTime; if (_lostLOSTimer >= LostLOSDuration) { _lostLOSTimer = 0f; Plugin.Instance.LogInfoExtended("LOS timer ended on server. checking for new player target."); PlayerControllerB val = CheckForPlayersInLineOfSight(); if ((Object)(object)val != (Object)null) { targetPlayerWithRotation = val; SwitchTargetedPlayerClientRpc((int)val.playerClientId); Plugin.Instance.LogInfoExtended("Got new player target."); } else { Plugin.Instance.LogInfoExtended("No new player to target; returning to detection mode."); targetPlayerWithRotation = null; RemoveTargetedPlayerClientRpc(); } } } public PlayerControllerB CheckForPlayersInLineOfSight(float range = -1f, int verticalRays = -1, int horizontalRays = -1, bool angleRangeCheck = false) { if (range == -1f) { range = LOSRange; } if (verticalRays == -1) { verticalRays = LOSVerticalRays; } if (horizontalRays == -1) { horizontalRays = LOSHorizontalRays; } return CheckForPlayersInLineOfSightVertical(range, verticalRays, horizontalRays, angleRangeCheck); } private PlayerControllerB CheckForPlayersInLineOfSightVertical(float range, int verticalRays, int horizontalRays, bool angleRangeCheck) { float num = LOSXRotationOffsetStart; if (verticalRays < 2) { num = 0f; } for (int i = 0; i < horizontalRays; i++) { PlayerControllerB val = CheckForPlayersInLineOfSightHorizontal(range, horizontalRays, angleRangeCheck, num); num += LOSXRotationOffsetAmountPerRay; if (val != null) { return val; } } return null; } private PlayerControllerB CheckForPlayersInLineOfSightHorizontal(float range, int horizontalRays, bool angleRangeCheck, float xRotationOffset) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Invalid comparison between Unknown and I4 //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_00da: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) float num = range; float num2 = 0f; if (horizontalRays > 1) { num = range / (float)(horizontalRays - 1); num2 = 0f - range / 2f; } for (int i = 0; i <= horizontalRays; i++) { Vector3 val = aimPoint.forward; val = Quaternion.Euler(xRotationOffset, num2 + num * (float)i, 0f) * val; _shootRay = new Ray(aimTurretCenterPoint.position, val); if (!Physics.Raycast(_shootRay, ref _hit, LOSDistance, 1051400, (QueryTriggerInteraction)1)) { continue; } if (((Component)((RaycastHit)(ref _hit)).transform).CompareTag("Player")) { PlayerControllerB component = ((Component)((RaycastHit)(ref _hit)).transform).GetComponent(); if (TurretHeadManager.IsPlayerTurretHead(component)) { return null; } if (component != null) { if (angleRangeCheck && Vector3.Angle(((Component)component).transform.position + Vector3.up * 1.75f - centerPoint.position, forwardFacingPos.forward) > rotationRange) { return null; } return component; } } else if (((int)turretMode == 2 || ((int)turretMode == 3 && !_enteringBerserkMode)) && ((Component)((RaycastHit)(ref _hit)).transform).tag.StartsWith("PlayerRagdoll")) { Rigidbody component2 = ((Component)((RaycastHit)(ref _hit)).transform).GetComponent(); if (component2 != null) { component2.AddForce(((Vector3)(ref val)).normalized * 42f, (ForceMode)1); } } } return null; } [ClientRpc] public void SwitchRotationClientRpc(bool setRotateRight) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2131181834u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setRotateRight, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2131181834u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SwitchRotationOnInterval(setRotateRight); } } } public void SwitchRotationOnInterval(bool setRotateRight) { if (_rotatingRight) { _rotatingRight = false; targetRotation = rotationRange; } else { _rotatingRight = true; targetRotation = 0f - rotationRange; } } [ClientRpc] public void SwitchTargetedPlayerClientRpc(int playerId, bool setModeToCharging = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1275597007u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref setModeToCharging, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1275597007u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; targetPlayerWithRotation = StartOfRound.Instance.allPlayerScripts[playerId]; if (setModeToCharging) { SwitchTurretMode(1); } } } [ClientRpc] public void RemoveTargetedPlayerClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(359925289u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 359925289u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; targetPlayerWithRotation = null; } } } [ClientRpc] public void SetToModeClientRpc(int mode) { //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) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2487639984u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, mode); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2487639984u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SwitchTurretMode(mode); } } } private void SwitchTurretMode(int mode) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) turretMode = (TurretMode)mode; } public void ToggleTurretEnabled(bool enabled) { ToggleTurretEnabledLocalClient(enabled); ToggleTurretServerRpc(enabled); } [ServerRpc(RequireOwnership = false)] public void ToggleTurretServerRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2347360583u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2347360583u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ToggleTurretClientRpc(enabled); } } } [ClientRpc] public void ToggleTurretClientRpc(bool enabled) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(730170572u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enabled, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 730170572u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ToggleTurretEnabledLocalClient(enabled); } } } private void ToggleTurretEnabledLocalClient(bool enabled) { if (turretActive != enabled) { turretActive = enabled; if ((Object)(object)turretAnimator != (Object)null) { turretAnimator.SetBool("turretActive", turretActive); } if (enabled) { mainAudio.PlayOneShot(turretActivate); WalkieTalkie.TransmitOneShotAudio(mainAudio, turretActivate, 1f); } else { mainAudio.PlayOneShot(turretDeactivate); WalkieTalkie.TransmitOneShotAudio(mainAudio, turretDeactivate, 1f); } } } [ServerRpc(RequireOwnership = false)] public void EnterBerserkModeServerRpc() { //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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1293417035u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1293417035u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (CanTargetPlayers) { EnterBerserkModeClientRpc(); } } } [ClientRpc] public void EnterBerserkModeClientRpc() { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1831148522u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1831148522u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SwitchTurretMode(3); } } } public void SetObjectCodeOnServer() { if (NetworkUtils.IsServer) { int objectCodeClientRpc = Random.Range(0, RoundManager.Instance.possibleCodesForBigDoors.Length); SetObjectCodeClientRpc(objectCodeClientRpc); } } [ClientRpc] public void SetObjectCodeClientRpc(int codeIndex) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(462986444u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, codeIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 462986444u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; FollowTerminalAccessibleObjectBehaviour componentInChildren = ((Component)this).gameObject.GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.InitializeValues(); componentInChildren.SetCodeTo(codeIndex); } } } [ClientRpc] public void SetCanTargetPlayersClientRpc(bool value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3208830624u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3208830624u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; CanTargetPlayers = value; } } } private bool IsOnEnemy() { return (Object)(object)((Component)((Component)this).transform.parent).GetComponent() != (Object)null; } private void OnDrawGizmosSelected() { DrawLineOfSightLines(); } private void DrawLineOfSightLines() { if (!((Object)(object)aimPoint == (Object)null) && !((Object)(object)aimTurretCenterPoint == (Object)null)) { DrawLineOfSightLinesVertical(); } } private void DrawLineOfSightLinesVertical() { float num = LOSXRotationOffsetStart; if (LOSVerticalRays < 2) { num = 0f; } for (int i = 0; i < LOSVerticalRays; i++) { DrawLineOfSightLinesHorizontal(num); num += LOSXRotationOffsetAmountPerRay; } } private void DrawLineOfSightLinesHorizontal(float xRotationOffset) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_006d: 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) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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) Gizmos.color = Color.red; Vector3 position = aimTurretCenterPoint.position; float num = LOSRange; float num2 = 0f; if (LOSHorizontalRays > 1) { num = LOSRange / (float)(LOSHorizontalRays - 1); num2 = 0f - LOSRange / 2f; } for (int i = 0; i < LOSHorizontalRays; i++) { Vector3 forward = aimPoint.forward; forward = Quaternion.Euler(xRotationOffset, num2 + num * (float)i, 0f) * forward; Ray val = new Ray(position, forward); Gizmos.DrawLine(position, position + ((Ray)(ref val)).direction * LOSDistance); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2131181834u, new RpcReceiveHandler(__rpc_handler_2131181834), "SwitchRotationClientRpc"); ((NetworkBehaviour)this).__registerRpc(1275597007u, new RpcReceiveHandler(__rpc_handler_1275597007), "SwitchTargetedPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(359925289u, new RpcReceiveHandler(__rpc_handler_359925289), "RemoveTargetedPlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(2487639984u, new RpcReceiveHandler(__rpc_handler_2487639984), "SetToModeClientRpc"); ((NetworkBehaviour)this).__registerRpc(2347360583u, new RpcReceiveHandler(__rpc_handler_2347360583), "ToggleTurretServerRpc"); ((NetworkBehaviour)this).__registerRpc(730170572u, new RpcReceiveHandler(__rpc_handler_730170572), "ToggleTurretClientRpc"); ((NetworkBehaviour)this).__registerRpc(1293417035u, new RpcReceiveHandler(__rpc_handler_1293417035), "EnterBerserkModeServerRpc"); ((NetworkBehaviour)this).__registerRpc(1831148522u, new RpcReceiveHandler(__rpc_handler_1831148522), "EnterBerserkModeClientRpc"); ((NetworkBehaviour)this).__registerRpc(462986444u, new RpcReceiveHandler(__rpc_handler_462986444), "SetObjectCodeClientRpc"); ((NetworkBehaviour)this).__registerRpc(3208830624u, new RpcReceiveHandler(__rpc_handler_3208830624), "SetCanTargetPlayersClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2131181834(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool setRotateRight = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setRotateRight, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).SwitchRotationClientRpc(setRotateRight); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1275597007(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool setModeToCharging = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref setModeToCharging, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).SwitchTargetedPlayerClientRpc(playerId, setModeToCharging); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_359925289(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; ((ToilHeadTurretBehaviour)(object)target).RemoveTargetedPlayerClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2487639984(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int toModeClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref toModeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).SetToModeClientRpc(toModeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2347360583(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).ToggleTurretServerRpc(enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_730170572(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enabled = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref enabled, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).ToggleTurretClientRpc(enabled); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1293417035(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; ((ToilHeadTurretBehaviour)(object)target).EnterBerserkModeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1831148522(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; ((ToilHeadTurretBehaviour)(object)target).EnterBerserkModeClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_462986444(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int objectCodeClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref objectCodeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).SetObjectCodeClientRpc(objectCodeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3208830624(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool canTargetPlayersClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref canTargetPlayersClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ToilHeadTurretBehaviour)(object)target).SetCanTargetPlayersClientRpc(canTargetPlayersClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ToilHeadTurretBehaviour"; } } public class TurretBehaviour : ToilHeadTurretBehaviour { protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "TurretBehaviour"; } } } namespace com.github.zehsteam.ToilHead.MonoBehaviours.TurretHeads { public class MantiToilControllerBehaviour : TurretHeadControllerBehaviour { protected override Transform GetHeadTransform() { return ((Component)this).transform.parent.Find("DoublewingModel").Find("BodyAnimContainer").GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .Find("Head") .GetChild(0); } protected override void OnFinishedSetup() { TurretBehaviour.UseMantiToilSettings = true; if (((NetworkBehaviour)this).IsServer) { EnemyAI enemyScript = GetEnemyScript(); TurretHeadManager.AddEnemyTurretHeadControllerPair(enemyScript, this); TurretHeadManager.AddToEnemySpawnCount(enemyScript, TurretBehaviour.IsMinigun); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "MantiToilControllerBehaviour"; } } public class ToiledDeadBodyControllerBehaviour : TurretHeadControllerBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass1_0 { public RagdollGrabbableObject ragdollGrabbableObject; internal bool b__0() { return (Object)(object)ragdollGrabbableObject.ragdoll != (Object)null; } } [CompilerGenerated] private sealed class d__1 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ToiledDeadBodyControllerBehaviour <>4__this; private <>c__DisplayClass1_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; ToiledDeadBodyControllerBehaviour toiledDeadBodyControllerBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass1_0(); <>8__1.ragdollGrabbableObject = ((Component)((Component)toiledDeadBodyControllerBehaviour).transform.parent).GetComponent(); <>2__current = Utils.WaitUntil(() => (Object)(object)<>8__1.ragdollGrabbableObject.ragdoll != (Object)null); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>8__1.ragdollGrabbableObject.ragdoll == (Object)null) { Plugin.logger.LogError((object)"Error: Failed to late setup player ragdoll Turret-Head turret. DeadBodyInfo is null."); return false; } <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; toiledDeadBodyControllerBehaviour.SetupTurret(); 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(); } } protected override void Start() { if (((NetworkBehaviour)this).IsServer) { base.Start(); } else { ((MonoBehaviour)this).StartCoroutine(LateSetupTurret()); } } [IteratorStateMachine(typeof(d__1))] private IEnumerator LateSetupTurret() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(0) { <>4__this = this }; } protected override Transform GetHeadTransform() { RagdollGrabbableObject component = ((Component)((Component)this).transform.parent).GetComponent(); if ((Object)(object)component == (Object)null) { Plugin.logger.LogError((object)"Error: Failed to setup player ragdoll Turret-Head turret. RagdollGrabbableObject is null."); return null; } if ((Object)(object)component.ragdoll == (Object)null) { Plugin.logger.LogError((object)"Error: Failed to setup player ragdoll Turret-Head turret. DeadBodyInfo is null."); return null; } return ((Component)component.ragdoll).transform.Find("spine.001").Find("spine.002").Find("spine.003") .Find("spine.004") .Find("SpringContainer") .Find("SpringMetarig") .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0); } protected override void OnFinishedSetup() { if (((NetworkBehaviour)this).IsServer) { if (!Plugin.ConfigManager.SpawnRealToiledPlayerRagdolls.Value) { TurretBehaviour.SetCanTargetPlayersClientRpc(value: false); } TurretHeadManager.AddDeadBodyTurretHeadControllerPair(GetDeadBodyPlayerScript(), this); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "ToiledDeadBodyControllerBehaviour"; } } public class ToilHeadControllerBehaviour : TurretHeadControllerBehaviour { protected override void LateStart() { base.LateStart(); if (FNaFEndoCoilheadProxy.HasMod || ThiccCoilHeadProxy.HasMod) { _parentToTransformBehaviour.SetTargetAndParentTransform(TurretBehaviour.SyncToHeadTransform, GetHeadTransform()); } } public override void SetupTurret() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_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_009b: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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) if (SCP173CoilheadSFXProxy.HasMod) { PositionOffset = new Vector3(0f, 4.35f, -0.075f); RotationOffset = Vector3.zero; } if (WeepingAngelsProxy.HasMod) { PositionOffset = new Vector3(0f, 3.6f, -0.65f); RotationOffset = Vector3.zero; } if (FNaFEndoCoilheadProxy.HasMod) { PositionOffset = new Vector3(-0.033f, 0.55f, 0.05f); RotationOffset = Vector3.zero; } if (ThiccCoilHeadProxy.HasMod) { PositionOffset = new Vector3(-0.02f, 1.2f, -0.075f); RotationOffset = Vector3.zero; } if (ARatherSillyCoilHeadProxy.HasMod) { PositionOffset = new Vector3(0f, 0.25f, -0.07f); } base.SetupTurret(); } protected override Transform GetHeadTransform() { if (SCP173CoilheadSFXProxy.HasMod || WeepingAngelsProxy.HasMod) { return ((Component)this).transform.parent.Find("SpringManModel"); } if (FNaFEndoCoilheadProxy.HasMod || ThiccCoilHeadProxy.HasMod) { return ((Component)this).transform.parent.Find("SpringManModel").Find("AnimContainer").Find("metarig") .GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .Find("springBone"); } return ((Component)this).transform.parent.Find("SpringManModel").Find("Head"); } protected override Transform GetPTTBContainerTransform() { return ((Component)this).transform.parent.Find("SpringManModel").Find("Head"); } protected override void OnFinishedSetup() { if (((NetworkBehaviour)this).IsServer) { EnemyAI enemyScript = GetEnemyScript(); TurretHeadManager.AddEnemyTurretHeadControllerPair(enemyScript, this); TurretHeadManager.AddToEnemySpawnCount(enemyScript, TurretBehaviour.IsMinigun); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "ToilHeadControllerBehaviour"; } } public class ToilMaskedControllerBehaviour : TurretHeadControllerBehaviour { protected override Transform GetHeadTransform() { return ((Component)this).transform.parent.Find("ScavengerModel").Find("metarig").GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .Find("spine.004"); } protected override void OnFinishedSetup() { if (((NetworkBehaviour)this).IsServer) { EnemyAI enemyScript = GetEnemyScript(); TurretHeadManager.AddEnemyTurretHeadControllerPair(enemyScript, this); TurretHeadManager.AddToEnemySpawnCount(enemyScript, TurretBehaviour.IsMinigun); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "ToilMaskedControllerBehaviour"; } } public class ToilPlayerControllerBehaviour : TurretHeadControllerBehaviour { protected override Transform GetHeadTransform() { return ((Component)this).transform.parent.Find("ScavengerModel").Find("metarig").GetChild(0) .GetChild(0) .GetChild(0) .GetChild(0) .Find("spine.004"); } protected override void OnFinishedSetup() { PlayerControllerB playerScript = GetPlayerScript(); if (PlayerUtils.IsLocalPlayer(playerScript)) { Utils.DisableRenderers(((Component)TurretBehaviour.SyncToHeadTransform).gameObject); } if (((NetworkBehaviour)this).IsServer) { TurretHeadManager.AddPlayerTurretHeadControllerPair(playerScript, this); TurretHeadManager.AddToPlayerSpawnCount(); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "ToilPlayerControllerBehaviour"; } } public class ToilSlayerControllerBehaviour : ToilHeadControllerBehaviour { [Header("Toil-Slayer Properties")] [Space(5f)] public Material SpringManMaterial; protected override void Start() { base.Start(); SetMaterials(); } private void SetMaterials() { Transform val = ((Component)this).transform.parent.Find("SpringManModel"); Renderer component = ((Component)val.Find("Head")).GetComponent(); Renderer component2 = ((Component)val.Find("Body")).GetComponent(); component.materials = (Material[])(object)new Material[1] { SpringManMaterial }; Material[] materials = component2.materials; materials[1] = SpringManMaterial; component2.materials = materials; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "ToilSlayerControllerBehaviour"; } } public class TurretHeadControllerBehaviour : NetworkBehaviour { [CompilerGenerated] private sealed class d__9 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TurretHeadControllerBehaviour <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; TurretHeadControllerBehaviour turretHeadControllerBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; turretHeadControllerBehaviour.LateStart(); 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(); } } [Header("Enemy Properties")] [Space(5f)] public string EnemyName = string.Empty; public bool HasScanNode = true; public string ScanNodeHeaderText = string.Empty; [Header("Turret Properties")] [Space(5f)] public TurretBehaviour TurretBehaviour; public Vector3 PositionOffset = Vector3.zero; public Vector3 RotationOffset = Vector3.zero; public Vector3 LocalScale = Vector3.one; protected ParentToTransformBehaviour _parentToTransformBehaviour; protected virtual void Start() { if (!((NetworkBehaviour)this).IsServer) { SetupTurret(); } ((MonoBehaviour)this).StartCoroutine(LateStartCO()); } [IteratorStateMachine(typeof(d__9))] protected IEnumerator LateStartCO() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this }; } protected virtual void LateStart() { SetPTTBOffsetValues(); } public virtual void SetupTurret() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); if (HasScanNode) { ScanNodeProperties componentInChildren = ((Component)((Component)this).transform.parent).GetComponentInChildren(); componentInChildren.headerText = ScanNodeHeaderText; } TurretBehaviour = ((Component)this).GetComponentInChildren(); Transform transform = ((Component)TurretBehaviour).transform; transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); transform.localScale = LocalScale; Transform headTransform = GetHeadTransform(); Transform val = GetPTTBContainerTransform(); if ((Object)(object)val == (Object)null) { val = headTransform; } _parentToTransformBehaviour = ((Component)val).gameObject.AddComponent(); _parentToTransformBehaviour.SetTargetAndParentTransform(TurretBehaviour.SyncToHeadTransform, headTransform); SetPTTBOffsetValues(); Plugin.Instance.LogInfoExtended("Setup " + EnemyName); OnFinishedSetup(); } protected virtual Transform GetHeadTransform() { return null; } protected virtual Transform GetPTTBContainerTransform() { return null; } protected virtual void SetPTTBOffsetValues() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = ((Component)this).transform.parent.localScale; Vector3 positionOffset = PositionOffset; positionOffset.x *= localScale.x; positionOffset.y *= localScale.y; positionOffset.z *= localScale.z; _parentToTransformBehaviour.SetPositionAndRotationOffset(positionOffset, RotationOffset); } protected virtual void OnFinishedSetup() { } protected EnemyAI GetEnemyScript() { return ((Component)((Component)this).transform.parent).GetComponent(); } protected PlayerControllerB GetPlayerScript() { return ((Component)((Component)this).transform.parent).GetComponent(); } protected PlayerControllerB GetDeadBodyPlayerScript() { RagdollGrabbableObject val = default(RagdollGrabbableObject); if (!((Component)((Component)this).transform.parent).TryGetComponent(ref val)) { return null; } return val.ragdoll.playerScript; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "TurretHeadControllerBehaviour"; } } } namespace com.github.zehsteam.ToilHead.Compatibility { internal static class ARatherSillyCoilHeadProxy { public const string ModGUID = "COREsEND.A_Rather_Silly_Coil_Head"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("COREsEND.A_Rather_Silly_Coil_Head"); } internal static class FNaFEndoCoilheadProxy { public const string ModGUID = "FNaFEndoCoilhead"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("FNaFEndoCoilhead"); } internal static class LethalLibProxy { public const string ModGUID = "evaisa.lethallib"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("evaisa.lethallib"); } internal static class MonsterPlushiesProxy { public const string ModGUID = "scin.monsterplushies"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("scin.monsterplushies"); } internal static class SCP173CoilheadSFXProxy { public const string ModGUID = "raydenoir.SCP_173"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("raydenoir.SCP_173"); } internal static class ThiccCoilHeadProxy { public const string ModGUID = "ThiccCoilHead"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("ThiccCoilHead"); } internal static class WeepingAngelsProxy { public const string ModGUID = "raydenoir.WeepingAngel"; public static bool HasMod => Chainloader.PluginInfos.ContainsKey("raydenoir.WeepingAngel"); } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace com.github.zehsteam.ToilHead.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }