Decompiled source of RemoveMouthEnemy v1.1.0

com.github.zehsteam.RemoveMouthEnemy.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using com.github.zehsteam.RemoveMouthEnemy.Extensions;
using com.github.zehsteam.RemoveMouthEnemy.Helpers;
using com.github.zehsteam.RemoveMouthEnemy.Patches;

[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("Zehs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 Zehs")]
[assembly: AssemblyDescription("Removes the Slow Mouth (Spewer) enemy.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+03b04fa281bb22a8ca72456c7f248a1f0d50660c")]
[assembly: AssemblyProduct("RemoveMouthEnemy")]
[assembly: AssemblyTitle("com.github.zehsteam.RemoveMouthEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 com.github.zehsteam.RemoveMouthEnemy
{
	[BepInPlugin("com.github.zehsteam.RemoveMouthEnemy", "RemoveMouthEnemy", "1.1.0")]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.zehsteam.RemoveMouthEnemy");

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			Instance = this;
			Logger = Logger.CreateLogSource("com.github.zehsteam.RemoveMouthEnemy");
			Logger.LogInfo((object)"RemoveMouthEnemy has awoken!");
			_harmony.PatchAll(typeof(EnemyDirectorPatch));
			_harmony.PatchAll(typeof(LevelGeneratorPatch));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.RemoveMouthEnemy";

		public const string PLUGIN_NAME = "RemoveMouthEnemy";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace com.github.zehsteam.RemoveMouthEnemy.Patches
{
	[HarmonyPatch(typeof(EnemyDirector))]
	internal static class EnemyDirectorPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			EnemyHelper.RemoveMouthEnemyFromList(ref EnemyDirector.instance.enemiesDifficulty1);
			EnemyHelper.RemoveMouthEnemyFromList(ref EnemyDirector.instance.enemiesDifficulty2);
			EnemyHelper.RemoveMouthEnemyFromList(ref EnemyDirector.instance.enemiesDifficulty3);
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	internal static class LevelGeneratorPatch
	{
		[HarmonyPatch("EnemySpawn")]
		[HarmonyPrefix]
		private static bool EnemySpawnPatch(ref EnemySetup enemySetup)
		{
			if (enemySetup.IsMouthEnemy())
			{
				Plugin.Logger.LogInfo((object)"Prevented mouth enemy from spawning.");
				return false;
			}
			return true;
		}
	}
}
namespace com.github.zehsteam.RemoveMouthEnemy.Helpers
{
	internal static class EnemyHelper
	{
		public static void RemoveMouthEnemyFromList(ref List<EnemySetup> list)
		{
			list = list.Where((EnemySetup enemySetup) => !enemySetup.IsMouthEnemy()).ToList();
		}
	}
}
namespace com.github.zehsteam.RemoveMouthEnemy.Extensions
{
	internal static class EnemySetupExtensions
	{
		public static bool IsMouthEnemy(this EnemySetup enemySetup)
		{
			if ((Object)(object)enemySetup == (Object)null)
			{
				return false;
			}
			return ((Object)enemySetup).name == "Enemy - Slow Mouth";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}