Make Sneak
and Aux1
optionally togglable
#15785
Open
+46
−8
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.
What and why
This PR adds two accessibility settings to the control options for toggling
sneak
andaux1
.When these are enabled, their respective keys in-game will toggle when you press them. This lets you e.g. press
sneak
to toggle on sneaking until you're done building over a ledge or bridging, and then press it again to stop sneaking, instead of having to keep the button pressed for the entire duration.This addresses the same issue as #15234, but uses a more generic and platform-independent implementation, as suggested in the comments, which will also work for mobile. The impementation is different enough that I thought it best to open a new PR.
Notably, this doesn't affect how the
aux1
andsneak
keys are read by the formspec, because it only changes the input handling ofgame.cpp
, notkeycodes.cpp
. I imagine that would be outside the behaviour most people expect and want from this option, and it might also interfere with mobile formspec interaction.Other changes
I also fixed some errors appearing on my end by adding
include <string>
to some files.Another change is that now, the locale workaround which reboots the program isn't used in debug builds, only release builds, as it prevented debugging.
Environment
I'm compiling on Windows 11, with Visual Studio Community 2022 (Microsoft now restricts access to the 2019 version).
If more specific information is desired let me know.
To do
This PR is Ready for Review.
keycodes.cpp
as well, which is used by the inventory. Currently it only affects player movement, e.g. shift-clicking a node in the inventory works as normal regardless of if shift is toggled for the players movement. Choosing to do this might interfere with item managing on mobile.How to test
Launch the game, go to
Options
->Controls
->General
and enableToggle aux1 key
andToggle sneak key
.Then start any world and press the sneak key, release it and it will persist. Pressing it again will stop the player from sneaking.