Decompiled source of Fart Mine v1.0.0

FartMine.dll

Decompiled a day ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("FartMine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FartMine")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e2a18287-7640-480f-aa96-d35a66bb4cba")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FartMine
{
	[BepInPlugin("Eteli.FartMine", "Fart Mine", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "Eteli.FartMine";

		public const string modName = "Fart Mine";

		public const string modVersion = "0.0.1";

		private static Harmony _harmony;

		internal static ManualLogSource Log;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		public void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Eteli.FartMine has awoken!");
			_harmony = new Harmony("Eteli.FartMine");
			_harmony.PatchAll();
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)this).Info.Location;
			location = location.TrimEnd("FartMine.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "fartmine");
			if ((Object)(object)Bundle != (Object)null)
			{
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
				Log.LogInfo((object)"Successfully loaded thge asset bundle");
				Log.LogInfo((object)$"Loaded {SoundFX.Count} sound effects");
			}
			else
			{
				Log.LogError((object)"Failed to load asset bundle!");
			}
		}
	}
}
namespace FartMine.Patches
{
	[HarmonyPatch(typeof(ItemMineExplosive), "Start")]
	public class ItemMineExplosivePatch
	{
		[HarmonyPostfix]
		public static void Postfix(ItemMineExplosive __instance, ParticleScriptExplosion ___particleScriptExplosion)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogInfo((object)"Mine triggered! :)");
			Plugin.Log.LogInfo((object)$"Position: {((Component)__instance).transform.position}");
			___particleScriptExplosion.explosionPreset.explosionSoundBig.Sounds = Plugin.SoundFX.ToArray();
			___particleScriptExplosion.explosionPreset.explosionSoundBigGlobal.Sounds = Plugin.SoundFX.ToArray();
		}
	}
}