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 NoRainParticles v1.1.0
NoRainParticles.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoRainParticles")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+1feeadb1f9fb0e39b99091427f4702dd03d76cb7")] [assembly: AssemblyProduct("NoRainParticles")] [assembly: AssemblyTitle("NoRainParticles")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace NoRainParticles { [BepInPlugin("MysticDEV.NoRainParticles", "NoRainParticles", "1.1.0")] public class NoRainParticlesPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound), "Start")] internal class StartPatch { [HarmonyPostfix] private static void SubscribeToLandingEvent(StartOfRound __instance) { __instance.StartedLandingShip -= OnShipStartedLanding; __instance.StartedLandingShip += OnShipStartedLanding; ManualLogSource? logger = NoRainParticlesPlugin.logger; if (logger != null) { logger.LogInfo((object)"Subscribed to StartedLandingShip event"); } } } internal static ManualLogSource? logger; private readonly Harmony harmony = new Harmony("MysticDEV.NoRainParticles"); private static NoRainParticlesPlugin? instance; private void Awake() { instance = this; logger = ((BaseUnityPlugin)this).Logger; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); harmony.PatchAll(); logger.LogInfo((object)"NoRainParticles v1.1.0 is loaded!"); } private static void OnShipStartedLanding() { try { ManualLogSource? obj = logger; if (obj != null) { obj.LogInfo((object)"StartedLandingShip event fired - starting delayed rain particle scan..."); } StartOfRound val = StartOfRound.Instance; if ((Object)(object)val != (Object)null) { ((MonoBehaviour)val).StartCoroutine(DelayedDisableRainParticles()); return; } ManualLogSource? obj2 = logger; if (obj2 != null) { obj2.LogWarning((object)"StartOfRound.Instance is null/destroyed - skipping rain particle scan this landing."); } } catch (Exception arg) { ManualLogSource? obj3 = logger; if (obj3 != null) { obj3.LogError((object)$"Exception in OnShipStartedLanding: {arg}"); } } } private static IEnumerator DelayedDisableRainParticles() { yield return (object)new WaitForSeconds(0.5f); ManualLogSource? obj = logger; if (obj != null) { obj.LogInfo((object)"Delayed scan executing..."); } DisableRainParticles(); yield return (object)new WaitForSeconds(0.5f); DisableRainParticles(); } public static void DisableRainParticles() { //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) try { int num = 0; ParticleSystem[] array = Object.FindObjectsOfType<ParticleSystem>(); ManualLogSource? obj = logger; if (obj != null) { obj.LogInfo((object)$"Scanning {array.Length} particle systems..."); } ParticleSystem[] array2 = array; foreach (ParticleSystem val in array2) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } string text = ((Object)((Component)val).gameObject).name.ToLower(); string text2 = (((Object)(object)((Component)val).transform.parent != (Object)null) ? ((Object)((Component)val).transform.parent).name.ToLower() : ""); bool num2 = text.Contains("rain") || text2.Contains("rain") || (text2.Contains("storm") && text.Contains("particle")); bool flag = text.Contains("lightning") || text.Contains("thunder") || text.Contains("bolt") || text.Contains("strike") || text.Contains("puddle") || text.Contains("splash") || text.Contains("mud") || text.Contains("ground") || text.Contains("magnet") || text.Contains("spark") || text.Contains("electric") || text.Contains("charge") || text.Contains("static") || text.Contains("blast") || text.Contains("warning") || text.Contains("flash") || text2.Contains("magnet") || (text2.Contains("stormy") && (text.Contains("static") || text.Contains("blast") || text.Contains("warning"))); if (num2 && !flag) { val.Stop(true, (ParticleSystemStopBehavior)0); val.Clear(); EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; ParticleSystemRenderer component = ((Component)val).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; ((Renderer)component).forceRenderingOff = true; } num++; ManualLogSource? obj2 = logger; if (obj2 != null) { string[] obj3 = new string[5] { "DISABLED: '", ((Object)((Component)val).gameObject).name, "' (Parent: '", null, null }; Transform parent = ((Component)val).transform.parent; obj3[3] = ((parent != null) ? ((Object)parent).name : null) ?? "None"; obj3[4] = "')"; obj2.LogInfo((object)string.Concat(obj3)); } } } ManualLogSource? obj4 = logger; if (obj4 != null) { obj4.LogInfo((object)$"Scan complete - Disabled {num} rain particle systems"); } } catch (Exception ex) { ManualLogSource? obj5 = logger; if (obj5 != null) { obj5.LogError((object)("Error disabling rain particles: " + ex.Message)); } } } } }