using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Landfall.TABS; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Tabs Poof Mod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Tabs Poof Mod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8aad4f38-2ad4-4206-bf0b-7d28fb6d5c2e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("bayturtleking.tabs.smelter", "Smelter", "1.0.0")] public class smeltermod : BaseUnityPlugin { [CompilerGenerated] private sealed class d__30 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; Camera main = Camera.main; if (!((Object)(object)main == (Object)null)) { Vector3 position = ((Component)main).transform.position; Vector3 val2; if (enableunitculling.Value) { float num2 = animatorcullrange.Value * animatorcullrange.Value; Animator[] array = Object.FindObjectsOfType(); foreach (Animator val in array) { if (!((Object)(object)val == (Object)null)) { val2 = ((Component)val).transform.position - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; ((Behaviour)val).enabled = sqrMagnitude <= num2; } } } if (enableparticleculling.Value) { float num3 = particlecullrange.Value * particlecullrange.Value; ParticleSystem[] array2 = Object.FindObjectsOfType(); foreach (ParticleSystem val3 in array2) { if (!((Object)(object)val3 == (Object)null)) { val2 = ((Component)val3).transform.position - position; if (((Vector3)(ref val2)).sqrMagnitude > num3 && !val3.isPlaying) { Object.Destroy((Object)(object)((Component)val3).gameObject); } } } } if (enablecameraopt.Value) { main.farClipPlane = camerafarclip.Value; } } } else { <>1__state = -1; } <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ConfigEntry enablemod; public static ConfigEntry shadowquality; public static ConfigEntry shadowdistance; public static ConfigEntry maxparticles; public static ConfigEntry lodbias; public static ConfigEntry disableantialiasing; public static ConfigEntry unlockframerate; public static ConfigEntry targetframerate; public static ConfigEntry sleepthreshold; public static ConfigEntry reducetexturequality; public static ConfigEntry enableunitculling; public static ConfigEntry animatorcullrange; public static ConfigEntry enableparticleculling; public static ConfigEntry particlecullrange; public static ConfigEntry enablecameraopt; public static ConfigEntry camerafarclip; public static ConfigEntry menukey; public static ConfigEntry removedeadbodies; public static smeltermod instance; private bool showmenu; private Rect windowrect = new Rect(20f, 20f, 280f, 340f); private Texture2D windowbg; private bool showadvanced; private int selectedpreset; private void Awake() { //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) instance = this; enablemod = ((BaseUnityPlugin)this).Config.Bind("General", "EnableMod", true, "disables/enables the mod. it may not set all values back to default, causing it to still be slightly active."); menukey = ((BaseUnityPlugin)this).Config.Bind("General", "MenuKey", (KeyCode)291, "Key to open/close the Smelter menu."); shadowquality = ((BaseUnityPlugin)this).Config.Bind("Rendering", "ShadowQuality", 1, "0 = off, 1 = hard only, 2 = soft."); shadowdistance = ((BaseUnityPlugin)this).Config.Bind("Rendering", "ShadowDistance", 40f, "lower = more FPS. TABS default is ~150."); lodbias = ((BaseUnityPlugin)this).Config.Bind("Rendering", "LodBias", 0.4f, "lower = swap to lower-poly meshes sooner. Unity default is 1.0."); disableantialiasing = ((BaseUnityPlugin)this).Config.Bind("Rendering", "DisableAntiAliasing", true, "disables msaa."); reducetexturequality = ((BaseUnityPlugin)this).Config.Bind("Rendering", "ReduceTextureQuality", false, "lowers texture resolution in half. good if you have low VRAM."); maxparticles = ((BaseUnityPlugin)this).Config.Bind("Particles", "MaxParticles", 500, "the cap for particle systems"); unlockframerate = ((BaseUnityPlugin)this).Config.Bind("Framerate", "UnlockFramerate", true, "Removes vsync and any fps cap."); targetframerate = ((BaseUnityPlugin)this).Config.Bind("Framerate", "TargetFramerate", 0, "0 = unlimited."); sleepthreshold = ((BaseUnityPlugin)this).Config.Bind("Physics", "SleepThreshold", 0.14f, "ragdolls sleep sooner. Unity default is 0.005."); enableunitculling = ((BaseUnityPlugin)this).Config.Bind("UnitCulling", "Enable", true, "disable animators on units far from the camera."); removedeadbodies = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "RemoveDeadBodies", false, "destroys units after death."); animatorcullrange = ((BaseUnityPlugin)this).Config.Bind("UnitCulling", "CullRange", 35f, "units beyond this distance get their animator disabled."); enableparticleculling = ((BaseUnityPlugin)this).Config.Bind("ParticleCulling", "Enable", true, "destroy off screen particle systems."); particlecullrange = ((BaseUnityPlugin)this).Config.Bind("ParticleCulling", "CullRange", 60f, "particle systems beyond this distance are destroyed."); enablecameraopt = ((BaseUnityPlugin)this).Config.Bind("Camera", "Enable", true, "reduce camera far clip plane during battles."); camerafarclip = ((BaseUnityPlugin)this).Config.Bind("Camera", "FarClipPlane", 300f, "lower = less of the world rendered. default is 1000 or more."); windowbg = new Texture2D(1, 1); windowbg.SetPixel(0, 0, new Color(0f, 0f, 0f, 1f)); windowbg.Apply(); if (!enablemod.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Smelter disabled."); return; } basicsettingspartboooooo(); new Harmony("bayturtleking. .smelter").PatchAll(); ((MonoBehaviour)this).StartCoroutine(cullingloop()); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; KeyCode value = menukey.Value; logger.LogInfo((object)("Smelter loaded! Click " + ((object)(KeyCode)(ref value)).ToString() + " to open the menu and apply optimizations that were previously hidden.")); } private void Update() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(menukey.Value)) { showmenu = !showmenu; } if (!enablemod.Value) { QualitySettings.shadows = (ShadowQuality)2; QualitySettings.shadowDistance = 150f; QualitySettings.lodBias = 1f; QualitySettings.antiAliasing = 2; QualitySettings.masterTextureLimit = 0; QualitySettings.vSyncCount = 1; Application.targetFrameRate = -1; } } private void OnGUI() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (showmenu) { GUI.skin.window.normal.background = windowbg; windowrect = GUILayout.Window(9001, windowrect, new WindowFunction(drawwindow), "Smelter", Array.Empty()); } } private void drawwindow(int id) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_004b: 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_0065: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) GUI.backgroundColor = new Color(1f, 1f, 1f, 1f); GUIStyle val = new GUIStyle(GUI.skin.label); val.fontSize = 10; val.normal.textColor = new Color(0.7f, 0.7f, 0.7f); GUIStyle val2 = new GUIStyle(GUI.skin.label); val2.fontSize = 10; val2.normal.textColor = new Color(1f, 0f, 0f, 1f); bool flag = GUILayout.Toggle(enablemod.Value, "Enable Smelter", Array.Empty()); GUILayout.Label("May not fully disable all optimizations. You may need to fully disable the mod via your mod manager.", val, Array.Empty()); if (flag != enablemod.Value) { enablemod.Value = flag; ((BaseUnityPlugin)this).Config.Save(); } GUILayout.Space(8f); GUILayout.Label("Optimizations", Array.Empty()); removedeadbodies.Value = GUILayout.Toggle(removedeadbodies.Value, "Remove dead bodies", Array.Empty()); GUILayout.Label("Don't use remove dead bodies if you're using 'Hide the Evidence' mod", val, Array.Empty()); enableunitculling.Value = GUILayout.Toggle(enableunitculling.Value, "Hide distant animations", Array.Empty()); enableparticleculling.Value = GUILayout.Toggle(enableparticleculling.Value, "Hide/cull off-screen particles", Array.Empty()); enablecameraopt.Value = GUILayout.Toggle(enablecameraopt.Value, "Reduce render distance", Array.Empty()); disableantialiasing.Value = GUILayout.Toggle(disableantialiasing.Value, "Disable anti-aliasing", Array.Empty()); reducetexturequality.Value = GUILayout.Toggle(reducetexturequality.Value, "Reduce texture quality", Array.Empty()); unlockframerate.Value = GUILayout.Toggle(unlockframerate.Value, "Unlock framerate", Array.Empty()); GUILayout.Space(8f); GUILayout.Label("Optimizing-Level Preset", Array.Empty()); GUILayout.Label("Presets for optimizations & advanced settings", val, Array.Empty()); GUILayout.Label("Higher-end presets", val, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Toggle(selectedpreset == 4, "Great", GUI.skin.button, Array.Empty())) { selectedpreset = 4; } if (GUILayout.Toggle(selectedpreset == 5, "Super", GUI.skin.button, Array.Empty())) { selectedpreset = 5; } if (GUILayout.Toggle(selectedpreset == 6, "MYY PC", GUI.skin.button, Array.Empty())) { selectedpreset = 6; } GUILayout.EndHorizontal(); GUILayout.Label("Default", val, Array.Empty()); if (GUILayout.Toggle(selectedpreset == 7, "Unity default", GUI.skin.button, Array.Empty())) { selectedpreset = 7; } GUILayout.Label("Lower-end presets", val, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Toggle(selectedpreset == 0, "Low", GUI.skin.button, Array.Empty())) { selectedpreset = 0; } if (GUILayout.Toggle(selectedpreset == 1, "Very low", GUI.skin.button, Array.Empty())) { selectedpreset = 1; } if (GUILayout.Toggle(selectedpreset == 2, "Potato", GUI.skin.button, Array.Empty())) { selectedpreset = 2; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Toggle(selectedpreset == 3, "Absolute Lowest", GUI.skin.button, Array.Empty())) { selectedpreset = 3; } GUILayout.EndHorizontal(); GUILayout.Label("Preset summary: shadows: " + shadowquality.Value + " rend. dist: " + shadowdistance.Value + " lod: " + lodbias.Value, val, Array.Empty()); GUILayout.Label("Remember: the settings that Smelter gives you are not all the settings in the game; just the hidden ones. There are still settings in the regular graphics options that can be changed to edit the game even more.", val2, Array.Empty()); GUILayout.Space(8f); if (GUILayout.Button("Apply Preset", Array.Empty())) { dothepreset(selectedpreset); basicsettingspartboooooo(); ((BaseUnityPlugin)this).Config.Save(); } GUILayout.Label("Applying takes some time to update. Give it a few seconds.", val, Array.Empty()); GUILayout.Space(4f); KeyCode value = menukey.Value; GUILayout.Label("Press " + ((object)(KeyCode)(ref value)).ToString() + " to close.", Array.Empty()); GUILayout.Space(8f); showadvanced = GUILayout.Toggle(showadvanced, "Advanced mode", Array.Empty()); if (showadvanced) { GUILayout.Label("Shadow quality (0:off, 1:hard, 2:soft)" + shadowquality.Value, Array.Empty()); shadowquality.Value = (int)GUILayout.HorizontalSlider((float)shadowquality.Value, 0f, 2f, Array.Empty()); GUILayout.Label("Shadow distance: " + shadowdistance.Value.ToString("F0"), Array.Empty()); shadowdistance.Value = GUILayout.HorizontalSlider(shadowdistance.Value, 10f, 1000f, Array.Empty()); GUILayout.Label("LOD bias: " + lodbias.Value.ToString("F2"), Array.Empty()); lodbias.Value = GUILayout.HorizontalSlider(lodbias.Value, 0.1f, 2.5f, Array.Empty()); GUILayout.Label("Max particles: " + maxparticles.Value, Array.Empty()); maxparticles.Value = (int)GUILayout.HorizontalSlider((float)maxparticles.Value, 50f, 5000f, Array.Empty()); GUILayout.Label("Animator cull range: " + animatorcullrange.Value.ToString("F0"), Array.Empty()); animatorcullrange.Value = GUILayout.HorizontalSlider(animatorcullrange.Value, 5f, 900f, Array.Empty()); GUILayout.Label("Particle cull range: " + particlecullrange.Value.ToString("F0"), Array.Empty()); particlecullrange.Value = GUILayout.HorizontalSlider(particlecullrange.Value, 5f, 900f, Array.Empty()); GUILayout.Label("Camera far clip: " + camerafarclip.Value.ToString("F0"), Array.Empty()); camerafarclip.Value = GUILayout.HorizontalSlider(camerafarclip.Value, 50f, 1500f, Array.Empty()); GUILayout.Label("Sleep threshold: " + sleepthreshold.Value.ToString("F3"), Array.Empty()); sleepthreshold.Value = GUILayout.HorizontalSlider(sleepthreshold.Value, 0.001f, 1f, Array.Empty()); GUILayout.Label("Unlike other settings, sleep threshold is more optimized at higher values, not lower. Default is 0.005.", Array.Empty()); removedeadbodies.Value = GUILayout.Toggle(removedeadbodies.Value, "Remove dead bodies", Array.Empty()); GUILayout.Space(4f); if (GUILayout.Button("Apply advanced", Array.Empty())) { basicsettingspartboooooo(); ((BaseUnityPlugin)this).Config.Save(); } } GUI.DragWindow(); } private void dothepreset(int preset) { switch (preset) { case 0: shadowquality.Value = 2; shadowdistance.Value = 80f; lodbias.Value = 0.6f; maxparticles.Value = 1000; animatorcullrange.Value = 50f; particlecullrange.Value = 80f; camerafarclip.Value = 800f; disableantialiasing.Value = false; reducetexturequality.Value = false; removedeadbodies.Value = false; break; case 1: shadowquality.Value = 1; shadowdistance.Value = 55f; lodbias.Value = 0.4f; maxparticles.Value = 500; animatorcullrange.Value = 35f; particlecullrange.Value = 60f; camerafarclip.Value = 500f; disableantialiasing.Value = true; reducetexturequality.Value = false; removedeadbodies.Value = true; break; case 2: shadowquality.Value = 0; shadowdistance.Value = 30f; lodbias.Value = 0.3f; maxparticles.Value = 100; animatorcullrange.Value = 15f; particlecullrange.Value = 20f; camerafarclip.Value = 150f; disableantialiasing.Value = true; reducetexturequality.Value = true; removedeadbodies.Value = true; break; case 3: shadowquality.Value = 0; shadowdistance.Value = 10f; lodbias.Value = 0.1f; maxparticles.Value = 100; animatorcullrange.Value = 10f; particlecullrange.Value = 20f; camerafarclip.Value = 80f; disableantialiasing.Value = true; reducetexturequality.Value = true; removedeadbodies.Value = true; break; case 4: shadowquality.Value = 2; shadowdistance.Value = 120f; lodbias.Value = 1.2f; maxparticles.Value = 1500; animatorcullrange.Value = 70f; particlecullrange.Value = 100f; camerafarclip.Value = 1000f; disableantialiasing.Value = false; reducetexturequality.Value = false; removedeadbodies.Value = false; sleepthreshold.Value = 0.02f; break; case 5: shadowquality.Value = 2; shadowdistance.Value = 200f; lodbias.Value = 2f; maxparticles.Value = 3000; animatorcullrange.Value = 100f; particlecullrange.Value = 150f; camerafarclip.Value = 1500f; disableantialiasing.Value = false; reducetexturequality.Value = false; removedeadbodies.Value = false; sleepthreshold.Value = 0.005f; break; case 6: shadowquality.Value = 2; shadowdistance.Value = 1000f; lodbias.Value = 3f; maxparticles.Value = 5000; animatorcullrange.Value = 200f; particlecullrange.Value = 300f; camerafarclip.Value = 3000f; disableantialiasing.Value = false; reducetexturequality.Value = false; removedeadbodies.Value = false; sleepthreshold.Value = 0.001f; break; case 7: shadowquality.Value = 2; shadowdistance.Value = 150f; lodbias.Value = 1f; maxparticles.Value = 1000; animatorcullrange.Value = 100f; particlecullrange.Value = 100f; camerafarclip.Value = 1000f; disableantialiasing.Value = false; reducetexturequality.Value = false; removedeadbodies.Value = false; sleepthreshold.Value = 0.005f; break; } } private void basicsettingspartboooooo() { switch (shadowquality.Value) { case 0: QualitySettings.shadows = (ShadowQuality)0; break; case 1: QualitySettings.shadows = (ShadowQuality)1; break; default: QualitySettings.shadows = (ShadowQuality)2; break; } QualitySettings.shadowDistance = shadowdistance.Value; QualitySettings.lodBias = lodbias.Value; if (disableantialiasing.Value) { QualitySettings.antiAliasing = 0; } if (reducetexturequality.Value) { QualitySettings.masterTextureLimit = 1; } if (unlockframerate.Value) { QualitySettings.vSyncCount = 0; Application.targetFrameRate = ((targetframerate.Value > 0) ? targetframerate.Value : (-1)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Smelter -- applied new settings."); } [IteratorStateMachine(typeof(d__30))] private IEnumerator cullingloop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__30(0); } } [HarmonyPatch(typeof(ParticleSystem), "Play", new Type[] { typeof(bool) })] public class patchparticlesystemplay { private static void Prefix(ParticleSystem __instance) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (smeltermod.enablemod.Value) { MainModule main = __instance.main; if (((MainModule)(ref main)).maxParticles > smeltermod.maxparticles.Value) { ((MainModule)(ref main)).maxParticles = smeltermod.maxparticles.Value; } } } } [HarmonyPatch(typeof(Rigidbody), "WakeUp")] public class patchrigidbodywakeup { private static void Postfix(Rigidbody __instance) { if (smeltermod.enablemod.Value) { __instance.sleepThreshold = smeltermod.sleepthreshold.Value; } } } [HarmonyPatch(typeof(HealthHandler), "Die", new Type[] { typeof(Unit) })] public class patchunitdie { private static void Postfix(HealthHandler __instance) { if (smeltermod.enablemod.Value && smeltermod.removedeadbodies.Value) { Object.Destroy((Object)(object)((Component)((Component)__instance).transform.root).gameObject, 1.5f); } } }