Decompiled source of RocketWorm v1.0.0

RocketWorm/RocketWorm.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using RocketWorm.Patches;
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("RocketWorm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RocketWorm")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f4754836-a60f-4577-9483-c0a2689a9eeb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RocketWorm
{
	[BepInPlugin("beef_gristle.RocketWorm", "Rocket Worm", "1.0.0")]
	public class RocketWormBase : BaseUnityPlugin
	{
		private const string modGUID = "beef_gristle.RocketWorm";

		private const string modName = "Rocket Worm";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("beef_gristle.RocketWorm");

		private static RocketWormBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("beef_gristle.RocketWorm");
			mls.LogInfo((object)"Starting Rocket Worm");
			mls.LogInfo((object)(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("RocketWorm.dll".ToCharArray()) + "rocketman"));
			AssetBundle val = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("RocketWorm.dll".ToCharArray()) + "rocketman");
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("rocketman.mp3");
			harmony.PatchAll(typeof(SandWormAIPatch));
			mls.LogInfo((object)"Rocket Worm has reached touchdown");
			harmony.PatchAll(typeof(RocketWormBase));
		}
	}
}
namespace RocketWorm.Patches
{
	[HarmonyPatch(typeof(SandWormAI))]
	internal class SandWormAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void RocketWormPatch(ref AudioClip ___emergeFromGroundSFX)
		{
			AudioClip[] newSFX = RocketWormBase.newSFX;
			if (newSFX != null && newSFX.Length != 0)
			{
				AudioClip val = newSFX[0];
				___emergeFromGroundSFX = val;
			}
		}
	}
}