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 BetterRadarTowers v1.0.1
BetterRadarTowers.dll
Decompiled a day 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.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using RoR2; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [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("BetterRadarTowers")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BetterRadarTowers")] [assembly: AssemblyTitle("BetterRadarTowers")] [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 BetterRadarTowers { [BepInPlugin("Bloonjitsu7.BetterRadarTowers", "BetterRadarTowers", "1.0.0")] public class BetterRadarTowersPlugin : BaseUnityPlugin { public const string PluginGUID = "Bloonjitsu7.BetterRadarTowers"; public const string PluginAuthor = "Bloonjitsu7"; public const string PluginName = "BetterRadarTowers"; public const string PluginVersion = "1.0.0"; public static GameObject radarTower = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_RadarTower.RadarTower_prefab).WaitForCompletion(); public static ConfigEntry<float> ScannerSpawnChance { get; set; } public static ConfigEntry<bool> ScannerParticles { get; set; } public static ConfigEntry<bool> ScannerBattery { get; set; } public static ConfigEntry<bool> ScannerDebug { get; set; } public void Awake() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) Log.Init(((BaseUnityPlugin)this).Logger); ScannerSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("Radar Tower Behaviour", "Spawn Chance", 100f, "Percent chance for the predetermined Radar Tower to spawn on each stage. (100 = 100% chance)"); ScannerParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("Radar Tower Behaviour", "Disable Particles", true, "While true, disables the little sparks that fly out of Radar Towers. These sparks give away the positions of some of the hiding spots, so they're disabled by default."); ScannerBattery = ((BaseUnityPlugin)this).Config.Bind<bool>("Radar Tower Behaviour", "Fuel Array", false, "While true, Radio Towers will require a Fuel Array from the escape pod in order to activate, adding an extra challenge. Off by default."); ScannerDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Radar Tower Debugging", "Enable Debug Mode", false, "While true, prints the location of the Radar Tower into the debug log each time one is spawned. Can help with finding a specific Radar Tower if you're struggling."); Stage.onStageStartGlobal += OnStageStart; PurchaseInteraction.ShouldShowOnScanner += new hook_ShouldShowOnScanner(OnShowScanner); if (ScannerParticles.Value) { GameObject val = radarTower; Component val2 = (Component)(object)val.transform.Find("mdlRadar"); Component val3 = (Component)(object)val2.transform.Find("Sparks"); PurchaseInteraction val4 = default(PurchaseInteraction); if (val.TryGetComponent<PurchaseInteraction>(ref val4)) { if (ScannerBattery.Value) { val4.cost = 1; val4.automaticallyScaleCostWithDifficulty = false; val4.costType = (CostTypeIndex)8; } else { val4.cost = 0; val4.costType = (CostTypeIndex)0; } val4.shouldProximityHighlight = false; val4.setUnavailableOnTeleporterActivated = false; } if ((Object)(object)val3 != (Object)null) { ParticleSystem val5 = default(ParticleSystem); ParticleSystemRenderer val6 = default(ParticleSystemRenderer); if (val3.TryGetComponent<ParticleSystem>(ref val5) && val3.TryGetComponent<ParticleSystemRenderer>(ref val6)) { Object.Destroy((Object)(object)val5); Object.Destroy((Object)(object)val6); } Component val7 = (Component)(object)val3.transform.Find("Point Light"); Light val8 = default(Light); FlickerLight val9 = default(FlickerLight); if ((Object)(object)val7 != (Object)null && val7.TryGetComponent<Light>(ref val8) && val7.TryGetComponent<FlickerLight>(ref val9)) { Object.Destroy((Object)(object)val8); Object.Destroy((Object)(object)val9); } } } SceneDirector.GenerateInteractableCardSelection += new hook_GenerateInteractableCardSelection(OnGenerateInteractableCardSelection); } private WeightedSelection<DirectorCard> OnGenerateInteractableCardSelection(orig_GenerateInteractableCardSelection orig, SceneDirector self) { WeightedSelection<DirectorCard> val = orig.Invoke(self); for (int i = 0; i < val.Count; i++) { if (val != null) { _ = ref val.choices[i]; string name = ((Object)val.choices[i].value.spawnCard).name; if (name == "iscRadarTower") { val.choices[i].weight = 0f; } } } return val; } private bool OnShowScanner(orig_ShouldShowOnScanner orig, PurchaseInteraction self) { if (self.displayNameToken == "RADIOTOWER_NAME") { return false; } return orig.Invoke(self); } private void OnStageStart(Stage stage) { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0b53: Unknown result type (might be due to invalid IL or missing references) //IL_0b55: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 100f); if (!(ScannerSpawnChance.Value >= num)) { return; } GameObject val = radarTower; PurchaseInteraction val2 = default(PurchaseInteraction); if (val.TryGetComponent<PurchaseInteraction>(ref val2)) { if (ScannerBattery.Value) { val2.cost = 1; val2.automaticallyScaleCostWithDifficulty = false; val2.costType = (CostTypeIndex)8; } else { val2.cost = 0; val2.costType = (CostTypeIndex)0; } val2.shouldProximityHighlight = false; val2.setUnavailableOnTeleporterActivated = false; } if (ScannerParticles.Value) { Component val3 = (Component)(object)val.transform.Find("mdlRadar"); Component val4 = (Component)(object)val3.transform.Find("Sparks"); if ((Object)(object)val4 != (Object)null) { ParticleSystem val5 = default(ParticleSystem); ParticleSystemRenderer val6 = default(ParticleSystemRenderer); if (val4.TryGetComponent<ParticleSystem>(ref val5) && val4.TryGetComponent<ParticleSystemRenderer>(ref val6)) { Object.Destroy((Object)(object)val5); Object.Destroy((Object)(object)val6); } Component val7 = (Component)(object)val4.transform.Find("Point Light"); Light val8 = default(Light); FlickerLight val9 = default(FlickerLight); if ((Object)(object)val7 != (Object)null && val7.TryGetComponent<Light>(ref val8) && val7.TryGetComponent<FlickerLight>(ref val9)) { Object.Destroy((Object)(object)val8); Object.Destroy((Object)(object)val9); } } } bool flag = false; Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; string cachedName = stage.sceneDef.cachedName; switch (cachedName) { case "golemplains": flag = true; ((Vector3)(ref zero))..ctor(271.7f, -48f, -171.7f); ((Vector3)(ref zero2))..ctor(0f, 80f, 0f); break; case "blackbeach": flag = true; ((Vector3)(ref zero))..ctor(95.67f, -122.47f, -291.67f); ((Vector3)(ref zero2))..ctor(50f, 0f, 0f); break; case "snowyforest": flag = true; ((Vector3)(ref zero))..ctor(-64.9f, 81.85f, -185.78f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "village": flag = true; ((Vector3)(ref zero))..ctor(236.32f, 46.9f, -187.26f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "lakes": flag = true; ((Vector3)(ref zero))..ctor(-23.06f, 3.86f, 89.57f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "goolake": flag = true; ((Vector3)(ref zero))..ctor(0.95f, -35.72f, -124.53f); ((Vector3)(ref zero2))..ctor(0f, 90f, 20f); break; case "foggyswamp": flag = true; ((Vector3)(ref zero))..ctor(-48.6f, -84.39f, -153.34f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "ancientloft": flag = true; ((Vector3)(ref zero))..ctor(162.68f, 8.6f, -28.32f); ((Vector3)(ref zero2))..ctor(0f, 90f, 0f); break; case "nest": flag = true; ((Vector3)(ref zero))..ctor(-187f, 237.31f, 32.49f); ((Vector3)(ref zero2))..ctor(0f, 90f, 320f); break; case "frozenwall": flag = true; ((Vector3)(ref zero))..ctor(-239.45f, 132.86f, 242.23f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "wispgraveyard": flag = true; ((Vector3)(ref zero))..ctor(-355.12f, 83f, 7.5f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "sulfurpools": flag = true; ((Vector3)(ref zero))..ctor(-164.5f, 34.2f, 39.86f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "ironalluvium": flag = true; ((Vector3)(ref zero))..ctor(180f, 152.53f, 78.36f); ((Vector3)(ref zero2))..ctor(320f, 0f, 20f); break; case "shipgraveyard": flag = true; ((Vector3)(ref zero))..ctor(81.766f, 152.725f, 10.4f); ((Vector3)(ref zero2))..ctor(90f, 0f, 0f); break; case "rootjungle": flag = true; ((Vector3)(ref zero))..ctor(-7.16f, -75.38f, -1.7f); ((Vector3)(ref zero2))..ctor(60f, 0f, 0f); break; case "dampcavesimple": flag = true; ((Vector3)(ref zero))..ctor(-160.02f, -119.65f, -443.08f); ((Vector3)(ref zero2))..ctor(320f, 0f, 0f); break; case "repurposedcrater": flag = true; ((Vector3)(ref zero))..ctor(-80.16f, 100.9f, -26.59f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "skymeadow": flag = true; ((Vector3)(ref zero))..ctor(-142.31f, -107.41f, -259.95f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "helminthroost": flag = true; ((Vector3)(ref zero))..ctor(-711.6f, 142.2f, 19.4f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "lemuriantemple": flag = true; ((Vector3)(ref zero))..ctor(-9.06f, 15.92f, -179.92f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "habitat": flag = true; ((Vector3)(ref zero))..ctor(-3.8f, 111.65f, -3.78f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "conduitcanyon": flag = true; ((Vector3)(ref zero))..ctor(156.44f, 104.76f, -143.04f); ((Vector3)(ref zero2))..ctor(0f, 290f, 20f); break; case "lakesnight": flag = true; ((Vector3)(ref zero))..ctor(26.57f, -14.74f, 18.81f); ((Vector3)(ref zero2))..ctor(60f, 0f, 0f); break; case "villagenight": flag = true; ((Vector3)(ref zero))..ctor(-203.27f, 22.52f, 201.2f); ((Vector3)(ref zero2))..ctor(0f, 90f, 0f); break; case "habitatfall": flag = true; ((Vector3)(ref zero))..ctor(-18.55f, 66.95f, 157.45f); ((Vector3)(ref zero2))..ctor(0f, 320f, 0f); break; case "ironalluvium2": flag = true; ((Vector3)(ref zero))..ctor(8.03f, 162.41f, -189.7f); ((Vector3)(ref zero2))..ctor(320f, 90f, 20f); break; case "FBLScene": flag = true; ((Vector3)(ref zero))..ctor(-147.17f, 407.77f, -86.46f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "foggyswampdownpour": flag = true; ((Vector3)(ref zero))..ctor(-1040.74f, 77.56f, -2303.52f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "observatory_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(1.92f, 64.15f, 294.13f); ((Vector3)(ref zero2))..ctor(60f, 0f, 0f); break; case "hollowsummit_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(186.5f, 128.31f, -97.8f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "hollowsummitnight_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(71.43f, 173.77f, 133.26f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "tropics_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(124.09f, -9.83f, 182.94f); ((Vector3)(ref zero2))..ctor(0f, 0f, 40f); break; case "tropicsnight_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(-27.15f, -31.13f, 15.97f); ((Vector3)(ref zero2))..ctor(0f, 0f, 340f); break; case "broadcastperch_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(-36.81f, 261.88f, 167.9f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; case "sunkentombs_wormsworms": flag = true; ((Vector3)(ref zero))..ctor(-146.14f, 128.23f, -59f); ((Vector3)(ref zero2))..ctor(0f, 0f, 0f); break; } if (flag) { SpawnRadarTower(val, zero, zero2, cachedName); } } public void SpawnRadarTower(GameObject prefab, Vector3 position, Vector3 rotation, string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.Euler(rotation)); val.transform.eulerAngles = rotation; NetworkServer.Spawn(val); if (ScannerDebug.Value) { Vector3 val2 = position; Log.Message(name + " Radio Tower spawned at " + ((object)(Vector3)(ref val2)).ToString()); } } } 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); } } }