Decompiled source of NoMineSounds v1.0.0

NoMines.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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: AssemblyTitle("NoMines")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoMines")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ac1767c5-6278-455e-ae68-42c1d0343508")]
[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 NoMines;

[BepInPlugin("MonkeySaint.NoMineSounds", "No Mine Sounds", "0.1")]
[BepInProcess("Lethal Company.exe")]
public class NoMines : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Landmine))]
	private class LandminePatchh
	{
		private static float oldVolume;

		private static float oldFarVolume;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void muteMineSound(ref AudioSource ___mineAudio, ref AudioSource ___mineFarAudio)
		{
			oldVolume = ___mineAudio.volume;
			oldFarVolume = ___mineFarAudio.volume;
			___mineAudio.volume = 0f;
			___mineFarAudio.volume = 0f;
		}

		[HarmonyPatch("Detonate")]
		[HarmonyPostfix]
		public static void unmuteMineSound(ref AudioSource ___mineAudio, ref AudioSource ___mineFarAudio)
		{
			___mineAudio.volume = oldVolume;
			___mineFarAudio.volume = oldFarVolume;
		}
	}

	private const string modGUID = "MonkeySaint.NoMineSounds";

	private const string modName = "No Mine Sounds";

	private const string modVersion = "0.1";

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("MonkeySaint.NoMineSounds");
		val.PatchAll();
	}
}