Decompiled source of No Bees v1.0.0

NoBees.dll

Decompiled 5 months ago
using System;
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 NoBees.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("NoBees")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoBees")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("707c8298-28de-4fe7-91a3-e1e16fd4f21d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoBees
{
	[BepInPlugin("SpiralMods.NoBees", "NoBees", "1.0.1")]
	public class NoBeesBase : BaseUnityPlugin
	{
		private const string modGUID = "SpiralMods.NoBees";

		private const string modName = "NoBees";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("SpiralMods.NoBees");

		private static NoBeesBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("SpiralMods.NoBees");
			mls.LogInfo((object)"NoBees has loaded (ModVersion: 1.0.1, ModGUID: SpiralMods.NoBees)!");
			harmony.PatchAll(typeof(RedLocustBeesPatch));
		}
	}
}
namespace NoBees.Patches
{
	[HarmonyPatch(typeof(RedLocustBees))]
	internal class RedLocustBeesPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void patchUpdate()
		{
			if (GameNetworkManager.Instance.isHostingGame)
			{
				RedLocustBees val = Object.FindObjectOfType<RedLocustBees>();
				((EnemyAI)val).enemyType.canDie = true;
				((EnemyAI)val).KillEnemyClientRpc(true);
				((EnemyAI)val).KillEnemyOnOwnerClient(true);
				Console.Write("A hive has been deleted. ");
				Object.DestroyImmediate((Object)(object)val);
				Object.DestroyImmediate((Object)(object)val);
			}
		}
	}
}