Fix binds without modifiers not matching while sprinting or crouching - #6671
Open
sandwichmm wants to merge 1 commit into
Open
sandwichmm wants to merge 1 commit into
sandwichmm wants to merge 1 commit into
Conversation
…king holds Shift and sprinting holds Ctrl, which caused everyplain keybind to stop matching while sprinting or crouching.Keybind#matches no longer rejects a no-modifier bind just because amodifier is currently held; Modules#onAction now handles precedencebetween plain and chorded binds instead, so Ctrl+G still only firesthe chorded module.(Apologies i accidentally wiped the previous commit) Fixes MeteorDevelopment#6648
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
Description
Summary
Root cause: A prior fix (#6586) made
Keybind#matchesreject any no-modifier bind if any modifier key was currently held, to stopCtrl+Gfrom also firing a plainGbind. But Minecraft's default controls tie Sprint to Ctrl and Sneak to Shift, so simply sprinting or crouching set those modifier bits, causing every plain keybind to stop responding whenever the player moved that way.Fix: Split the concern into the two places it actually belongs.
Keybind.java:matches()no longer disqualifies a no-modifier bind based on which modifiers happen to be held. A bind with no modifiers now matches on the key alone, exactly as before Fixed keybind modifiers!!!!!!! #6586. This restores plain binds while sprinting/crouching.Modules.java: the "don't double-fire" behavior that Fixed keybind modifiers!!!!!!! #6586 was trying to achieve is moved to where binds are actually dispatched, inonAction(). Before checking plain binds, it first checks whether any bind with modifiers matches the current event; if one does, plain (no-modifier) binds are skipped for that event only. This preserves the original intent, soCtrl+Gstill fires only the chorded bind, not both, without punishing every plain bind whenever an unrelated modifier is incidentally held.Net effect:
G) work correctly while sprinting, crouching, or holding any other modifier for an unrelated reason.Ctrl+G) still fire only when their exact modifier combination is pressed.GandCtrl+Gare bound, pressingCtrl+Gtriggers only theCtrl+Gmodule, not both, matching the original goal of Fixed keybind modifiers!!!!!!! #6586.Related issues
#6648
#6652
How Has This Been Tested?
https://github.com/user-attachments/assets/9afe6061-ef1e-4cee-ad9a-0e3e5fb9d096
In the uploaded video, you can see me holding my sprint keybind (shift) and the module woking whilst im pressing it.
Checklist: