Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(input): overlapping modifiers not consistently respected #116

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

ceejbot
Copy link
Owner

@ceejbot ceejbot commented Jan 19, 2024

Bug #115 complains that the player couldn't set the unequip modifier and the utility-activation modifier to the same thing and have them consistently respected. When I looked into this I was horrified to read what a mess I'd made of tracking key input.

It's still a mess after this PR, but it's less of a mess. And this fixes #115.

We demote the hotkey enum to a supporting role instead of a central one. The controller uses the keycode as the identifier for tracked keys, since it is in fact unique while hotkeys, as noted above, might not be. The modifier hotkey variants have been collapsed into a single variant with internal data representing what modifiers might be associated with that keypress (sadly via a new enum, Modifier). The controller passes the tracked key struct down through key event handlers when needed, instead of the hotkey variant. It also uses the Action enum--which is definitely staying around--when that is meaningful.

I didn't get to nuke some enum types from orbit yet, but I will soon.

Also, we now do absolutely nothing if an incoming key does not
map to any hotkey at all, which is the behavior in the main branch.
And also correct behavior.
@ceejbot ceejbot merged commit 073915c into latest Jan 19, 2024
1 check passed
@ceejbot ceejbot deleted the ceej/key-tracking-rework branch January 19, 2024 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

player reports A button not behaving in A+ manner
1 participant