Decompiled source of DeeperMeltdown v1.0.4

DeeperMeltdown.dll

Decompiled 6 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using DeeperMeltdown.Patches;
using FacilityMeltdown.API;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DeeperMeltdown")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeeperMeltdown")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8df10666-6c47-4d1e-990a-456987f2b8e2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DeeperMeltdown
{
	[BepInPlugin("Rytix.DeeperMeltdown", "The Facility is under an LOCKDOWN", "1.0.0.0")]
	public class DeeperMeltdownBase : BaseUnityPlugin
	{
		private const string modGUID = "Rytix.DeeperMeltdown";

		private const string modName = "The Facility is under an LOCKDOWN";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Rytix.DeeperMeltdown");

		private static DeeperMeltdownBase Instance;

		private void Awake()
		{
			if (Instance == null)
			{
				Instance = this;
			}
			harmony.PatchAll(typeof(DeeperMeltdownBase));
			harmony.PatchAll(typeof(EntranceTeleportPatch));
			harmony.PatchAll(typeof(HUDManagerPatch));
		}
	}
}
namespace DeeperMeltdown.Patches
{
	[HarmonyPatch(typeof(HUDManager))]
	internal class HUDManagerPatch : HarmonyPatch
	{
		[HarmonyPatch("DisplayTip")]
		[HarmonyPostfix]
		public static void DisplayTipPostfix(string headerText, string bodyText, bool isWarning = false, bool useSave = false, string prefsKey = "LC_Tip1")
		{
		}
	}
	[HarmonyPatch(typeof(EntranceTeleport))]
	internal class EntranceTeleportPatch : HarmonyPatch
	{
		public static bool MeltdownStarted => MeltdownAPI.MeltdownStarted;

		[HarmonyPatch("TeleportPlayer")]
		[HarmonyPrefix]
		public static bool TeleportPlayerPrefix(bool ___isEntranceToBuilding, int ___entranceId, bool ___gotExitPoint)
		{
			if (___gotExitPoint && ___entranceId != 0 && ___isEntranceToBuilding && MeltdownStarted)
			{
				HUDManager.Instance.DisplayTip("???", "Facility under LOCKDOWN, exit only.", false, false, "LC_Tip1");
				return false;
			}
			if (___entranceId == 0 && !___isEntranceToBuilding && MeltdownStarted)
			{
				HUDManager.Instance.DisplayTip("???", "Facility under LOCKDOWN", false, false, "LC_Tip1");
				return false;
			}
			if (___entranceId == 0 && ___isEntranceToBuilding && MeltdownStarted)
			{
				HUDManager.Instance.DisplayTip("???", "Facility under LOCKDOWN", false, false, "LC_Tip1");
				return false;
			}
			return true;
		}

		[HarmonyPatch("FindExitPoint")]
		[HarmonyPostfix]
		public static void FindExitPointPostfix(bool ___isEntranceToBuilding, int ___entranceId, bool ___gotExitPoint, ref bool __result)
		{
			if (___gotExitPoint && ___entranceId != 0 && ___isEntranceToBuilding && MeltdownStarted)
			{
				HUDManager.Instance.DisplayTip("???", "Facility under LOCKDOWN, exit only.", false, false, "LC_Tip1");
				__result = false;
			}
			if (___entranceId == 0 && !___isEntranceToBuilding && MeltdownStarted)
			{
				HUDManager.Instance.DisplayTip("???", "Facility under LOCKDOWN", false, false, "LC_Tip1");
				__result = false;
			}
			else if (___entranceId == 0 && ___isEntranceToBuilding && MeltdownStarted)
			{
				HUDManager.Instance.DisplayTip("???", "Facility under LOCKDOWN", false, false, "LC_Tip1");
				__result = false;
			}
		}
	}
}