In-game keybind editor#8153
Draft
burnhamrobertp wants to merge 4 commits into
Draft
Conversation
Contributor
Contributor
Author
|
(was built on top of #8143 and so is left in a draft state until that merges) |
e0a5c38 to
c85bfa9
Compare
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.
Adds an in-game keybind editor as the first tab of the Keys panel, for #396.
You get the commands grouped by category (same grouping as the old Keybinds info tab), each showing its current key(s). Double-click a key to rebind, "+" to add another, "x" to remove. Edits are staged - nothing changes your real keybinds until you hit Save, and Discard throws them away. There's a search box (matches command and category names) and a "Reset to preset" dropdown for Grid/Legacy with a confirm. Saving uses the existing uikeys.txt + KeybindingFile setup, the same way picking Custom in Settings does today.
A couple of the pieces are reusable instance-based widgets (a text input with selection/shortcuts, and a dropdown styled like the Settings selects) that other in-game UI could pick up later - the Settings filter being the obvious one. Save only applies the bind/unbind changes you actually made, so chains, fakemeta, and anything you didn't touch are left alone. Multiple actions on one key are allowed, since the engine supports it and a lot of the defaults rely on it.
Two things I couldn't solve from Lua, both engine-side: while the search box has focus, keys the engine treats as commands (build/unit/camera/volume) still reach the game, because there doesn't seem to be a way to put the engine into its "writing" state from Lua the way native chat does - a small SetUserWriting-style API would fix it for any in-game text field. And capturing a key that's already an engine command fires it once during capture, since its press never reaches Lua.
Only English strings are in so far; other languages fall back to English until they're registered with the translator.
Developed with AI assistance (Claude).