Decompiled source of HolyAxel v1.0.0

HolyAxel.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HolyAxel")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HolyAxel")]
[assembly: AssemblyTitle("HolyAxel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HolyAxel
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch
	{
		[HarmonyPatch("OnHitGround")]
		[HarmonyPostfix]
		private static void CallDogs(GrabbableObject __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.itemProperties.itemName == "Large axle")
			{
				HolyAxelPlugin.Instance.CallDogs(((Component)__instance).transform.position);
			}
		}
	}
	[BepInPlugin("co.tantleffbeef.holyaxel", "HolyAxel", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Lethal Company.exe")]
	public class HolyAxelPlugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("co.tantleffbeef.holyaxel");

		private readonly List<MouthDogAI> _mouthDogs = new List<MouthDogAI>();

		public static HolyAxelPlugin Instance { get; private set; }

		public void RegisterDog(MouthDogAI mouthDog)
		{
			_mouthDogs.Add(mouthDog);
		}

		public void CallDogs(Vector3 position)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			foreach (MouthDogAI mouthDog in _mouthDogs)
			{
				((EnemyAI)mouthDog).SetDestinationToPosition(position, false);
			}
		}

		public void UnregisterDog(MouthDogAI mouthDog)
		{
			_mouthDogs.Remove(mouthDog);
		}

		private void Awake()
		{
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HolyAxel is loaded!");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	[HarmonyPatch(typeof(MouthDogAI))]
	internal class MouthDogAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void RegisterDog(MouthDogAI __instance)
		{
			((Component)__instance).gameObject.AddComponent<MouthDogDestroyHook>();
			HolyAxelPlugin.Instance.RegisterDog(__instance);
		}
	}
	public class MouthDogDestroyHook : MonoBehaviour
	{
		private void OnDestroy()
		{
			MouthDogAI component = ((Component)this).GetComponent<MouthDogAI>();
			if (component != null)
			{
				HolyAxelPlugin.Instance.UnregisterDog(component);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "HolyAxel";

		public const string PLUGIN_NAME = "HolyAxel";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}