Decompiled source of LessMist v0.1.1

LessMist.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShipSpeed;

[BepInPlugin("jhedin.LessMist", "Less Mist", "0.1.1")]
public class BepInExPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(MistEmitter), "SetEmit")]
	private static class Awake_Patch
	{
		private static void Postfix(ref float ___m_interval)
		{
			___m_interval = mistFrequency.Value;
		}
	}

	private static readonly bool isDebug = true;

	private static BepInExPlugin context;

	private static ConfigEntry<bool> modEnabled;

	private static ConfigEntry<float> mistFrequency;

	private Harmony harmony;

	public static void Dbgl(string str = "", bool pref = true)
	{
		if (isDebug)
		{
			Debug.Log((object)((pref ? (typeof(BepInExPlugin).Namespace + " ") : "") + str));
		}
	}

	private void Awake()
	{
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		context = this;
		modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod");
		mistFrequency = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Frequency that mist is created", 1f, (ConfigDescription)null);
		if (modEnabled.Value)
		{
			harmony = new Harmony("jhedin.LessMist");
			harmony.PatchAll();
		}
	}

	private void OnDestroy()
	{
		Dbgl("Destroying plugin");
		harmony.UnpatchAll((string)null);
	}
}