Decompiled source of Smelter v1.0.0

Smelter.dll

Decompiled a week ago
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 <cullingloop>d__30 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <cullingloop>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<Animator>();
						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<ParticleSystem>();
						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<bool> enablemod;

	public static ConfigEntry<int> shadowquality;

	public static ConfigEntry<float> shadowdistance;

	public static ConfigEntry<int> maxparticles;

	public static ConfigEntry<float> lodbias;

	public static ConfigEntry<bool> disableantialiasing;

	public static ConfigEntry<bool> unlockframerate;

	public static ConfigEntry<int> targetframerate;

	public static ConfigEntry<float> sleepthreshold;

	public static ConfigEntry<bool> reducetexturequality;

	public static ConfigEntry<bool> enableunitculling;

	public static ConfigEntry<float> animatorcullrange;

	public static ConfigEntry<bool> enableparticleculling;

	public static ConfigEntry<float> particlecullrange;

	public static ConfigEntry<bool> enablecameraopt;

	public static ConfigEntry<float> camerafarclip;

	public static ConfigEntry<KeyCode> menukey;

	public static ConfigEntry<bool> 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<bool>("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<KeyCode>("General", "MenuKey", (KeyCode)291, "Key to open/close the Smelter menu.");
		shadowquality = ((BaseUnityPlugin)this).Config.Bind<int>("Rendering", "ShadowQuality", 1, "0 = off, 1 = hard only, 2 = soft.");
		shadowdistance = ((BaseUnityPlugin)this).Config.Bind<float>("Rendering", "ShadowDistance", 40f, "lower = more FPS. TABS default is ~150.");
		lodbias = ((BaseUnityPlugin)this).Config.Bind<float>("Rendering", "LodBias", 0.4f, "lower = swap to lower-poly meshes sooner. Unity default is 1.0.");
		disableantialiasing = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", "DisableAntiAliasing", true, "disables msaa.");
		reducetexturequality = ((BaseUnityPlugin)this).Config.Bind<bool>("Rendering", "ReduceTextureQuality", false, "lowers texture resolution in half. good if you have low VRAM.");
		maxparticles = ((BaseUnityPlugin)this).Config.Bind<int>("Particles", "MaxParticles", 500, "the cap for particle systems");
		unlockframerate = ((BaseUnityPlugin)this).Config.Bind<bool>("Framerate", "UnlockFramerate", true, "Removes vsync and any fps cap.");
		targetframerate = ((BaseUnityPlugin)this).Config.Bind<int>("Framerate", "TargetFramerate", 0, "0 = unlimited.");
		sleepthreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Physics", "SleepThreshold", 0.14f, "ragdolls sleep sooner. Unity default is 0.005.");
		enableunitculling = ((BaseUnityPlugin)this).Config.Bind<bool>("UnitCulling", "Enable", true, "disable animators on units far from the camera.");
		removedeadbodies = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "RemoveDeadBodies", false, "destroys units after death.");
		animatorcullrange = ((BaseUnityPlugin)this).Config.Bind<float>("UnitCulling", "CullRange", 35f, "units beyond this distance get their animator disabled.");
		enableparticleculling = ((BaseUnityPlugin)this).Config.Bind<bool>("ParticleCulling", "Enable", true, "destroy off screen particle systems.");
		particlecullrange = ((BaseUnityPlugin)this).Config.Bind<float>("ParticleCulling", "CullRange", 60f, "particle systems beyond this distance are destroyed.");
		enablecameraopt = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "Enable", true, "reduce camera far clip plane during battles.");
		camerafarclip = ((BaseUnityPlugin)this).Config.Bind<float>("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<GUILayoutOption>());
		}
	}

	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<GUILayoutOption>());
		GUILayout.Label("May not fully disable all optimizations. You may need to fully disable the mod via your mod manager.", val, Array.Empty<GUILayoutOption>());
		if (flag != enablemod.Value)
		{
			enablemod.Value = flag;
			((BaseUnityPlugin)this).Config.Save();
		}
		GUILayout.Space(8f);
		GUILayout.Label("Optimizations", Array.Empty<GUILayoutOption>());
		removedeadbodies.Value = GUILayout.Toggle(removedeadbodies.Value, "Remove dead bodies", Array.Empty<GUILayoutOption>());
		GUILayout.Label("Don't use remove dead bodies if you're using 'Hide the Evidence' mod", val, Array.Empty<GUILayoutOption>());
		enableunitculling.Value = GUILayout.Toggle(enableunitculling.Value, "Hide distant animations", Array.Empty<GUILayoutOption>());
		enableparticleculling.Value = GUILayout.Toggle(enableparticleculling.Value, "Hide/cull off-screen particles", Array.Empty<GUILayoutOption>());
		enablecameraopt.Value = GUILayout.Toggle(enablecameraopt.Value, "Reduce render distance", Array.Empty<GUILayoutOption>());
		disableantialiasing.Value = GUILayout.Toggle(disableantialiasing.Value, "Disable anti-aliasing", Array.Empty<GUILayoutOption>());
		reducetexturequality.Value = GUILayout.Toggle(reducetexturequality.Value, "Reduce texture quality", Array.Empty<GUILayoutOption>());
		unlockframerate.Value = GUILayout.Toggle(unlockframerate.Value, "Unlock framerate", Array.Empty<GUILayoutOption>());
		GUILayout.Space(8f);
		GUILayout.Label("Optimizing-Level Preset", Array.Empty<GUILayoutOption>());
		GUILayout.Label("Presets for optimizations & advanced settings", val, Array.Empty<GUILayoutOption>());
		GUILayout.Label("Higher-end presets", val, Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Toggle(selectedpreset == 4, "Great", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 4;
		}
		if (GUILayout.Toggle(selectedpreset == 5, "Super", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 5;
		}
		if (GUILayout.Toggle(selectedpreset == 6, "MYY PC", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 6;
		}
		GUILayout.EndHorizontal();
		GUILayout.Label("Default", val, Array.Empty<GUILayoutOption>());
		if (GUILayout.Toggle(selectedpreset == 7, "Unity default", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 7;
		}
		GUILayout.Label("Lower-end presets", val, Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Toggle(selectedpreset == 0, "Low", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 0;
		}
		if (GUILayout.Toggle(selectedpreset == 1, "Very low", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 1;
		}
		if (GUILayout.Toggle(selectedpreset == 2, "Potato", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 2;
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Toggle(selectedpreset == 3, "Absolute Lowest", GUI.skin.button, Array.Empty<GUILayoutOption>()))
		{
			selectedpreset = 3;
		}
		GUILayout.EndHorizontal();
		GUILayout.Label("Preset summary:  shadows: " + shadowquality.Value + "  rend. dist: " + shadowdistance.Value + "  lod: " + lodbias.Value, val, Array.Empty<GUILayoutOption>());
		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<GUILayoutOption>());
		GUILayout.Space(8f);
		if (GUILayout.Button("Apply Preset", Array.Empty<GUILayoutOption>()))
		{
			dothepreset(selectedpreset);
			basicsettingspartboooooo();
			((BaseUnityPlugin)this).Config.Save();
		}
		GUILayout.Label("Applying takes some time to update. Give it a few seconds.", val, Array.Empty<GUILayoutOption>());
		GUILayout.Space(4f);
		KeyCode value = menukey.Value;
		GUILayout.Label("Press " + ((object)(KeyCode)(ref value)).ToString() + " to close.", Array.Empty<GUILayoutOption>());
		GUILayout.Space(8f);
		showadvanced = GUILayout.Toggle(showadvanced, "Advanced mode", Array.Empty<GUILayoutOption>());
		if (showadvanced)
		{
			GUILayout.Label("Shadow quality (0:off, 1:hard, 2:soft)" + shadowquality.Value, Array.Empty<GUILayoutOption>());
			shadowquality.Value = (int)GUILayout.HorizontalSlider((float)shadowquality.Value, 0f, 2f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Shadow distance: " + shadowdistance.Value.ToString("F0"), Array.Empty<GUILayoutOption>());
			shadowdistance.Value = GUILayout.HorizontalSlider(shadowdistance.Value, 10f, 1000f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("LOD bias: " + lodbias.Value.ToString("F2"), Array.Empty<GUILayoutOption>());
			lodbias.Value = GUILayout.HorizontalSlider(lodbias.Value, 0.1f, 2.5f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Max particles: " + maxparticles.Value, Array.Empty<GUILayoutOption>());
			maxparticles.Value = (int)GUILayout.HorizontalSlider((float)maxparticles.Value, 50f, 5000f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Animator cull range: " + animatorcullrange.Value.ToString("F0"), Array.Empty<GUILayoutOption>());
			animatorcullrange.Value = GUILayout.HorizontalSlider(animatorcullrange.Value, 5f, 900f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Particle cull range: " + particlecullrange.Value.ToString("F0"), Array.Empty<GUILayoutOption>());
			particlecullrange.Value = GUILayout.HorizontalSlider(particlecullrange.Value, 5f, 900f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Camera far clip: " + camerafarclip.Value.ToString("F0"), Array.Empty<GUILayoutOption>());
			camerafarclip.Value = GUILayout.HorizontalSlider(camerafarclip.Value, 50f, 1500f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Sleep threshold: " + sleepthreshold.Value.ToString("F3"), Array.Empty<GUILayoutOption>());
			sleepthreshold.Value = GUILayout.HorizontalSlider(sleepthreshold.Value, 0.001f, 1f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Unlike other settings, sleep threshold is more optimized at higher values, not lower. Default is 0.005.", Array.Empty<GUILayoutOption>());
			removedeadbodies.Value = GUILayout.Toggle(removedeadbodies.Value, "Remove dead bodies", Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			if (GUILayout.Button("Apply advanced", Array.Empty<GUILayoutOption>()))
			{
				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(<cullingloop>d__30))]
	private IEnumerator cullingloop()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <cullingloop>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);
		}
	}
}