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 SmokeReducer v1.0.0
SmokeReducer.dll
Decompiled a day 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: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("SmokeReducer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SmokeReducer")] [assembly: AssemblyTitle("SmokeReducer")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SmokeReducer { [BepInPlugin("pieter.valheim.smokereducer", "Smoke Reducer", "1.0.0")] public class Plugin : BaseUnityPlugin { private sealed class Original { public float Interval; } public const string Guid = "pieter.valheim.smokereducer"; public const string Name = "Smoke Reducer"; public const string Version = "1.0.0"; private static ConfigEntry<float> _intervalMultiplier; private static ConfigEntry<int> _maxSmoke; private static readonly ConditionalWeakTable<SmokeSpawner, Original> Originals = new ConditionalWeakTable<SmokeSpawner, Original>(); private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown _intervalMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Smoke", "Spawn interval multiplier", 2f, new ConfigDescription("Time between smoke puffs from each fire, times this. 2 = half as many puffs, 1 = vanilla.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>())); _maxSmoke = ((BaseUnityPlugin)this).Config.Bind<int>("Smoke", "Max smoke puffs", 50, new ConfigDescription("Most smoke puffs alive at once around you; the oldest fade out first. Vanilla is 100.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); _intervalMultiplier.SettingChanged += delegate { ApplyAll(); }; Harmony.CreateAndPatchAll(typeof(Plugin), "pieter.valheim.smokereducer"); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Smoke puffs x1/{_intervalMultiplier.Value:0.#}, max {_maxSmoke.Value}."); } [HarmonyPatch(typeof(SmokeSpawner), "Awake")] [HarmonyPostfix] private static void SpawnerAwake(SmokeSpawner __instance) { Apply(__instance); } private static void Apply(SmokeSpawner spawner) { if (!((Object)(object)spawner == (Object)null)) { Original value = Originals.GetValue(spawner, (SmokeSpawner s) => new Original { Interval = s.m_interval }); spawner.m_interval = value.Interval * _intervalMultiplier.Value; } } private static void ApplyAll() { foreach (IMonoUpdater instance in SmokeSpawner.Instances) { Apply((SmokeSpawner)(object)((instance is SmokeSpawner) ? instance : null)); } } [HarmonyPatch(typeof(SmokeSpawner), "Spawn")] [HarmonyPrefix] private static void BeforeSpawn() { int num = 0; while (Smoke.GetTotalSmoke() >= _maxSmoke.Value && num++ < 100) { Smoke.FadeOldest(); } } } }