Decompiled source of EnhancedEnemies v1.1.3
EnhancedEnemies/EnhancedEnemies.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EnhancedEnemies.Patches; using FMOD.Studio; using HarmonyLib; using Microsoft.CodeAnalysis; using Receiver2; using UnityEngine; using VLB; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("EnhancedEnemies")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("The Threat has dreamt up some adjustments to our adversaries...")] [assembly: AssemblyFileVersion("1.1.3.0")] [assembly: AssemblyInformationalVersion("1.1.3+22615a29d72742f8fe8ff950107968655ffb8dbb")] [assembly: AssemblyProduct("EnhancedEnemies")] [assembly: AssemblyTitle("EnhancedEnemies")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 EnhancedEnemies { [BepInPlugin("EnhancedEnemies", "EnhancedEnemies", "1.1.3")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private static Harmony _harmony; private void Awake() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0052: Expected O, but got Unknown //IL_0067: 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: Expected O, but got Unknown //IL_0082: Expected O, but got Unknown //IL_0097: 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_00c4: Expected O, but got Unknown //IL_00c4: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_00ff: Expected O, but got Unknown //IL_0114: 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_013a: Expected O, but got Unknown //IL_013a: Expected O, but got Unknown //IL_014f: 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_017c: Expected O, but got Unknown //IL_017c: Expected O, but got Unknown //IL_0191: 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_01be: Expected O, but got Unknown //IL_01be: Expected O, but got Unknown //IL_01d3: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0201: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0244: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_0274: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02af: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_02f1: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Expected O, but got Unknown //IL_0333: Expected O, but got Unknown //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Expected O, but got Unknown //IL_0375: Expected O, but got Unknown //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Expected O, but got Unknown //IL_03b7: Expected O, but got Unknown //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Expected O, but got Unknown //IL_03e7: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0429: Expected O, but got Unknown //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_046c: Expected O, but got Unknown //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_04af: Expected O, but got Unknown //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Expected O, but got Unknown //IL_04df: Expected O, but got Unknown //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Expected O, but got Unknown //IL_0521: Expected O, but got Unknown //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Expected O, but got Unknown //IL_0563: Expected O, but got Unknown //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Expected O, but got Unknown //IL_05a5: Expected O, but got Unknown //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Expected O, but got Unknown //IL_05d5: Expected O, but got Unknown //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Expected O, but got Unknown //IL_0617: Expected O, but got Unknown //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Expected O, but got Unknown //IL_0659: Expected O, but got Unknown //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Expected O, but got Unknown //IL_069c: Expected O, but got Unknown //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Expected O, but got Unknown //IL_06cc: Expected O, but got Unknown //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Expected O, but got Unknown //IL_070e: Expected O, but got Unknown //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_0750: Expected O, but got Unknown //IL_0750: Expected O, but got Unknown //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Expected O, but got Unknown //IL_0792: Expected O, but got Unknown //IL_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Expected O, but got Unknown //IL_07d4: Expected O, but got Unknown //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Expected O, but got Unknown //IL_0816: Expected O, but got Unknown //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Expected O, but got Unknown //IL_0859: Expected O, but got Unknown //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0889: Expected O, but got Unknown //IL_0889: Expected O, but got Unknown //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08cb: Expected O, but got Unknown //IL_08cb: Expected O, but got Unknown //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_090d: Expected O, but got Unknown //IL_090d: Expected O, but got Unknown //IL_0922: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_093d: Expected O, but got Unknown //IL_093d: Expected O, but got Unknown //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Expected O, but got Unknown //IL_097f: Expected O, but got Unknown //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_09c1: Expected O, but got Unknown //IL_09c1: Expected O, but got Unknown //IL_09d6: Unknown result type (might be due to invalid IL or missing references) //IL_09f9: Unknown result type (might be due to invalid IL or missing references) //IL_0a03: Expected O, but got Unknown //IL_0a03: Expected O, but got Unknown //IL_0a18: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Expected O, but got Unknown //IL_0a33: Expected O, but got Unknown //IL_0a48: Unknown result type (might be due to invalid IL or missing references) //IL_0a6b: Unknown result type (might be due to invalid IL or missing references) //IL_0a75: Expected O, but got Unknown //IL_0a75: Expected O, but got Unknown //IL_0a8a: Unknown result type (might be due to invalid IL or missing references) //IL_0aad: Unknown result type (might be due to invalid IL or missing references) //IL_0ab7: Expected O, but got Unknown //IL_0ab7: Expected O, but got Unknown //IL_0acc: Unknown result type (might be due to invalid IL or missing references) //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0af0: Unknown result type (might be due to invalid IL or missing references) //IL_0afa: Expected O, but got Unknown //IL_0afa: Expected O, but got Unknown //IL_0b0f: Unknown result type (might be due to invalid IL or missing references) //IL_0b20: Unknown result type (might be due to invalid IL or missing references) //IL_0b2a: Expected O, but got Unknown //IL_0b2a: Expected O, but got Unknown //IL_0b3f: Unknown result type (might be due to invalid IL or missing references) //IL_0b50: Unknown result type (might be due to invalid IL or missing references) //IL_0b5a: Expected O, but got Unknown //IL_0b5a: Expected O, but got Unknown //IL_0b6f: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Unknown result type (might be due to invalid IL or missing references) //IL_0b8a: Expected O, but got Unknown //IL_0b8a: Expected O, but got Unknown //IL_0b94: Unknown result type (might be due to invalid IL or missing references) //IL_0b9e: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin EnhancedEnemies is loaded!"); TurretMain.weight = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Turrets", "Regular turret chance weight"), 33, new ConfigDescription("Determines the chance of a turret being a regular turret (not shotgun or lancer), in proportion to this weight divided by the total weight. 20 regular weight with 200 total weight means 10% regular chance", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); ShotgunTurrets.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Shotgun Turrets", "Enabled"), true, new ConfigDescription("Enables spawning of turrets that shoot multiple shotgun pellets instead of singular bullets", (AcceptableValueBase)null, Array.Empty<object>())); ShotgunTurrets.spread = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Shotgun Turrets", "Pellet spread"), 15f, new ConfigDescription("Angle, in degrees, of pellet spread cone of shotgun turrets", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 180f), Array.Empty<object>())); ShotgunTurrets.pellets = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Shotgun Turrets", "Pellet count"), 9, new ConfigDescription("Number of pellets per shot of shotgun turrets", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>())); ShotgunTurrets.weight = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Shotgun Turrets", "Chance Weight"), 33, new ConfigDescription("Determines the chance of a turret being a shotgun turret, in proportion to this weight divided by the total weight. 20 shotgun weight with 200 total weight means 10% shotgun chance", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); ShotgunTurrets.fireInterval = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Shotgun Turrets", "Fire interval"), 0.4f, new ConfigDescription("The interval, in seconds, between shots for shotgun turrets. Vanilla value is 0.1", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 10f), Array.Empty<object>())); ShotgunTurrets.alertDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Shotgun Turrets", "Reaction time"), 0.9f, new ConfigDescription("Delay, in seconds, for the first shot after being spotting for shotgun turrets. Vanilla value is 0.6", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); ShotgunTurrets.lightColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Shotgun Turrets", "Camera light color"), new Color(1f, 0f, 0f), new ConfigDescription("Determines the color of the camera lights of shotgun turrets. Vanilla color is 0000FFFF", (AcceptableValueBase)null, Array.Empty<object>())); ShotgunTurrets.componentColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Shotgun Turrets", "Component color"), new Color(1f, 0.4f, 0.4f), new ConfigDescription("Determines the color of some componenets of lancer turrets. For vanilla color use FFFFFFFF", (AcceptableValueBase)null, Array.Empty<object>())); LancerTurrets.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Lancer Turrets", "Enabled"), true, new ConfigDescription("Enables spawning of turrets that penetrate all barriers and will sweep through cover (with bullets) after losing the player", (AcceptableValueBase)null, Array.Empty<object>())); LancerTurrets.weight = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Lancer Turrets", "Chance weight"), 33, new ConfigDescription("Determines the chance of a turret being a lancer turret, in proportion to this weight divided by the total weight. 20 lancer weight with 200 total weight means 10% lancer chance", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); LancerTurrets.fireInterval = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lancer Turrets", "Fire interval"), 0.3f, new ConfigDescription("The interval, in seconds, between shots for lancer turrets. Vanilla value is 0.1", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.001f, 10f), Array.Empty<object>())); LancerTurrets.alertDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lancer Turrets", "Reaction time"), 0.9f, new ConfigDescription("Delay, in seconds, for the first shot after being spotting for lancer turrets. Vanilla value is 0.6", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); LancerTurrets.sweepDuration = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lancer Turrets", "Sweep duration"), 3f, new ConfigDescription("Duration, in seconds, lancer turrets will continue to fire after losing the player before returning to idle state. Vanilla value is 0.667. Lancer turrets will attempt sweep through cover instead of shooting at the same spot", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); LancerTurrets.sweepSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lancer Turrets", "Sweep speed"), 2f, new ConfigDescription("The speed, in Unity units, that lancer turrets will sweep through cover after losing the player. The product of this value and fire interval is proportional to the distance between sweeping shots. For reference, the player walks at a speed of 3, and runs at a speed of 6", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); LancerTurrets.fireViaSecurityCameraEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Lancer Turrets", "Enable fire via security cameras"), true, new ConfigDescription("Enables lancer turrets to shoot if alerted by security cameras even if the turret does not have line of sight", (AcceptableValueBase)null, Array.Empty<object>())); LancerTurrets.groupSizeViaSecurityCamera = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lancer Turrets", "Fire via security cameras group size"), 1.5f, new ConfigDescription("The radius, in Unity units, of the bullet grouping of lancer turrets when firing through a security camera without its own line of sight. \"Enable fire via security cameras\" must be enabled to work", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); LancerTurrets.lightColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Lancer Turrets", "Camera light color"), new Color(0f, 1f, 0f), new ConfigDescription("Determines the color of the camera lights of lancer turrets. Vanilla color is 0000FFFF", (AcceptableValueBase)null, Array.Empty<object>())); LancerTurrets.componentColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Lancer Turrets", "Component color"), new Color(0f, 0.4f, 0f), new ConfigDescription("Determines the color of some componenets of lancer turrets. For vanilla color use FFFFFFFF", (AcceptableValueBase)null, Array.Empty<object>())); SleepyTurrets.overrideLevelStartAsleepChance = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Turret Sleep Control", "Override level start asleep chance"), false, new ConfigDescription("Enable override of levels' start asleep chance, using \"Start asleep chance\" instead", (AcceptableValueBase)null, Array.Empty<object>())); SleepyTurrets.startAsleepChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Turret Sleep Control", "Start asleep chance"), 0.25f, new ConfigDescription("Determines the proportion of turrets that start asleep. \"Override level start asleep chance\" must be enabled to work. 0 means no turrets start asleep, 1 mean all. Vanilla values range 0 - 0.3", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepyTurrets.wakeupDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Turret Sleep Control", "Wakeup delay"), 0.5f, new ConfigDescription("Time, in seconds, it takes before turrets can react after waking from sleep. Vanilla value is 1.5", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); SleepyTurrets.firstWakeupExtraDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Turret Sleep Control", "First wakeup extra delay"), 1f, new ConfigDescription("Additional time, in seconds, it takes before turrets can react after waking from sleep for the first time. Vanilla value is 0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); SleepyTurrets.enabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Sleepy Turrets", "Enabled"), true, new ConfigDescription("Enables turrets that start asleep to go back to sleep", (AcceptableValueBase)null, Array.Empty<object>())); SleepyTurrets.sleepTimeout = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleepy Turrets", "Sleep timeout"), 10f, new ConfigDescription("Time, in seconds, it takes for sleepy turrets to sleep after not spotting the player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 60f), Array.Empty<object>())); SleepyTurrets.sleepyChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleepy Turrets", "Sleepy chance"), 0.5f, new ConfigDescription("Determines the proportion of turrets which start asleep that can go back to sleep. 0 mean no sleepy turrets, 1 mean all sleepy turrets", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepyTurrets.componentColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Sleepy Turrets", "Component color"), new Color(0.2f, 0.2f, 0.2f), new ConfigDescription("Determines the color of the camera and sensor of sleepy turrets. For vanilla color use FFFFFFFF", (AcceptableValueBase)null, Array.Empty<object>())); SleepyDrones.startAsleepEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Sleeping Drones", "Enabled"), true, new ConfigDescription("Enables drones to start asleep", (AcceptableValueBase)null, Array.Empty<object>())); SleepyDrones.startAsleepChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Drones", "Start asleep chance"), 0.25f, new ConfigDescription("Determines the proportion of drones that start asleep. 0 means no drones start asleep, 1 mean all. Vanilla values for turrets range 0 - 0.3", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepyDrones.wakeupDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Drones", "Wakeup delay"), 0.5f, new ConfigDescription("Time, in seconds, it takes before drones can react after waking from sleep. Vanilla value for turrets is 1.5", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); SleepyDrones.firstWakeupExtraDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Drones", "First wakeup extra delay"), 1f, new ConfigDescription("Additional time, in seconds, it takes before drones can react after waking from sleep for the first time. Vanilla value for turrets is 0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); SleepyDrones.groundedChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Drones", "Grounded sleep chance"), 0.5f, new ConfigDescription("Determines the proportions of sleeping drones that will attempt to land and turn off its rotors. 0 means all sleeping drones will still fly, 1 mean all will attempt to land", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepyDrones.sleepVolumeMod = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Drones", "Rotor sleep volume multiplier"), 0.5f, new ConfigDescription("The volume of the rotors of non-grounded sleeping drone are multiplied by this factor. 0.5 means half as loud, 2 means twice as loud", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); SleepyDrones.componentColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Sleepy Drones", "Component color"), new Color(0.2f, 0.2f, 0.2f), new ConfigDescription("Determines the color of the camera and sensor of sleepy drones. For vanilla color use FFFFFFFF", (AcceptableValueBase)null, Array.Empty<object>())); SleepyDrones.sleepyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Sleepy Drones", "Enabled"), true, new ConfigDescription("Enables drones to that start asleep to go back to sleep. \"Sleeping Drones\" must be enabled to work", (AcceptableValueBase)null, Array.Empty<object>())); SleepyDrones.sleepTimeout = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleepy Drones", "Sleep timeout"), 10f, new ConfigDescription("Time, in seconds, it takes for sleepy drones to sleep after not spotting the player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 60f), Array.Empty<object>())); SleepyDrones.sleepyChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleepy Drones", "Sleepy chance"), 0.5f, new ConfigDescription("Determines the proportion of drones which start asleep that can go back to sleep. 0 mean no sleepy drones, 1 mean all sleepy drones", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepySecurityCameras.startAsleepEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Sleeping Security Cameras", "Enabled"), true, new ConfigDescription("Enables security cameras to start asleep", (AcceptableValueBase)null, Array.Empty<object>())); SleepySecurityCameras.startAsleepChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Security Cameras", "Start asleep chance"), 0.25f, new ConfigDescription("Determines the proportion of security cameras that start asleep. 0 means no security cameras start asleep, 1 mean all. Vanilla values for turrets range 0 - 0.3", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepySecurityCameras.wakeupDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Security Cameras", "Wakeup delay"), 0.5f, new ConfigDescription("Time, in seconds, it takes before security cameras can react after waking from sleep. Vanilla value for turrets is 1.5", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); SleepySecurityCameras.firstWakeupExtraDelay = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleeping Security Cameras", "First wakeup extra delay"), 1f, new ConfigDescription("Additional time, in seconds, it takes before security cameras can react after waking from sleep for the first time. Vanilla value for turrets is 0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); SleepySecurityCameras.sleepyEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Sleepy Security Cameras", "Enabled"), true, new ConfigDescription("Enables security cameras to that start asleep to go back to sleep. \"Sleeping Security Cameras\" must be enabled to work", (AcceptableValueBase)null, Array.Empty<object>())); SleepySecurityCameras.sleepTimeout = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleepy Security Cameras", "Sleep timeout"), 10f, new ConfigDescription("Time, in seconds, it takes for sleepy security cameras to sleep after not spotting the player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 60f), Array.Empty<object>())); SleepySecurityCameras.sleepyChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sleepy Security Cameras", "Sleepy chance"), 0.5f, new ConfigDescription("Determines the proportion of security cameras which start asleep that can go back to sleep. 0 mean no sleepy security cameras, 1 mean all sleepy security cameras", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SleepySecurityCameras.componentColor = ((BaseUnityPlugin)this).Config.Bind<Color>(new ConfigDefinition("Sleepy Security Cameras", "Component color"), new Color(0.2f, 0.2f, 0.2f), new ConfigDescription("Determines the color of sleepy security cameras. For vanilla color use FFFFFFFF", (AcceptableValueBase)null, Array.Empty<object>())); SecurityCameraLinkedEnemies.turretsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Security Camera Link", "Turrets enabled"), true, new ConfigDescription("Enables turrets to activate through security cameras even if its camera is destroyed", (AcceptableValueBase)null, Array.Empty<object>())); SecurityCameraLinkedEnemies.dronesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Security Camera Link", "Drones enabled"), true, new ConfigDescription("Enables drones to activate through security cameras even if its camera is destroyed", (AcceptableValueBase)null, Array.Empty<object>())); SecurityCameraLinkedEnemies.camerasEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Security Camera Link", "Cameras enabled"), true, new ConfigDescription("Enables security cameras to activate through other security cameras (they still need their own camera though)", (AcceptableValueBase)null, Array.Empty<object>())); _harmony = new Harmony("EnhancedEnemies"); _harmony.PatchAll(typeof(TurretMain)); _harmony.PatchAll(typeof(ShotgunTurrets)); _harmony.PatchAll(typeof(LancerTurrets)); _harmony.PatchAll(typeof(LancerTurrets_BypassPenCheck)); _harmony.PatchAll(typeof(LancerTurrets_SetAmmo)); _harmony.PatchAll(typeof(LancerTurrets_LeadAfterVisionLoss)); _harmony.PatchAll(typeof(SleepyTurrets)); _harmony.PatchAll(typeof(SleepyDrones)); _harmony.PatchAll(typeof(SleepySecurityCameras)); _harmony.PatchAll(typeof(SecurityCameraLinkedEnemies)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "EnhancedEnemies"; public const string PLUGIN_NAME = "EnhancedEnemies"; public const string PLUGIN_VERSION = "1.1.3"; } } namespace EnhancedEnemies.Patches { [HarmonyPatch] public static class TurretMain { internal static ConfigEntry<int> weight; internal static string[] coloredComponents = new string[6] { "point_pivot/gun_pivot/gun_assembly/ammo_box", "point_pivot/gun_pivot/gun_assembly/ammo_destroy/ammo_box_ammo_box_shard", "point_pivot/gun_pivot/gun_assembly/ammo_destroy/ammo_box_ammo_box_shard_001", "base_physics/cutout/base_cutout_viz", "base_physics/standard/base_viz", "armor_base/armor_base_viz" }; [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "Start")] private static void TurretSetup(TurretScript __instance) { int num = (ShotgunTurrets.enabled.Value ? ShotgunTurrets.weight.Value : 0); int num2 = (LancerTurrets.enabled.Value ? LancerTurrets.weight.Value : 0); int num3 = (int)(Random(TurretSeed(__instance), "Turret Main") * (double)(weight.Value + num + num2)); if (num3 < num) { ShotgunTurrets.TurretSetup(__instance); } else if ((num3 -= num) < num2) { LancerTurrets.TurretSetup(__instance); } } public static int TurretSeed(TurretScript turret) { int result; if (((RobotScript)turret).kds.identifier == "") { result = Random.Range(int.MinValue, int.MaxValue); ((RobotScript)turret).kds.identifier = result.ToString(); return result; } if (!int.TryParse(((RobotScript)turret).kds.identifier, out result)) { result = Random.Range(int.MinValue, int.MaxValue); } return result; } public static double Random(int seed, string name) { return (double)(seed + name.GetHashCode()) / 4294967296.0 + 0.5; } internal static void VanillaExecuteTrajectory(BulletTrajectory trajectory) { ReceiverEvents.TriggerEvent((ReceiverEventTypeBulletTrajectory)0, trajectory); BulletTrajectoryManager.active_trajectories.Add(trajectory); } [HarmonyPatch(typeof(TurretScript), "UpdateLight")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //IL_001f: 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_0054: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Expected O, but got Unknown Label label = il.DefineLabel(); Label label2 = il.DefineLabel(); Label label3 = il.DefineLabel(); Label label4 = il.DefineLabel(); return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", (Type[])null, (Type[])null), (string)null) }).SetAndAdvance(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", new Type[1] { typeof(Color) }, (Type[])null)).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[18] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(TurretScript), "gun_pivot_camera_light")), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(ShotgunTurrets), "shotgunSet")), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(HashSet<TurretScript>), "Contains", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label2), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(ShotgunTurrets), "lightColor")), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(ConfigEntry<Color>), "get_Value", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Br_S, (object)label), CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "lancerSet")), new Label[1] { label2 }), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(HashSet<TurretScript>), "Contains", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label3), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "lightColor")), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(ConfigEntry<Color>), "get_Value", (Type[])null, (Type[])null)), CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Light), "set_color", new Type[1] { typeof(Color) }, (Type[])null)), new Label[1] { label }), new CodeInstruction(OpCodes.Br_S, (object)label4), CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Pop, (object)null), new Label[1] { label3 }) }) .AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label4)) .Instructions(); } } [HarmonyPatch] public static class ShotgunTurrets { internal static HashSet<TurretScript> shotgunSet = new HashSet<TurretScript>(); internal static FieldInfo mpb_info = AccessTools.Field(typeof(TurretScript), "mpb"); internal static FieldInfo color_id_info = AccessTools.Field(typeof(TurretScript), "color_id"); internal static FieldRef<TurretScript, MeshRenderer> flare_renderer_access = AccessTools.FieldRefAccess<TurretScript, MeshRenderer>("flare_renderer"); internal static FieldRef<TurretScript, VolumetricLightBeam> beam_access = AccessTools.FieldRefAccess<TurretScript, VolumetricLightBeam>("beam"); internal static FieldRef<TurretScript, Light> gun_pivot_camera_light_point_access = AccessTools.FieldRefAccess<TurretScript, Light>("gun_pivot_camera_light_point"); internal static ConfigEntry<bool> enabled; internal static ConfigEntry<float> spread; internal static ConfigEntry<int> pellets; internal static ConfigEntry<float> fireInterval; internal static ConfigEntry<float> alertDelay; internal static ConfigEntry<int> weight; internal static ConfigEntry<Color> lightColor; internal static ConfigEntry<Color> componentColor; internal static CartridgeSpec _00Pellet = Init00Pellet(); private static CartridgeSpec Init00Pellet() { //IL_0003: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) CartridgeSpec val = default(CartridgeSpec); val.gravity = true; val.extra_mass = 1.63f; val.mass = 3.54f; val.speed = 396f; val.diameter = 0.00838f; val.density = 11340f; CartridgeSpec val2 = val; float num = val2.diameter * 0.5f; float num2 = val2.mass / 1000f / val2.density; val2.cylinder_length = num2 / ((float)Math.PI * num * num); return val2; } internal static void TurretSetup(TurretScript __instance) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) shotgunSet.Add(__instance); if (shotgunSet.Count >= 50) { Plugin.Logger.LogWarning((object)$"shotgun turret register abnormally large ({shotgunSet.Count}); you have an unusual number of turrets or they are not being deregistered"); } __instance.fire_interval = fireInterval.Value; __instance.blind_fire_interval = fireInterval.Value; string[] coloredComponents = TurretMain.coloredComponents; foreach (string text in coloredComponents) { ((Renderer)((Component)((Component)__instance).transform.Find(text)).GetComponent<MeshRenderer>()).material.color = componentColor.Value; } } [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "OnDestroy")] private static void Deregister(TurretScript __instance) { shotgunSet.Remove(__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(TurretScript), "UpdateCameraAlive")] private static void AlertDelayPre(ref AIState ___ai_state, out AIState __state) { __state = ___ai_state; } [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "UpdateCameraAlive")] private static void AlertDelayPost(TurretScript __instance, ref float ___alert_delay, AIState __state) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (shotgunSet.Contains(__instance) && ((RobotScript)__instance).CanSeePlayer() && (int)__state == 0) { ___alert_delay *= alertDelay.Value / 0.6f; } } [HarmonyPrefix] [HarmonyPatch(typeof(BulletTrajectoryManager), "ExecuteTrajectory")] private static bool TurretShotgunShot(BulletTrajectory trajectory) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: 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_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_0075: 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_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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) if (shotgunSet.Contains(trajectory.bullet_source.GetComponent<TurretScript>())) { Vector3 start_pos = trajectory.movement_events[0].start_pos; Vector3 val = trajectory.movement_events[0].end_pos - start_pos; for (int i = 0; i < pellets.Value; i++) { Quaternion val2 = Quaternion.Lerp(Quaternion.identity, Random.rotationUniform, spread.Value / 2f / 180f); BulletTrajectory val3 = BulletTrajectoryManager.PlanTrajectory(start_pos, _00Pellet, val2 * val, true); val3.draw_path = trajectory.draw_path; val3.bullet_source = trajectory.bullet_source; val3.bullet_source_entity_type = trajectory.bullet_source_entity_type; TurretMain.VanillaExecuteTrajectory(val3); } return false; } return true; } } [HarmonyPatch] public static class LancerTurrets { internal static HashSet<TurretScript> lancerSet = new HashSet<TurretScript>(); internal static ConfigEntry<bool> enabled; internal static ConfigEntry<int> weight; internal static ConfigEntry<float> fireInterval; internal static ConfigEntry<float> alertDelay; internal static ConfigEntry<float> sweepDuration; internal static ConfigEntry<float> sweepSpeed; internal static ConfigEntry<bool> fireViaSecurityCameraEnabled; internal static ConfigEntry<float> groupSizeViaSecurityCamera; internal static CartridgeSpec _50AP = Init50AP(); internal static ConfigEntry<Color> lightColor; internal static ConfigEntry<Color> componentColor; internal static FieldRef<TurretScript, StochasticVision> vision_access = AccessTools.FieldRefAccess<TurretScript, StochasticVision>("vision"); internal static FieldRef<StochasticVision, float> kConsecutiveBlockedPerSecond_access = AccessTools.FieldRefAccess<StochasticVision, float>("kConsecutiveBlockedPerSecond"); private static CartridgeSpec Init50AP() { //IL_0003: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) CartridgeSpec val = default(CartridgeSpec); val.gravity = true; val.extra_mass = 60f; val.mass = 42f; val.speed = 999f; val.diameter = 0.013f; val.density = 17010f; CartridgeSpec val2 = val; float num = val2.diameter * 0.5f; float num2 = val2.mass / 1000f / val2.density; val2.cylinder_length = num2 / ((float)Math.PI * num * num); return val2; } internal static void TurretSetup(TurretScript __instance) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) lancerSet.Add(__instance); if (lancerSet.Count >= 50) { Plugin.Logger.LogWarning((object)$"lancer turret register abnormally large ({lancerSet.Count}); you have an unusual number of turrets or they are not being deregistered"); } __instance.fire_interval = fireInterval.Value; __instance.blind_fire_interval = fireInterval.Value; kConsecutiveBlockedPerSecond_access.Invoke(vision_access.Invoke(__instance)) = 40f / sweepDuration.Value; string[] coloredComponents = TurretMain.coloredComponents; foreach (string text in coloredComponents) { ((Renderer)((Component)((Component)__instance).transform.Find(text)).GetComponent<MeshRenderer>()).material.color = componentColor.Value; } } [HarmonyPrefix] [HarmonyPatch(typeof(TurretScript), "UpdateCameraAlive")] private static void AlertDelayPre(ref AIState ___ai_state, out AIState __state) { __state = ___ai_state; } [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "UpdateCameraAlive")] private static void AlertDelayPost(TurretScript __instance, ref float ___alert_delay, AIState __state) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (lancerSet.Contains(__instance) && ((RobotScript)__instance).CanSeePlayer() && (int)__state == 0) { ___alert_delay *= alertDelay.Value / 0.6f; } } } [HarmonyPatch] public static class LancerTurrets_BypassPenCheck { [CompilerGenerated] private sealed class <Transpiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private ILGenerator il; public ILGenerator <>3__il; private Label <bypassStuckInside>5__1; private Label <bypassStop>5__2; private Label <bypassRicochet>5__3; private Label <bypassRedirect>5__4; private List<CodeInstruction> <codes>5__5; private int <i>5__6; private Label <endIf>5__7; private int <j>5__8; private Label <endIf>5__9; private int <j>5__10; private Label <endIf>5__11; private int <j>5__12; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Transpiler>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <codes>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Expected O, but got Unknown //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Expected O, but got Unknown //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Expected O, but got Unknown //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Expected O, but got Unknown //IL_086a: Unknown result type (might be due to invalid IL or missing references) //IL_0874: Expected O, but got Unknown //IL_08c0: Unknown result type (might be due to invalid IL or missing references) //IL_08ca: Expected O, but got Unknown //IL_08ec: Unknown result type (might be due to invalid IL or missing references) //IL_08f6: Expected O, but got Unknown //IL_0ace: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Expected O, but got Unknown //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Expected O, but got Unknown //IL_0b2e: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Expected O, but got Unknown //IL_0b59: Unknown result type (might be due to invalid IL or missing references) //IL_0b63: Expected O, but got Unknown //IL_0baf: Unknown result type (might be due to invalid IL or missing references) //IL_0bb9: Expected O, but got Unknown //IL_0bdb: Unknown result type (might be due to invalid IL or missing references) //IL_0be5: Expected O, but got Unknown //IL_0bfd: Unknown result type (might be due to invalid IL or missing references) //IL_0c07: Expected O, but got Unknown //IL_0c29: Unknown result type (might be due to invalid IL or missing references) //IL_0c33: Expected O, but got Unknown //IL_0dc8: Unknown result type (might be due to invalid IL or missing references) //IL_0dd2: Expected O, but got Unknown //IL_0df3: Unknown result type (might be due to invalid IL or missing references) //IL_0dfd: Expected O, but got Unknown //IL_0e28: Unknown result type (might be due to invalid IL or missing references) //IL_0e32: Expected O, but got Unknown //IL_0e53: Unknown result type (might be due to invalid IL or missing references) //IL_0e5d: Expected O, but got Unknown //IL_0ea9: Unknown result type (might be due to invalid IL or missing references) //IL_0eb3: Expected O, but got Unknown //IL_0ed5: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Expected O, but got Unknown //IL_1101: Unknown result type (might be due to invalid IL or missing references) //IL_110b: Expected O, but got Unknown //IL_1136: Unknown result type (might be due to invalid IL or missing references) //IL_1140: Expected O, but got Unknown //IL_1161: Unknown result type (might be due to invalid IL or missing references) //IL_116b: Expected O, but got Unknown //IL_11b7: Unknown result type (might be due to invalid IL or missing references) //IL_11c1: Expected O, but got Unknown //IL_11e3: Unknown result type (might be due to invalid IL or missing references) //IL_11ed: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Expected O, but got Unknown //IL_07df: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Expected O, but got Unknown //IL_10d6: Unknown result type (might be due to invalid IL or missing references) //IL_10e0: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <bypassStuckInside>5__1 = il.DefineLabel(); <bypassStop>5__2 = il.DefineLabel(); <bypassRicochet>5__3 = il.DefineLabel(); <bypassRedirect>5__4 = il.DefineLabel(); <codes>5__5 = new List<CodeInstruction>(instructions); <i>5__6 = 0; goto IL_0504; case 1: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "_50AP")); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(object), "Equals", new Type[2] { typeof(object), typeof(object) }, (Type[])null)); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Brtrue_S, (object)<endIf>5__7); <>1__state = 6; return true; case 6: <>1__state = -1; <j>5__8 = 0; goto IL_0472; case 7: <>1__state = -1; <j>5__8++; goto IL_0472; case 8: <>1__state = -1; goto IL_0646; case 9: <>1__state = -1; <i>5__6++; goto IL_0504; case 10: <>1__state = -1; <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 11; return true; case 11: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Br_S, (object)<bypassStuckInside>5__1); <>1__state = 12; return true; case 12: <>1__state = -1; goto IL_073e; case 13: <>1__state = -1; <i>5__6++; goto IL_0646; case 14: <>1__state = -1; goto IL_09e8; case 15: <>1__state = -1; <i>5__6++; goto IL_073e; case 16: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 17; return true; case 17: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "_50AP")); <>1__state = 18; return true; case 18: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 19; return true; case 19: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(object), "Equals", new Type[2] { typeof(object), typeof(object) }, (Type[])null)); <>1__state = 20; return true; case 20: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Brtrue_S, (object)<endIf>5__9); <>1__state = 21; return true; case 21: <>1__state = -1; <j>5__10 = 0; goto IL_0953; case 22: <>1__state = -1; <j>5__10++; goto IL_0953; case 23: <>1__state = -1; goto IL_0cca; case 24: <>1__state = -1; <i>5__6++; goto IL_09e8; case 25: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldarg_1, (object)null); <>1__state = 26; return true; case 26: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 27; return true; case 27: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "_50AP")); <>1__state = 28; return true; case 28: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 29; return true; case 29: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(object), "Equals", new Type[2] { typeof(object), typeof(object) }, (Type[])null)); <>1__state = 30; return true; case 30: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Brfalse_S, (object)<endIf>5__11); <>1__state = 31; return true; case 31: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Pop, (object)null); <>1__state = 32; return true; case 32: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Br_S, (object)<bypassRicochet>5__3); <>1__state = 33; return true; case 33: <>1__state = -1; <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <endIf>5__11 }); <>1__state = 34; return true; case 34: <>1__state = -1; goto IL_0f5e; case 35: <>1__state = -1; <i>5__6++; goto IL_0cca; case 36: <>1__state = -1; <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 37; return true; case 37: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldarg_1, (object)null); <>1__state = 38; return true; case 38: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 39; return true; case 39: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "_50AP")); <>1__state = 40; return true; case 40: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 41; return true; case 41: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(object), "Equals", new Type[2] { typeof(object), typeof(object) }, (Type[])null)); <>1__state = 42; return true; case 42: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Brtrue_S, (object)<bypassStop>5__2); <>1__state = 43; return true; case 43: <>1__state = -1; <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 44; return true; case 44: <>1__state = -1; goto IL_1056; case 45: <>1__state = -1; <i>5__6++; goto IL_0f5e; case 46: <>1__state = -1; goto IL_12df; case 47: <>1__state = -1; <i>5__6++; goto IL_1056; case 48: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 49; return true; case 49: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "_50AP")); <>1__state = 50; return true; case 50: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Box, (object)typeof(CartridgeSpec)); <>1__state = 51; return true; case 51: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(object), "Equals", new Type[2] { typeof(object), typeof(object) }, (Type[])null)); <>1__state = 52; return true; case 52: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Brtrue_S, (object)<bypassRedirect>5__4); <>1__state = 53; return true; case 53: <>1__state = -1; <j>5__12 = 0; goto IL_124a; case 54: <>1__state = -1; <j>5__12++; goto IL_124a; case 55: <>1__state = -1; break; case 56: <>1__state = -1; <i>5__6++; goto IL_12df; case 57: { <>1__state = -1; <i>5__6++; break; } IL_124a: if (<j>5__12 < 8) { <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 54; return true; } <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <bypassRedirect>5__4 }); <>1__state = 55; return true; IL_09e8: if (<i>5__6 < <codes>5__5.Count) { <endIf>5__9 = il.DefineLabel(); if (<codes>5__5[<i>5__6 + 1].opcode == OpCodes.Ldfld && (FieldInfo)<codes>5__5[<i>5__6 + 1].operand == AccessTools.Field(typeof(BallisticProperties), "hollow")) { <>2__current = new CodeInstruction(OpCodes.Ldarg_1, (object)null); <>1__state = 16; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 24; return true; } goto IL_0cca; IL_0cca: if (<i>5__6 < <codes>5__5.Count) { <endIf>5__11 = il.DefineLabel(); if (<codes>5__5[<i>5__6].opcode == OpCodes.Ldloc_1 && <codes>5__5[<i>5__6 + 1].opcode == OpCodes.Ldloc_S && ((LocalBuilder)<codes>5__5[<i>5__6 + 1].operand).LocalIndex == 35) { <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 25; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 35; return true; } goto IL_0f5e; IL_0953: if (<j>5__10 < 3) { <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 22; return true; } <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <endIf>5__9 }); <>1__state = 23; return true; IL_0f5e: if (<i>5__6 < <codes>5__5.Count) { if (<codes>5__5[<i>5__6 + 1].opcode == OpCodes.Stloc_S && ((LocalBuilder)<codes>5__5[<i>5__6 + 1].operand).LocalIndex == 39) { <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <bypassRicochet>5__3 }); <>1__state = 36; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 45; return true; } goto IL_1056; IL_1056: if (<i>5__6 < <codes>5__5.Count) { if (<codes>5__5[<i>5__6].opcode == OpCodes.Ldloc_S && ((LocalBuilder)<codes>5__5[<i>5__6].operand).LocalIndex == 39) { <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <bypassStop>5__2 }); <>1__state = 46; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 47; return true; } goto IL_12df; IL_0472: if (<j>5__8 < 4) { <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 7; return true; } <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <endIf>5__7 }); <>1__state = 8; return true; IL_12df: if (<i>5__6 < <codes>5__5.Count) { if (<codes>5__5[<i>5__6 + 4].opcode == OpCodes.Ldloc_S && ((LocalBuilder)<codes>5__5[<i>5__6 + 4].operand).LocalIndex == 56) { <>2__current = new CodeInstruction(OpCodes.Ldarg_1, (object)null); <>1__state = 48; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 56; return true; } break; IL_0504: if (<i>5__6 < <codes>5__5.Count) { <endIf>5__7 = il.DefineLabel(); if (<codes>5__5[<i>5__6 + 2].opcode == OpCodes.Ldfld && (FieldInfo)<codes>5__5[<i>5__6 + 2].operand == AccessTools.Field(typeof(BallisticProperties), "hollow")) { <>2__current = new CodeInstruction(OpCodes.Ldarg_1, (object)null); <>1__state = 1; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 9; return true; } goto IL_0646; IL_0646: if (<i>5__6 < <codes>5__5.Count) { if (<codes>5__5[<i>5__6].opcode == OpCodes.Ldloc_S && ((LocalBuilder)<codes>5__5[<i>5__6].operand).LocalIndex == 18) { <>2__current = <codes>5__5[<i>5__6++]; <>1__state = 10; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 13; return true; } goto IL_073e; IL_073e: if (<i>5__6 < <codes>5__5.Count) { if (<codes>5__5[<i>5__6].opcode == OpCodes.Ldloc_S && ((LocalBuilder)<codes>5__5[<i>5__6].operand).LocalIndex == 15) { <>2__current = CodeInstructionExtensions.WithLabels(<codes>5__5[<i>5__6++], new Label[1] { <bypassStuckInside>5__1 }); <>1__state = 14; return true; } <>2__current = <codes>5__5[<i>5__6]; <>1__state = 15; return true; } goto IL_09e8; } if (<i>5__6 < <codes>5__5.Count) { <>2__current = <codes>5__5[<i>5__6]; <>1__state = 57; 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(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <Transpiler>d__0 <Transpiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <Transpiler>d__ = this; } else { <Transpiler>d__ = new <Transpiler>d__0(0); } <Transpiler>d__.instructions = <>3__instructions; <Transpiler>d__.il = <>3__il; return <Transpiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<Transpiler>d__0))] [HarmonyPatch(typeof(BulletTrajectoryManager), "PlanTrajectory")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Transpiler>d__0(-2) { <>3__instructions = instructions, <>3__il = il }; } } [HarmonyPatch] public static class LancerTurrets_SetAmmo { [HarmonyPatch(typeof(TurretScript), "UpdateBarrel")] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //IL_0018: 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_004b: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown Label label = il.DefineLabel(); Label label2 = il.DefineLabel(); Label label3 = il.DefineLabel(); return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(TurretScript), "cartridge_spec"), (string)null) }).Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[6] { new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "lancerSet")), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(HashSet<TurretScript>), "Contains", new Type[1] { typeof(TurretScript) }, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label), new CodeInstruction(OpCodes.Pop, (object)null), CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "_50AP")), new Label[1] { label3 }) }) .AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label)) .Instructions(); } } [HarmonyPatch] public static class LancerTurrets_LeadAfterVisionLoss { [HarmonyPatch(typeof(TurretScript), "UpdateCameraAlive")] internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il) { //IL_0027: 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_005c: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected O, but got Unknown //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Expected O, but got Unknown //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Expected O, but got Unknown //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Expected O, but got Unknown //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Expected O, but got Unknown //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Expected O, but got Unknown //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Expected O, but got Unknown //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Expected O, but got Unknown //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Expected O, but got Unknown //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Expected O, but got Unknown //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Expected O, but got Unknown //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Expected O, but got Unknown //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Expected O, but got Unknown //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Expected O, but got Unknown //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Expected O, but got Unknown //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Expected O, but got Unknown //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Expected O, but got Unknown //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Expected O, but got Unknown //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Expected O, but got Unknown //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Expected O, but got Unknown //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Expected O, but got Unknown //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Expected O, but got Unknown //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Expected O, but got Unknown //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Expected O, but got Unknown //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Expected O, but got Unknown //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Expected O, but got Unknown //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Expected O, but got Unknown //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Expected O, but got Unknown //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Expected O, but got Unknown //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Expected O, but got Unknown //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_07a7: Expected O, but got Unknown //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Expected O, but got Unknown //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_07f4: Expected O, but got Unknown Label label = il.DefineLabel(); Label label2 = il.DefineLabel(); Label label3 = il.DefineLabel(); Label label4 = il.DefineLabel(); Label label5 = il.DefineLabel(); return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(RobotScript), "CanSeePlayer", (Type[])null, (Type[])null), (string)null) }).Advance(2).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[19] { new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "lancerSet")), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(HashSet<TurretScript>), "Contains", new Type[1] { typeof(TurretScript) }, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label2), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TurretScript), "get_BestVision", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StochasticVision), "can_see_player_this_frame")), new CodeInstruction(OpCodes.Brtrue_S, (object)label2), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TurretScript), "get_BestVision", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StochasticVision), "_consecutive_blocked")), new CodeInstruction(OpCodes.Ldc_R4, (object)0.2f), new CodeInstruction(OpCodes.Bge_S, (object)label), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TurretScript), "get_BestVision", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StochasticVision), "last_spotted_point")), new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos")), new CodeInstruction(OpCodes.Br_S, (object)label) }) .AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label2)) .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos"), (string)null) }) .Advance(1) .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos"), (string)null) }) .Advance(1) .AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label)) .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(StochasticVision), "can_see_player"), (string)null) }) .Advance(1) .RemoveInstruction() .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[39] { new CodeInstruction(OpCodes.Brtrue_S, (object)label4), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "fireViaSecurityCameraEnabled")), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(ConfigEntry<bool>), "get_Value", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label5), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "lancerSet")), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(HashSet<TurretScript>), "Contains", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label5), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Random), "get_insideUnitSphere", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "groupSizeViaSecurityCamera")), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(ConfigEntry<float>), "get_Value", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "op_Multiply", new Type[2] { typeof(Vector3), typeof(float) }, (Type[])null)), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "op_Addition", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos")), new CodeInstruction(OpCodes.Br_S, (object)label3), CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "lancerSet")), new Label[1] { label4 }), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(HashSet<TurretScript>), "Contains", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brfalse_S, (object)label3), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(TurretScript), "get_BestVision", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(StochasticVision), "can_see_player_this_frame")), new CodeInstruction(OpCodes.Brtrue_S, (object)label3), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos")), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldflda, (object)AccessTools.Field(typeof(TurretScript), "target_vel")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "get_normalized", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(LancerTurrets), "sweepSpeed")), new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(ConfigEntry<float>), "get_Value", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Time), "get_deltaTime", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Mul, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "op_Multiply", new Type[2] { typeof(Vector3), typeof(float) }, (Type[])null)), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "op_Addition", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(RobotScript), "target_pos")) }) .AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label3)) .MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null) }) .AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label5)) .Instructions(); } } [HarmonyPatch] public static class SleepyTurrets { private struct OverrideWakeupState { public AIState ai_state; public float standby_wakeup_delay; } [CompilerGenerated] private sealed class <DelayStartAsleep>d__14 : IEnumerator<WaitForSeconds>, IDisposable, IEnumerator { private int <>1__state; private WaitForSeconds <>2__current; public TurretScript turret; WaitForSeconds IEnumerator<WaitForSeconds>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayStartAsleep>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; state_access.Invoke(turret) = (AIState)5; 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 Dictionary<TurretScript, float> sleepTimers = new Dictionary<TurretScript, float>(); internal static FieldRef<TurretScript, AIState> state_access = AccessTools.FieldRefAccess<TurretScript, AIState>("ai_state"); internal static ConfigEntry<bool> enabled; internal static ConfigEntry<bool> overrideLevelStartAsleepChance; internal static ConfigEntry<float> startAsleepChance; internal static ConfigEntry<float> sleepyChance; internal static ConfigEntry<float> sleepTimeout; internal static ConfigEntry<float> wakeupDelay; internal static ConfigEntry<float> firstWakeupExtraDelay; internal static string[] coloredComponents = new string[3] { "point_pivot/gun_pivot/armor_gun/armor_gun_viz", "point_pivot/gun_pivot/gun_assembly/camera_armor", "point_pivot/gun_pivot/gun_assembly/motion_sensor" }; internal static ConfigEntry<Color> componentColor; [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "Update")] private static void SleepTimer(TurretScript __instance, ref AIState ___ai_state) { if (enabled.Value && sleepTimers.ContainsKey(__instance)) { if ((int)___ai_state == 3) { sleepTimers[__instance] = sleepTimeout.Value; } else if ((int)___ai_state == 0 && (sleepTimers[__instance] -= Time.deltaTime) <= 0f) { ___ai_state = (AIState)5; } } } [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "OnDestroy")] private static void Deregister(TurretScript __instance) { sleepTimers.Remove(__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(TurretScript), "Start")] private static void TurretSetup(TurretScript __instance, ref float ___standby_wakeup_delay, ref AIState ___ai_state) { //IL_0113: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(TurretMain.TurretSeed(__instance)); double num = random.NextDouble(); if (overrideLevelStartAsleepChance.Value) { ((RobotScript)__instance).start_in_standby_mode = num < (double)startAsleepChance.Value; } if (!((RobotScript)__instance).start_in_standby_mode) { return; } ___standby_wakeup_delay = firstWakeupExtraDelay.Value; if (__instance.is_ceiling_mounted) { ___ai_state = (AIState)0; ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)DelayStartAsleep(__instance)); } num = random.NextDouble(); if (num < (double)sleepyChance.Value) { sleepTimers[__instance] = sleepTimeout.Value; if (sleepTimers.Count >= 50) { Plugin.Logger.LogWarning((object)$"sleepy turret register abnormally large ({sleepTimers.Count}); you have an unusual number of turrets or they are not being deregistered"); } string[] array = coloredComponents; foreach (string text in array) { ((Renderer)((Component)((Component)__instance).transform.Find(text)).GetComponent<MeshRenderer>()).material.color = componentColor.Value; } } } [IteratorStateMachine(typeof(<DelayStartAsleep>d__14))] private static IEnumerator<WaitForSeconds> DelayStartAsleep(TurretScript turret) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayStartAsleep>d__14(0) { turret = turret }; } [HarmonyPrefix] [HarmonyPatch(typeof(TurretScript), "UpdateSensor")] private static void OverrideWakeupDelayPre(AIState ___ai_state, ref float ___standby_wakeup_delay, out OverrideWakeupState __state) { //IL_000c: 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) __state = new OverrideWakeupState { ai_state = ___ai_state, standby_wakeup_delay = ___standby_wakeup_delay }; } [HarmonyPostfix] [HarmonyPatch(typeof(TurretScript), "UpdateSensor")] private static void OverrideWakeupDelayPost(TurretScript __instance, ref float ___standby_wakeup_delay, OverrideWakeupState __state) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)__state.ai_state == 5 && __instance.motion_sensor_alive && !((RobotScript)__instance).powered_off && ((RobotScript)__instance).CanSeePlayer()) { ___standby_wakeup_delay = __state.standby_wakeup_delay + wakeupDelay.Value; if (sleepTimers.ContainsKey(__instance)) { sleepTimers[__instance] = sleepTimeout.Value + ___standby_wakeup_delay; } } } } [HarmonyPatch] internal class SleepyDrones { [CompilerGenerated] private sealed class <DelayStartAsleep>d__23 : IEnumerator<WaitForSeconds>, IDisposable, IEnumerator { private int <>1__state; private WaitForSeconds <>2__current; public ShockDrone drone; WaitForSeconds IEnumerator<WaitForSeconds>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayStartAsleep>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = new WaitForSeconds(firstSleepDelay); <>1__state = 1; return true; case 1: <>1__state = -1; if ((int)state_access.Invoke(drone) == 0) { ReversePatch_TransitionToState(drone, (ShockDroneState)3); } 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 Dictionary<ShockDrone, float> wakeUpTimers = new Dictionary<ShockDrone, float>(); private static Dictionary<ShockDrone, float> sleepTimers = new Dictionary<ShockDrone, float>(); private static HashSet<ShockDrone> grounded = new HashSet<ShockDrone>(); private static Dictionary<CameraPart, ShockDrone> cameraToDrone = new Dictionary<CameraPart, ShockDrone>(); private static Dictionary<OscillatorPart, ShockDrone> oscillatorToDrone = new Dictionary<OscillatorPart, ShockDrone>(); private static Dictionary<MotorPart, ShockDrone> motorToDrone = new Dictionary<MotorPart, ShockDrone>(); internal static FieldRef<SensorPart, RobotPart> part_access = AccessTools.FieldRefAccess<SensorPart, RobotPart>("part"); internal static FieldRef<ShockDrone, ShockDroneState> state_access = AccessTools.FieldRefAccess<ShockDrone, ShockDroneState>("state"); internal static FieldRef<MotorPart, EventInstance> event_instance_motor_access = AccessTools.FieldRefAccess<MotorPart, EventInstance>("event_instance_motor"); internal static MethodInfo throttle_set_access = AccessTools.PropertySetter(typeof(MotorPart), "Throttle"); internal static ConfigEntry<bool> startAsleepEnabled; internal static ConfigEntry<float> startAsleepChance; internal static ConfigEntry<float> wakeupDelay; internal static ConfigEntry<float> firstWakeupExtraDelay; internal static ConfigEntry<bool> sleepyEnabled; internal static ConfigEntry<float> sleepTimeout; internal static ConfigEntry<float> sleepyChance; internal static ConfigEntry<float> sleepVolumeMod; internal static float firstSleepDelay = 3f; internal static ConfigEntry<float> groundedChance; internal static string[] coloredComponents = new string[14] { "Back/Camera/Intact/camera_armor_001", "Back/Camera/Broken/camera_armor_shard", "Back/Camera/Broken/camera_armor_shard_001", "Back/Camera/Broken/camera_armor_shard_002", "Back/Camera/Broken/camera_armor_shard_003", "Back/Camera/Broken/camera_armor_shard_004", "Back/Camera/Broken/camera_armor_shard_005", "Front/Sensor/Intact/motion_sensor_001", "Front/Sensor/Broken/motion_sensor_shard", "Front/Sensor/Broken/motion_sensor_shard_001", "Front/Sensor/Broken/motion_sensor_shard_002", "Front/Sensor/Broken/motion_sensor_shard_003", "Front/Sensor/Broken/motion_sensor_shard_004", "Front/Sensor/Broken/motion_sensor_shard_005" }; internal static ConfigEntry<Color> componentColor; [HarmonyPostfix] [HarmonyPatch(typeof(ShockDrone), "Start")] private static void DroneSetup(ShockDrone __instance) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) cameraToDrone[__instance.camera_part] = __instance; oscillatorToDrone[__instance.oscillator_part] = __instance; motorToDrone[__instance.motor_part] = __instance; if (startAsleepEnabled.Value && Random.value < startAsleepChance.Value) { wakeUpTimers[__instance] = firstWakeupExtraDelay.Value; if (sleepyEnabled.Value && Random.value < sleepyChance.Value) { sleepTimers[__instance] = sleepTimeout.Value + firstSleepDelay; string[] array = coloredComponents; foreach (string text in array) { ((Renderer)((Component)((Component)__instance).transform.Find(text)).GetComponent<MeshRenderer>()).material.color = componentColor.Value; } } if (Random.value < groundedChance.Value) { grounded.Add(__instance); } ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)DelayStartAsleep(__instance)); } if (cameraToDrone.Count >= 50) { Plugin.Logger.LogWarning((object)$"sleepy drone register abnormally large ({cameraToDrone.Count}); you have an unusual number of drones or they are not being deregistered"); } } [IteratorStateMachine(typeof(<DelayStartAsleep>d__23))] private static IEnumerator<WaitForSeconds> DelayStartAsleep(ShockDrone drone) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayStartAsleep>d__23(0) { drone = drone }; } [HarmonyPostfix] [HarmonyPatch(typeof(CameraPart), "OnDestroy")] private static void Deregister(CameraPart __instance) { if (cameraToDrone.ContainsKey(__instance)) { ShockDrone val = cameraToDrone[__instance]; sleepTimers.Remove(val); wakeUpTimers.Remove(val); grounded.Remove(val); cameraToDrone.Remove(__instance); oscillatorToDrone.Remove(val.oscillator_part); motorToDrone.Remove(val.motor_part); } } [HarmonyPrefix] [HarmonyPatch(typeof(ShockDrone), "StandbyUpdate")] private static bool StandbyUpdate(ShockDrone __instance, ref ShockDroneState __result) { //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_0031: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to in