Decompiled source of LC Masked Fix v0.0.2

BepInEx/plugins/LC_Masked_Fix.dll

Decompiled a year 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 LC_MIMICFIX.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LC_MIMICFIX")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_MIMICFIX")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("52a8c306-f1df-46d3-a634-8db137e227d7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LC_MIMICFIX
{
	[BepInPlugin("kuba6000.LC_MimicFixMod", "LC_Masked_Fix", "0.0.2")]
	public class LC_MimicFixMod : BaseUnityPlugin
	{
		private const string ModGUID = "kuba6000.LC_MimicFixMod";

		private const string ModName = "LC_Masked_Fix";

		private const string ModVersion = "0.0.2";

		private readonly Harmony harmony = new Harmony("kuba6000.LC_MimicFixMod");

		public static LC_MimicFixMod instance;

		internal ManualLogSource log;

		private void Awake()
		{
			instance = this;
			log = Logger.CreateLogSource("kuba6000.LC_MimicFixMod");
			log.LogInfo((object)"Mimic Fix Awaken!");
			log.LogInfo((object)"V47/48/49 - Fixes red screen overlay / vomit screen after the kill is inturrupted");
			log.LogInfo((object)"V45 - Fixes stuck screen after interrupting the kill animation");
			log.LogInfo((object)"Patching MaskedPlayerEnemy");
			harmony.PatchAll(typeof(LC_MimicFixMod));
			harmony.PatchAll(typeof(MaskedPlayerEnemyPatch));
		}
	}
}
namespace LC_MIMICFIX.Patches
{
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	internal class MaskedPlayerEnemyPatch
	{
		[HarmonyPatch("CancelSpecialAnimationWithPlayer")]
		[HarmonyPrefix]
		private static bool CancelSpecialAnimationWithPlayerPatch(MaskedPlayerEnemy __instance)
		{
			if ((Object)(object)((EnemyAI)__instance).inSpecialAnimationWithPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				LC_MimicFixMod.instance.log.LogInfo((object)"Removing biohazardDamage animation");
				HUDManager.Instance.HUDAnimator.SetBool("biohazardDamage", false);
				HUDManager.Instance.HideHUD(true);
				HUDManager.Instance.HideHUD(false);
			}
			__instance.FinishKillAnimation(false);
			((EnemyAI)__instance).inSpecialAnimationWithPlayer = null;
			return false;
		}
	}
}