diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d3413..6e38bd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,3 +62,7 @@ - Fixed the right-click confirmation always showing "No answer, not refreshing songs" even after successfully confirming, due to a timing check that ran before the confirmation window instead of after. - Fixed an error (NullReferenceException) every time a thrown item bonked something: `Bonkable` added at runtime has no serialized prefab data, so its sound-effect array was `null` instead of empty. It now defaults to an empty array so bonks still ragdoll/knock back the target, just silently. +# v0.1.12 | Added customization keybinds + +- Open the passport when pressing the "Open Passport" keybind (default: P) +- Removed a leftover debug keybind on the BingBong module that was also bound to P and would have fired alongside the new passport keybind. diff --git a/src/JordanMod/ConfigHandler.cs b/src/JordanMod/ConfigHandler.cs index b9148ad..98984a6 100644 --- a/src/JordanMod/ConfigHandler.cs +++ b/src/JordanMod/ConfigHandler.cs @@ -13,6 +13,9 @@ public static class ConfigHandler // Better Airport public static ConfigEntry ConveyorSpeedModifier { get; private set; } = null!; + // Open Passport settings + public static ConfigEntry OpenPassport { get; private set; } = null!; + // Stashed Bugle settings public static ConfigEntry ToggleBugle { get; private set; } = null!; @@ -49,6 +52,14 @@ public static class ConfigHandler ) ); + // Open Passport settings + OpenPassport = Config.Bind( + "Key Bindings", + "OpenPassport", + KeyCode.P, + new ConfigDescription("Open Passport UI") + ); + // Stashed Bugle settings ToggleBugle = Config.Bind( "Control", diff --git a/src/JordanMod/JordanMod.csproj b/src/JordanMod/JordanMod.csproj index 0c997c9..e43c6f8 100644 --- a/src/JordanMod/JordanMod.csproj +++ b/src/JordanMod/JordanMod.csproj @@ -8,7 +8,7 @@ JordanMod - 0.1.11 + 0.1.12 diff --git a/src/JordanMod/modules/open_passport/OpenPassportModule.cs b/src/JordanMod/modules/open_passport/OpenPassportModule.cs new file mode 100644 index 0000000..a68ceb4 --- /dev/null +++ b/src/JordanMod/modules/open_passport/OpenPassportModule.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; + +namespace JordanMod.Modules.OpenPassport; + +[Module(Enabled = true)] +class OpenPassportModule : Module +{ + public override string ModuleName => "Open Passport Module"; + + public override Type[] GetPatches() { return []; } + + public override void Update() + { + if (!Input.GetKeyDown(ConfigHandler.OpenPassport.Value)) return; + + // PassportManager.instance is a plain static that survives a scene unload, so it can + // be a destroyed object here; the Unity == operator is what catches that. Its + // Initialize() also reads Character.localCharacter.characterName, so don't open it + // before we have a character. + PassportManager passportManager = PassportManager.instance; + if (passportManager == null) return; + if (Character.localCharacter == null) return; + if (passportManager.isOpen) return; + + passportManager.ToggleOpen(); + } +} diff --git a/src/JordanMod/modules/replace_bingbong/ReplaceBingBongModule.cs b/src/JordanMod/modules/replace_bingbong/ReplaceBingBongModule.cs index 77b4fd4..780720a 100644 --- a/src/JordanMod/modules/replace_bingbong/ReplaceBingBongModule.cs +++ b/src/JordanMod/modules/replace_bingbong/ReplaceBingBongModule.cs @@ -27,17 +27,6 @@ class ReplaceBingBongModule : Module AudioSyncWorker.OnAudioLoadComplete += OnAudioLoadComplete; } - public override void Update() - { - base.Update(); - if (Input.GetKeyDown(KeyCode.P)) - { - Helper.FindItemByName("BingBong_Prop Variant", out Item? item); - if (item == null) return; - Debug.Log($"Found item: {item.name} in scene {item.gameObject.scene.name}"); - } - } - private static void OnAudioLoadComplete() { if (!HasReplacedSounds) return;