From 9f8582dcdf24600b54e8c178de37f3a222c31df2 Mon Sep 17 00:00:00 2001 From: tukkek Date: Wed, 6 Jun 2018 09:31:34 -0300 Subject: [PATCH] Stop autoforward on BACKWARD key-press (#7417) --- builtin/settingtypes.txt | 4 +++- src/game.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 51797f7de..8e42fe29a 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -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. @@ -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 diff --git a/src/game.cpp b/src/game.cpp index 648c71774..0da8e1661 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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()) { -- 2.25.1