Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RailgunnerTurret v1.0.1
RailgunnerTurret.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Engi.EngiWeapon; using EntityStates.Railgunner.Weapon; using Microsoft.CodeAnalysis; using On.RoR2.CharacterAI; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RailgunnerTurret")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+34955350cd67a8348d141a3bdc68d8d09c7407ef")] [assembly: AssemblyProduct("RailgunnerTurret")] [assembly: AssemblyTitle("RailgunnerTurret")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 RailgunnerTurret { public class Assets { public static GameObject railgunnerTurretPrefab; public static GameObject railgunnerTurretMasterPrefab; public static GameObject wristDisplay = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Engi.EngiTurretWristDisplay_prefab).WaitForCompletion(); public static GameObject blueprints = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Engi.EngiWalkerTurretBlueprints_prefab).WaitForCompletion(); public static GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_Railgunner.ImpactRailgun_prefab).WaitForCompletion(); public static GameObject muzzleFlashPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.Muzzleflash1_prefab).WaitForCompletion(); public static GameObject tracerEffectPrefab; public static void Init() { CreateRailgunnerTurretPrefab(); CreateRailgunnerTurretSkill(); CreateTracerEffectPrefab(); } public static void CreateTracerEffectPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown tracerEffectPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_Railgunner.TracerRailgunSuper_prefab).WaitForCompletion(), "RailgunnerTurretTracerEffectPrefab", false); ((Component)tracerEffectPrefab.transform.Find("StartTransform/PP")).gameObject.SetActive(RailgunnerTurret.postProcessingEffects.Value); ContentPacks.effectDefs.Add(new EffectDef(tracerEffectPrefab)); } public static void CreateRailgunnerTurretPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0170: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Invalid comparison between Unknown and I4 //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Invalid comparison between Unknown and I4 railgunnerTurretPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Engi.EngiWalkerTurretBody_prefab).WaitForCompletion(), "RailgunnerTurretBody"); ContentPacks.bodyPrefabs.Add(railgunnerTurretPrefab); railgunnerTurretMasterPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Engi.EngiWalkerTurretMaster_prefab).WaitForCompletion(), "RailgunnerTurretMaster"); ContentPacks.masterPrefabs.Add(railgunnerTurretMasterPrefab); CharacterMaster component = railgunnerTurretMasterPrefab.GetComponent<CharacterMaster>(); component.bodyPrefab = railgunnerTurretPrefab; CharacterBody component2 = railgunnerTurretPrefab.GetComponent<CharacterBody>(); ((Object)component2).name = "RailgunnerTurretBody"; SkillLocator component3 = ((Component)component2).GetComponent<SkillLocator>(); component2.baseMoveSpeed *= RailgunnerTurret.moveSpeedMulitplier.Value; SkillDef val = Object.Instantiate<SkillDef>(Addressables.LoadAssetAsync<SkillDef>((object)RoR2_DLC1_Railgunner.RailgunnerBodyFireSnipeSuper_asset).WaitForCompletion()); ContentPacks.skillDefs.Add(val); val.activationState = new SerializableEntityStateType(typeof(FireSnipeSuperTurret)); ContentPacks.entityStateTypes.Add(typeof(FireSnipeSuperTurret)); val.baseRechargeInterval = RailgunnerTurret.baseRechargeInterval.Value; val.baseMaxStock = 1; SkillFamily skillFamily = component3.primary.skillFamily; SkillFamily val2 = Object.Instantiate<SkillFamily>(skillFamily); ContentPacks.skillFamilies.Add(val2); Variant[] array = new Variant[1]; Variant val3 = new Variant { skillDef = val, unlockableDef = null }; ((Variant)(ref val3)).viewableNode = new Node(val.skillNameToken, false, (Node)null); array[0] = val3; val2.variants = (Variant[])(object)array; component3.primary._skillFamily = val2; AISkillDriver[] components = ((Component)component).GetComponents<AISkillDriver>(); AISkillDriver[] array2 = components; foreach (AISkillDriver val4 in array2) { if ((int)val4.skillSlot == 0) { val4.maxDistance = RailgunnerTurret.maxDistance.Value; val4.activationRequiresTargetLoS = true; val4.activationRequiresAimConfirmation = true; val4.activationRequiresAimTargetLoS = true; } if ((int)val4.moveTargetType == 2 && val4.minDistance == 110f) { val4.minDistance = RailgunnerTurret.distanceToStartSprinting.Value; } } AddRailgunnerSoundbank(railgunnerTurretPrefab); } private static void AddRailgunnerSoundbank(GameObject gameObject) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) AkBank component = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC1_Railgunner.RailgunnerBody_prefab).WaitForCompletion().GetComponent<AkBank>(); if ((Object)(object)component != (Object)null) { AkBank val = gameObject.AddComponent<AkBank>(); ((AkTriggerHandler)val).triggerList = ((AkTriggerHandler)component).triggerList; val.data.WwiseObjectReference = component.data.WwiseObjectReference; val.unloadTriggerList = component.unloadTriggerList; } } private static void CreateRailgunnerTurretSkill() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)RoR2_Base_Engi.EngiBodyPlaceWalkerTurret_asset).WaitForCompletion(); SkillDef val2 = Object.Instantiate<SkillDef>(val); val2.skillName = "RailgunnerTurret"; val2.skillNameToken = "ENGI_RAILGUNNER_TURRET_NAME"; val2.skillDescriptionToken = "ENGI_RAILGUNNER_TURRET_DESC"; LanguageAPI.Add("ENGI_RAILGUNNER_TURRET_NAME", "TRM99 \"Noisy Cricket\""); LanguageAPI.Add("ENGI_RAILGUNNER_TURRET_DESC", "Place a <style=cIsUtility>mobile</style> turret that <style=cIsUtility>inherits all your items.</style> Fires a high powered laser for <style=cIsDamage>3000% damage</style> with a cooldown of <style=cIsDamage>21 seconds</style>. Targets the <style=cIsUtility>highest health</style> enemy it can see. Can place up to 2."); val2.activationState = new SerializableEntityStateType(typeof(PlaceRailgunnerTurret)); ContentPacks.entityStateTypes.Add(typeof(PlaceRailgunnerTurret)); SkillFamily val3 = Addressables.LoadAssetAsync<SkillFamily>((object)RoR2_Base_Engi.EngiBodySpecialFamily_asset).WaitForCompletion(); Variant val4 = default(Variant); val4.skillDef = val2; Variant element = val4; val3.variants = val3.variants.Append(element).ToArray(); ContentAddition.AddSkillDef(val2); } } public class PlaceRailgunnerTurret : PlaceWalkerTurret { public override void OnEnter() { ((PlaceTurret)this).wristDisplayPrefab = Assets.wristDisplay; ((PlaceTurret)this).blueprintPrefab = Assets.blueprints; ((PlaceTurret)this).placeSoundString = ""; ((PlaceTurret)this).turretMasterPrefab = Assets.railgunnerTurretMasterPrefab; ((PlaceTurret)this).OnEnter(); } } public class FireSnipeSuperTurret : FireSnipeSuper { public override void OnEnter() { ((GenericBulletBaseState)this).hitEffectPrefab = Assets.hitEffectPrefab; ((GenericBulletBaseState)this).force = 4000f; ((BaseFireSnipe)this).headshotSoundString = "Play_railgunner_m2_headshot"; ((GenericBulletBaseState)this).fireSoundString = "Play_railgunner_R_fire"; ((GenericBulletBaseState)this).damageCoefficient = RailgunnerTurret.damageCoefficient.Value; ((BaseFireSnipe)this).critDamageMultiplier = RailgunnerTurret.critDamageMultiplier.Value; ((GenericBulletBaseState)this).bulletRadius = 1f; ((GenericBulletBaseState)this).bulletCount = 1; ((GenericBulletBaseState)this).baseDuration = 1f; ((BaseFireSnipe)this).animationStateName = "FireSuper"; ((BaseFireSnipe)this).animationPlaybackRateParam = "Super.playbackRate"; ((BaseFireSnipe)this).animationLayerName = "Gesture, Override"; ((GenericBulletBaseState)this).recoilAmplitudeX = 1f; ((GenericBulletBaseState)this).recoilAmplitudeY = 6f; ((GenericBulletBaseState)this).procCoefficient = RailgunnerTurret.procCoefficient.Value; ((BaseFireSnipe)this).piercingDamageCoefficientPerTarget = 1f; ((GenericBulletBaseState)this).muzzleName = "Muzzle"; ((GenericBulletBaseState)this).muzzleFlashPrefab = Assets.muzzleFlashPrefab; ((GenericBulletBaseState)this).minSpread = 0f; ((GenericBulletBaseState)this).maxSpread = 0f; ((GenericBulletBaseState)this).maxDistance = 9999f; ((BaseFireSnipe)this).isPiercing = true; ((GenericBulletBaseState)this).useSmartCollision = true; ((BaseFireSnipe)this).useSecondaryStocks = false; ((BaseFireSnipe)this).trajectoryAimAssistMultiplier = 0f; ((GenericBulletBaseState)this).tracerEffectPrefab = Assets.tracerEffectPrefab; ((GenericBulletBaseState)this).spreadYawScale = 0f; ((GenericBulletBaseState)this).spreadPitchScale = 0f; ((GenericBulletBaseState)this).spreadBloomValue = 0f; ((BaseFireSnipe)this).selfKnockbackForce = RailgunnerTurret.selfKnockbackForce.Value; ((BaseFireSnipe)this).OnEnter(); } public override void ModifyBullet(BulletAttack bulletAttack) { ((FireSnipeSuper)this).ModifyBullet(bulletAttack); bulletAttack.sniper = false; EntityStateMachine component = ((Component)((EntityState)this).characterBody).GetComponent<EntityStateMachine>(); EntityState state = component.state; GenericCharacterMain val = (GenericCharacterMain)(object)((state is GenericCharacterMain) ? state : null); if (val != null) { val.jumpInputReceived = true; val.ProcessJump(true); } } } internal class ContentPacks : IContentPackProvider { [CompilerGenerated] private sealed class <FinalizeAsync>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; public ContentPacks <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GetContentPackAsyncArgs args; public ContentPacks <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; ContentPack.Copy(<>4__this.contentPack, args.output); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; public ContentPacks <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.contentPack.identifier = <>4__this.identifier; <>4__this.contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); <>4__this.contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); <>4__this.contentPack.entityStateTypes.Add(entityStateTypes.ToArray()); <>4__this.contentPack.skillDefs.Add(skillDefs.ToArray()); <>4__this.contentPack.effectDefs.Add(effectDefs.ToArray()); <>4__this.contentPack.skillFamilies.Add(skillFamilies.ToArray()); args.ReportProgress(1f); 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(); } } internal ContentPack contentPack = new ContentPack(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<Type> entityStateTypes = new List<Type>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public string identifier => "bouncyshield.RailgunnerTurret"; public void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__11))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__11(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__12))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__12(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<FinalizeAsync>d__13))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__13(0) { <>4__this = this, args = args }; } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("bouncyshield.RailgunnerTurret", "RailgunnerTurret", "1.0.1")] public class RailgunnerTurret : BaseUnityPlugin { public const string PluginGUID = "bouncyshield.RailgunnerTurret"; public const string PluginAuthor = "bouncyshield"; public const string PluginName = "RailgunnerTurret"; public const string PluginVersion = "1.0.1"; internal static ConfigEntry<float> damageCoefficient; internal static ConfigEntry<float> critDamageMultiplier; internal static ConfigEntry<float> procCoefficient; internal static ConfigEntry<float> selfKnockbackForce; internal static ConfigEntry<bool> postProcessingEffects; internal static ConfigEntry<float> baseRechargeInterval; internal static ConfigEntry<float> maxDistance; internal static ConfigEntry<float> moveSpeedMulitplier; internal static ConfigEntry<float> distanceToStartSprinting; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); Configs(); Hooks(); Assets.Init(); new ContentPacks().Init(); } private void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BaseAI.UpdateTargets += new hook_UpdateTargets(TurretUpdateTargets); } private void Configs() { damageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "damageCoefficient", 30f, "e.g. 30 gives 3000% damage"); critDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "critDamageMultiplier", 1.5f, (ConfigDescription)null); procCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "procCoefficient", 1.5f, (ConfigDescription)null); selfKnockbackForce = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "selfKnockbackForce", 10000f, "the recoil"); postProcessingEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("Turret", "postProcessingEffects", false, "the red glow on each shot, can be annoying"); baseRechargeInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "baseRechargeInterval", 21f, "the cooldown"); maxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "maxDistance", 9999f, "the farthest distance the turret will lock onto a target from"); moveSpeedMulitplier = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "moveSpeedMulitplier", 0.6f, "this multiplies carbonizer's base speed"); distanceToStartSprinting = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "distanceToStartSprinting", 30f, "the distance from engi that the turret will start sprinting"); } private void TurretUpdateTargets(orig_UpdateTargets orig, BaseAI self) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown orig.Invoke(self); CharacterBody body = self.body; if (!((Object)self).name.Contains("RailgunnerTurret")) { return; } InputBankTest inputBank = body.inputBank; TeamComponent teamComponent = body.teamComponent; if ((Object)(object)body == (Object)null || (Object)(object)inputBank == (Object)null || (Object)(object)teamComponent == (Object)null) { return; } BullseyeSearch val = new BullseyeSearch { searchOrigin = body.corePosition, searchDirection = inputBank.aimDirection, teamMaskFilter = TeamMask.GetEnemyTeams(teamComponent.teamIndex), maxDistanceFilter = 9999f, filterByLoS = true, sortMode = (SortMode)0 }; val.RefreshCandidates(); HurtBox val2 = null; float num = float.NegativeInfinity; foreach (HurtBox result in val.GetResults()) { float combinedHealth = result.healthComponent.combinedHealth; if (combinedHealth > num) { num = combinedHealth; val2 = result; } } if (Object.op_Implicit((Object)(object)val2)) { self.currentEnemy.bestHurtBox = val2; } } } }