Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Jetpack SlotUnlocker v1.1.0
JetpackSlotUnlocker.dll
Decompiled 8 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; 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("JetpackSlotUnlocker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JetpackSlotUnlocker")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c7ff8459-89cd-4178-9584-503b64fef26d")] [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 JetpackSlotUnlocker; [BepInPlugin("com.yourname.jetpackunlocker", "Jetpack Slot Unlocker", "1.1.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "com.yourname.jetpackunlocker"; public const string modName = "Jetpack Slot Unlocker"; public const string modVersion = "1.1.0"; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.yourname.jetpackunlocker"); val.PatchAll(typeof(Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Jetpack Slot Unlocker v1.1 loaded!"); } } public static class Patches { private static bool wasJetpackActive; private static float deactivateTime; [HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")] [HarmonyPrefix] public static bool ScrollMousePrefix(PlayerControllerB __instance) { if (__instance.jetpackControls || __instance.disablingJetpackControls) { __instance.jetpackControls = false; __instance.disablingJetpackControls = false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")] [HarmonyPrefix] public static bool InteractPrefix(PlayerControllerB __instance) { if (__instance.jetpackControls || __instance.disablingJetpackControls) { __instance.jetpackControls = false; __instance.disablingJetpackControls = false; } return true; } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPrefix] public static void SwitchToItemSlotPrefix(PlayerControllerB __instance) { wasJetpackActive = __instance.jetpackControls; if (wasJetpackActive) { __instance.jetpackControls = false; __instance.disablingJetpackControls = true; deactivateTime = Time.time; if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && ((object)__instance.currentlyHeldObjectServer).GetType().Name == "JetpackItem") { Traverse.Create((object)__instance.currentlyHeldObjectServer).Method("DeactivateJetpack", Array.Empty<object>()).GetValue(); } } } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] public static void SwitchToItemSlotPostfix(PlayerControllerB __instance) { if (wasJetpackActive && !__instance.twoHanded && !(Time.time - deactivateTime < 0.2f)) { __instance.jetpackControls = true; __instance.disablingJetpackControls = false; if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && ((object)__instance.currentlyHeldObjectServer).GetType().Name == "JetpackItem") { Traverse.Create((object)__instance.currentlyHeldObjectServer).Method("ActivateJetpack", Array.Empty<object>()).GetValue(); } } } }