Decompiled source of VoidMOLE v3.0.0

plugins/VoidMOLE/VoidMOLE.dll

Decompiled 2 weeks ago
using System;
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 EquinoxsModUtils;
using HarmonyLib;
using UnityEngine;
using VoidMOLE.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("VoidMOLE")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VoidMOLE")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5e2a5319-de6a-4d7e-b47f-511570bcd808")]
[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")]
namespace VoidMOLE
{
	[BepInPlugin("com.equinox.VoidMOLE", "VoidMOLE", "3.0.0")]
	public class VoidMOLEPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "com.equinox.VoidMOLE";

		private const string PluginName = "VoidMOLE";

		private const string VersionString = "3.0.0";

		private static readonly Harmony Harmony = new Harmony("com.equinox.VoidMOLE");

		public static ManualLogSource Log = new ManualLogSource("VoidMOLE");

		private const string voidLimestoneKey = "Void Limestone";

		public static ConfigEntry<bool> voidLimestone;

		private void Awake()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			voidLimestone = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Void Limestone", true, new ConfigDescription("Whether to void Limestone when using the M.O.L.E or Mining Charges", (AcceptableValueBase)null, Array.Empty<object>()));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: VoidMOLE, VersionString: 3.0.0 is loading...");
			Harmony.PatchAll();
			Harmony.CreateAndPatchAll(typeof(MOLEActionPatch), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: VoidMOLE, VersionString: 3.0.0 is loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}
	}
}
namespace VoidMOLE.Patches
{
	internal class MOLEActionPatch
	{
		private static ResourceInfo limestone;

		[HarmonyPatch(typeof(MOLEAction), "PostTerrainManipulationHelper")]
		[HarmonyPrefix]
		private static void VoidLimestone(ref DigResultInfo digResultInfo)
		{
			if ((Object)(object)limestone == (Object)null)
			{
				limestone = Resources.GetResourceInfoByName("Limestone", false);
			}
			if (digResultInfo.resourceCounts.ContainsKey(limestone))
			{
				digResultInfo.resourceCounts.Remove(limestone);
			}
		}
	}
}