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

MISC: Add key binding feature #1830

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from

Conversation

catloversg
Copy link
Contributor

@catloversg catloversg commented Dec 8, 2024

This feature has been requested for a long time. It's the only way to properly fix wrong behaviors of shortcuts.

Tested: I played for a while with US, US Intl, and US Dvorak.

Screenshots:
Capture1
Capture2
Capture3
Capture4

Closes #420.

Copy link
Collaborator

@d0sboots d0sboots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm finally getting around to this.

High-level comments:
First off, great job! The screenshots of the UI look great.

Actually, that's it for high-level comments, the rest is specifics XD

src/ScriptEditor/ui/ScriptEditorRoot.tsx Outdated Show resolved Hide resolved
src/Settings/Settings.ts Show resolved Hide resolved
src/Sidebar/ui/SidebarRoot.tsx Outdated Show resolved Hide resolved
src/utils/helpers/keyCodes.ts Outdated Show resolved Hide resolved
src/utils/KeyBindingUtils.ts Outdated Show resolved Hide resolved
src/ScriptEditor/ui/ScriptEditorRoot.tsx Outdated Show resolved Hide resolved
}
}
// Terminal-ClearScreen
if (isKeyCombinationPressed(newCombination, { control: true, code: KEYCODE.L })) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make this one bindable, but that can be for another day.

// Bash hotkeys
if (
Settings.EnableBashHotkeys &&
(isKeyCombinationPressed(newCombination, { control: true, code: KEYCODE.M }) ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bash hotkeys definitely should be bindable, but that can also be for another day.

src/GameOptions/ui/KeyBindingPage.tsx Show resolved Hide resolved
src/GameOptions/ui/KeyBindingPage.tsx Outdated Show resolved Hide resolved
@catloversg
Copy link
Contributor Author

catloversg commented Feb 14, 2025

It's ready for the next review now.

I moved SimplePage and ComplexPage out of src\ui\Router.ts to minimize the dependency chain.
I'll add key bindings for Terminal-ClearScreen and Bash hotkeys in another PR.

@d0sboots
Copy link
Collaborator

This looks good to me. One last thing is, can you use the deploy action in GitHub to host this at https://catloversg.github.io/bitburner-src (or maybe it's already hosted somewhere else) so we can play with it? I'd like to, but more importantly Zoë expressed a strong desire to have a heads-up on keybinding-related changes, and they're the only person I am certain of who has a Mac to test this on.

@catloversg
Copy link
Contributor Author

It's available at https://catloversg.github.io/bitburner-src/.

@d0sboots
Copy link
Collaborator

There's one last thing I think we should add before we merge; the rest can be added iteratively later. That is Denis' suggestion of only saving explicitly set keybinds, so that future changes to the defaults won't end up locked in.

This is a chunk of additional complexity (you'll probably need to keep a merged and unmerged version for different purposes), but it's something that lots of other games do and one that I think we will regret it we don't have. And it has to be done now, to be effective.

Note that this pretty much requires that hitting "default" on the secondary bind restores the secondary default, since hitting "default" will be how you clear a "set" keybind. (Add opposed to "clear", which sets it to clear.)

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.

Implement a custom keybinding system
2 participants