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 DadsDustBuster v1.0.0
DadsDustBuster.dll
Decompiled a month agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("DadsDustBuster")] [assembly: AssemblyDescription("Remove transient dust plumes in Valheim 1.0.12")] [assembly: AssemblyCompany("Dad_Is_Bored")] [assembly: AssemblyProduct("DadsDustBuster")] [assembly: AssemblyCopyright("Copyright 2026 Dad_Is_Bored")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] 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; } } [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 DadsDustBuster { [BepInPlugin("com.dadisbored.dadsdustbuster", "DadsDustBuster", "1.0.0")] [BepInProcess("valheim.exe")] public sealed class DadsDustBusterPlugin : BaseUnityPlugin { public const string PluginGuid = "com.dadisbored.dadsdustbuster"; public const string PluginName = "DadsDustBuster"; public const string PluginVersion = "1.0.0"; private Harmony? _harmony; internal static ConfigEntry<bool> ModEnabled { get; private set; } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Remove transient dust plumes created by building, dismantling, terrain tools, and other actions."); _harmony = new Harmony("com.dadisbored.dadsdustbuster"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"DadsDustBuster 1.0.0 loaded."); } private void OnDestroy() { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal static class DustSuppressor { private static readonly string[] NamedDustMarkers = new string[2] { "sawdust", "dust" }; private static readonly string[] PhysicalEffectMarkers = new string[11] { "destroy", "tree", "log", "bush", "shrub", "beehive", "wood", "stone", "rock", "_cut", "_pick" }; internal static void Suppress(GameObject[] effects) { //IL_0032: 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) foreach (GameObject val in effects) { if ((Object)(object)val == (Object)null) { continue; } ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren) { if (IsDustParticle(val2, val)) { EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; val2.Stop(true, (ParticleSystemStopBehavior)0); val2.Clear(true); ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } } } } private static bool IsDustParticle(ParticleSystem particleSystem, GameObject effect) { Transform val = ((Component)particleSystem).transform; while ((Object)(object)val != (Object)null) { if (ContainsAny(((Object)val).name, NamedDustMarkers)) { return true; } if ((Object)(object)val == (Object)(object)effect.transform) { break; } val = val.parent; } ParticleSystemRenderer component = ((Component)particleSystem).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component == (Object)null) { return false; } Material[] sharedMaterials = ((Renderer)component).sharedMaterials; foreach (Material val2 in sharedMaterials) { if (!((Object)(object)val2 == (Object)null)) { if (IsDedicatedDustMaterial(((Object)val2).name)) { return true; } if (IsPhysicalDustEffect(((Object)effect).name, ((Object)val2).name)) { return true; } } } Material trailMaterial = component.trailMaterial; if ((Object)(object)trailMaterial != (Object)null) { return IsDedicatedDustMaterial(((Object)trailMaterial).name); } return false; } private static bool IsDedicatedDustMaterial(string materialName) { if (materialName.IndexOf("build_fog", StringComparison.OrdinalIgnoreCase) < 0 && materialName.IndexOf("sawdust", StringComparison.OrdinalIgnoreCase) < 0) { return materialName.IndexOf("dust_footstep", StringComparison.OrdinalIgnoreCase) >= 0; } return true; } private static bool IsPhysicalDustEffect(string effectName, string materialName) { if (materialName.IndexOf("dust_particle", StringComparison.OrdinalIgnoreCase) >= 0) { return ContainsAny(effectName, PhysicalEffectMarkers); } return false; } private static bool ContainsAny(string value, string[] markers) { foreach (string value2 in markers) { if (value.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } } [HarmonyPatch(typeof(EffectList), "Create")] internal static class EffectListCreatePatch { private static void Postfix(GameObject[] __result) { if (DadsDustBusterPlugin.ModEnabled.Value && __result != null) { DustSuppressor.Suppress(__result); } } } }