diff options
author | Ben Deutsch <ben@bendeutsch.de> | 2018-11-22 22:47:15 +0100 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2018-11-22 21:47:15 +0000 |
commit | 93bccb349080b0b184cdda9e7ab4a364664efe70 (patch) | |
tree | 2ee9bff24225c1d50a0ca0ff5c671354af846e44 /src/game.cpp | |
parent | 1c91cb8f8f6ea15dc1308aace666bd1ebd25a28c (diff) | |
download | minetest-93bccb349080b0b184cdda9e7ab4a364664efe70.tar.xz |
Client-side autojump. Remove Android-only stepheight autojump (#7228)
Works by detecting a collision while moving forward and then
simulating a jump. If the simulated jump is more successful,
an artificial jump key press is injected in the client.
Includes setting and key change GUI element for enabling and
disabling this feature.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/game.cpp b/src/game.cpp index 227b21db5..1cb9a1650 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2449,8 +2449,15 @@ void Game::updatePlayerControl(const CameraOrientation &cam) } #endif - client->setPlayerControl(control); LocalPlayer *player = client->getEnv().getLocalPlayer(); + + // autojump if set: simulate "jump" key + if (player->getAutojump()) { + control.jump = true; + keypress_bits |= 1U << 4; + } + + client->setPlayerControl(control); player->keyPressed = keypress_bits; //tt.stop(); |