Skip to content

Commit

Permalink
Stop autoforward on BACKWARD key-press (#7417)
Browse files Browse the repository at this point in the history
  • Loading branch information
tukkek authored and SmallJoker committed Jun 6, 2018
1 parent ccc3af1 commit 9f8582d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion builtin/settingtypes.txt
Expand Up @@ -115,7 +115,8 @@ safe_dig_and_place (Safe digging and placing) bool false
# Enable random user input (only used for testing).
random_input (Random input) bool false

# Continuous forward movement, toggled by autoforward key.
# Continuous forward movement, toggled by autoforward key.
# Press the autoforward key again or the backwards movement to disable.
continuous_forward (Continuous forward) bool false

# The length in pixels it takes for touch screen interaction to start.
Expand Down Expand Up @@ -147,6 +148,7 @@ joystick_frustum_sensitivity (Joystick frustum sensitivity) float 170
keymap_forward (Forward key) key KEY_KEY_W

# Key for moving the player backward.
# Will also disable autoforward, when active.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_backward (Backward key) key KEY_KEY_S

Expand Down
3 changes: 3 additions & 0 deletions src/game.cpp
Expand Up @@ -1861,6 +1861,9 @@ void Game::processKeyInput()
dropSelectedItem(isKeyDown(KeyType::SNEAK));
} else if (wasKeyDown(KeyType::AUTOFORWARD)) {
toggleAutoforward();
} else if (wasKeyDown(KeyType::BACKWARD)) {
if (g_settings->getBool("continuous_forward"))
toggleAutoforward();
} else if (wasKeyDown(KeyType::INVENTORY)) {
openInventory();
} else if (input->cancelPressed()) {
Expand Down

0 comments on commit 9f8582d

Please sign in to comment.