Decompiled source of Dislodge Key v1.0.0

Mods/DislodgeKey.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using DislodgeKey;
using HarmonyLib;
using Il2CppSLZ.Interaction;
using MelonLoader;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(global::DislodgeKey.DislodgeKey), "DislodgeKey", "1.0.0", "Bhijn", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonAuthorColor(255, 198, 119, 230)]
[assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })]
[assembly: AssemblyDescription("Fixes the bug that causes keys and void canisters to be permanently stuck")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DislodgeKey")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DislodgeKey")]
[assembly: AssemblyTitle("DislodgeKey")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 DislodgeKey
{
	public class DislodgeKey : MelonMod
	{
		[HarmonyPatch(typeof(KeyReceiver))]
		public class KeyReceiverPatch
		{
			[HarmonyPatch("OnInteractableHostExit")]
			[HarmonyPrefix]
			public static void OnInteractibleHostExit(KeyReceiver __instance)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Invalid comparison between Unknown and I4
				Console.WriteLine("OnInteractibleHostExit");
				if ((int)__instance._State == 2)
				{
					__instance._State = (_States)0;
				}
			}

			[HarmonyPatch("OnMagazineGrabbed")]
			[HarmonyPostfix]
			public static void OnMagazineGrabbed(KeyReceiver __instance)
			{
				__instance._State = (_States)2;
			}
		}

		[HarmonyPatch(typeof(KeycardReceiver))]
		public class KeycardReceiverPatch
		{
			[HarmonyPatch("OnInteractableHostExit")]
			[HarmonyPrefix]
			public static void OnInteractibleHostExit(KeycardReceiver __instance)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Invalid comparison between Unknown and I4
				if ((int)__instance._State == 2)
				{
					__instance._State = (_States)0;
				}
			}

			[HarmonyPatch("OnMagazineGrabbed")]
			[HarmonyPostfix]
			public static void OnMagazineGrabbed(KeycardReceiver __instance)
			{
				__instance._State = (_States)2;
			}
		}

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("Initialized.");
		}
	}
}