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 TankOperator v1.1.1
plugins/TankOperator.dll
Decompiled 15 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using On.RoR2; using R2API; using RoR2; using RoR2.Skills; using TanksMod.Modules.Components.BasicTank; 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: IgnoresAccessChecksTo("TanksMod")] [assembly: AssemblyCompany("TankOperator")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+44f2dab23af8aedc2dc311364a9faf7722e0f64b")] [assembly: AssemblyProduct("TankOperator")] [assembly: AssemblyTitle("TankOperator")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TankOperator { 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); } } internal class TankOperatorController : MonoBehaviour { public static GameObject[] drones; private bool done; private bool command; private void Start() { //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_0084: Expected O, but got Unknown CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component.skillLocator.primary.baseSkill == (Object)(object)TankOperatorPlugin.mySkillDef) { component._defaultCrosshairPrefab = TankOperatorPlugin.operatorChrosshair; } if ((Object)(object)component.skillLocator.special.baseSkill != (Object)(object)TankOperatorPlugin.mySkillDef2) { Object.Destroy((Object)(object)((Component)this).GetComponent<DroneTechSurvivorUIController>()); return; } command = true; DroneTechRepairQueue component2 = ((Component)this).GetComponent<DroneTechRepairQueue>(); for (int i = 0; i < drones.Length; i++) { InstanceData val = new InstanceData { repairQueue = component2 }; val.repairMaster = component2.EnsureDroneMasterExistsAndHasBody(drones[i], "TankDrone" + i, val); } } private void FixedUpdate() { //IL_0045: 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) TankController component = ((Component)this).GetComponent<TankController>(); if (Object.op_Implicit((Object)(object)component.crosshair) && !done && command) { ((Component)component.crosshair.pitchRing).GetComponent<RectTransform>().anchoredPosition = new Vector2(-150f, 0f); ((Component)component.crosshair.rollRing).GetComponent<RectTransform>().anchoredPosition = new Vector2(-60f, 0f); done = true; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Slendykray.TankOperator", "TankOperator", "1.0.0")] public class TankOperatorPlugin : BaseUnityPlugin { public static Hook setModelHook; public static Hook hudHook; public static SkillDef mySkillDef2; public static SkillDef mySkillDef; public static GameObject operatorChrosshair; public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/DTGunnerDroneMaster.prefab").WaitForCompletion(); GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/DTHeallingDroneMaster.prefab").WaitForCompletion(); GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/DTHaulerDroneMaster.prefab").WaitForCompletion(); GameObject val4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/JunkDroneBody.prefab").WaitForCompletion(); GameObject val5 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/DTGunnerDroneBody.prefab").WaitForCompletion(); GameObject val6 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/JunkDroneMaster.prefab").WaitForCompletion(); GameObject val7 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/DTGunnerDroneBrokenBody.prefab").WaitForCompletion(); GameObject val8 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drones/JunkDroneBroken.prefab").WaitForCompletion(); GameObject val9 = PrefabAPI.InstantiateClone(val6, "SCRAP"); GameObject val10 = PrefabAPI.InstantiateClone(val4, "SCRAPBody"); GameObject val11 = PrefabAPI.InstantiateClone(val7, "SCRAPRepair"); string baseNameToken = "SCRAP"; CharacterBody component = val11.GetComponent<CharacterBody>(); component.baseNameToken = baseNameToken; component.portraitIcon = Addressables.LoadAssetAsync<Texture>((object)"RoR2/DLC3/Drones/texJunkDroneIcon.png").WaitForCompletion(); CharacterBody component2 = val10.GetComponent<CharacterBody>(); component2.baseNameToken = baseNameToken; Object.Destroy((Object)(object)((Component)val11.transform.Find("ModelBase")).gameObject); GameObject val12 = Object.Instantiate<GameObject>(((Component)val8.transform.Find("ModelBase")).gameObject, val11.transform); val10.GetComponent<CharacterDeathBehavior>().deathState = val5.GetComponent<CharacterDeathBehavior>().deathState; val9.GetComponent<CharacterMaster>().bodyPrefab = val10; val9.AddComponent<MatchOwnerDontDestroyOnLoad>(); val9.AddComponent<SetDontDestroyOnLoad>(); DroneRepairMaster val13 = val9.AddComponent<DroneRepairMaster>(); val13.brokenBodyPrefab = val11; CharacterMaster component3 = val9.GetComponent<CharacterMaster>(); component3.destroyOnBodyDeath = false; component3.preventGameOver = false; ContentAddition.AddBody(val11); ContentAddition.AddBody(val10); ContentAddition.AddMaster(val9); TankOperatorController.drones = (GameObject[])(object)new GameObject[4] { val, val2, val3, val9 }; MethodInfo method = typeof(MeshRuntime).GetMethod("SetModel", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); setModelHook = new Hook((MethodBase)method, (Delegate)new Action<Action<MeshRuntime>, MeshRuntime>(SetModelHook)); BodyCatalog.SetBodyPrefabs += new hook_SetBodyPrefabs(BodyCatalog_SetBodyPrefabs); } private void BodyCatalog_SetBodyPrefabs(orig_SetBodyPrefabs orig, GameObject[] newBodyPrefabs) { //IL_002c: 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_0067: 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_0091: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(newBodyPrefabs); GameObject val = BodyCatalog.FindBodyPrefab("BasicTankBody"); SkillLocator component = val.GetComponent<SkillLocator>(); SkillFamily skillFamily = component.primary.skillFamily; mySkillDef = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC3/Drone Tech/FireNanoPistol.asset").WaitForCompletion(); Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val2 = new Variant { skillDef = mySkillDef }; ((Variant)(ref val2)).viewableNode = new Node(mySkillDef.skillNameToken, false, (Node)null); variants[num] = val2; SkillFamily skillFamily2 = component.special.skillFamily; mySkillDef2 = (SkillDef)(object)Addressables.LoadAssetAsync<DroneTechDroneSkillDef>((object)"RoR2/DLC3/Drone Tech/Command.asset").WaitForCompletion(); Array.Resize(ref skillFamily2.variants, skillFamily2.variants.Length + 1); Variant[] variants2 = skillFamily2.variants; int num2 = skillFamily2.variants.Length - 1; val2 = new Variant { skillDef = mySkillDef2 }; ((Variant)(ref val2)).viewableNode = new Node(mySkillDef2.skillNameToken, false, (Node)null); variants2[num2] = val2; val.AddComponent<TankOperatorController>(); val.AddComponent<DroneTechController>(); DroneTechRepairQueue val3 = val.AddComponent<DroneTechRepairQueue>(); val3.healRate = 0.05f; GameObject val4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drone Tech/DroneTechBody.prefab").WaitForCompletion(); DroneTechSurvivorUIController val5 = val.AddComponent<DroneTechSurvivorUIController>(); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)val4.GetComponent<DroneTechSurvivorUIController>()), (object)val5); operatorChrosshair = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/Drone Tech/DroneTechCrosshair.prefab").WaitForCompletion(); } private static void SetModelHook(Action<MeshRuntime> orig, MeshRuntime self) { if (self.currentSmallGunId == 7) { self.currentSmallGunId = 5; } if (self.currentSpecialId == 7) { self.currentSpecialId = 2; } orig(self); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { internal IgnoresAccessChecksToAttribute(string assemblyName) { } } }