Decompiled source of NoButlerHornets v1.0.1

EnoPM.NoButlerHornets.dll

Decompiled 2 months ago
using System;
using System.Collections;
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 Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EnoPM")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A Lethal Company mod that removes the mask hornets that appear when a Butler dies")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+75a2c6cf6d38d543d0f983129d40d706eeb5846a")]
[assembly: AssemblyProduct("NoButlerHornets")]
[assembly: AssemblyTitle("EnoPM.NoButlerHornets")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 EnoPM.NoButlerHornets
{
	[BepInPlugin("nobutlerhornets.lc.eno.pm", "NoButlerHornets", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private static readonly Harmony HarmonyPatcher = new Harmony("nobutlerhornets.lc.eno.pm");

		private void Awake()
		{
			HarmonyPatcher.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin nobutlerhornets.lc.eno.pm is loaded!");
		}
	}
	internal static class ProjectInfos
	{
		internal const string Guid = "nobutlerhornets.lc.eno.pm";

		internal const string Name = "NoButlerHornets";

		internal const string Version = "1.0.1";
	}
}
namespace EnoPM.NoButlerHornets.Patches
{
	[HarmonyPatch(typeof(ButlerEnemyAI))]
	internal static class ButlerEnemyAIPatches
	{
		private static readonly int Popping = Animator.StringToHash("Popping");

		private static readonly int PopFinish = Animator.StringToHash("popFinish");

		[HarmonyPrefix]
		[HarmonyPatch("ButlerBlowUpAndPop")]
		private static bool ButlerBlowUpAndPopPrefix(ButlerEnemyAI __instance, out IEnumerator __result)
		{
			__result = __instance.CoButlerBlowUpAndPop();
			return false;
		}

		private static IEnumerator CoButlerBlowUpAndPop(this ButlerEnemyAI butlerEnemyAi)
		{
			((EnemyAI)butlerEnemyAi).creatureAnimator.SetTrigger(Popping);
			((EnemyAI)butlerEnemyAi).creatureAnimator.SetLayerWeight(1, 0f);
			butlerEnemyAi.popAudio.PlayOneShot(((EnemyAI)butlerEnemyAi).enemyType.audioClips[3]);
			yield return (object)new WaitForSeconds(1.1f);
			((EnemyAI)butlerEnemyAi).creatureAnimator.SetBool(PopFinish, true);
			butlerEnemyAi.popAudio.Play();
			butlerEnemyAi.popAudioFar.Play();
			butlerEnemyAi.popParticle.Play(true);
			float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)butlerEnemyAi).transform.position);
			if ((double)num < 8.0)
			{
				Landmine.SpawnExplosion(((Component)butlerEnemyAi).transform.position + Vector3.up * 0.15f, false, 0f, 2f, 30, 80f, (GameObject)null, false);
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
				SoundManager.Instance.earsRingingTimer = 0.8f;
			}
			else if ((double)num < 27.0)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			if (((NetworkBehaviour)butlerEnemyAi).IsServer)
			{
				Object.Instantiate<GameObject>(butlerEnemyAi.knifePrefab, ((Component)butlerEnemyAi).transform.position + Vector3.up * 0.5f, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer).GetComponent<NetworkObject>().Spawn(false);
			}
		}
	}
}