1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Added pitch fly mode (#7817)

In pitch fly mode, you fly to the exact direction you are pointing at, using the forward key. Other move directions are also pitched accordingly.
It allows smoother and more complex movements.
Can be enabled/disabled by L key by default (set keymap_pitchfly in minetest.conf)
This commit is contained in:
Gaël C 2018-12-01 10:01:32 +01:00 committed by SmallJoker
parent dcf58a3ad0
commit 327bad2eaf
11 changed files with 91 additions and 44 deletions

View file

@ -701,6 +701,7 @@ protected:
void openConsole(float scale, const wchar_t *line=NULL);
void toggleFreeMove();
void toggleFreeMoveAlt();
void togglePitchFly();
void toggleFast();
void toggleNoClip();
void toggleCinematic();
@ -1896,6 +1897,8 @@ void Game::processKeyInput()
toggleFreeMove();
} else if (wasKeyDown(KeyType::JUMP)) {
toggleFreeMoveAlt();
} else if (wasKeyDown(KeyType::PITCHFLY)) {
togglePitchFly();
} else if (wasKeyDown(KeyType::FASTMOVE)) {
toggleFast();
} else if (wasKeyDown(KeyType::NOCLIP)) {
@ -2107,6 +2110,19 @@ void Game::toggleFreeMoveAlt()
}
void Game::togglePitchFly()
{
bool pitch_fly = !g_settings->getBool("pitch_fly");
g_settings->set("pitch_fly", bool_to_cstr(pitch_fly));
if (pitch_fly) {
m_game_ui->showTranslatedStatusText("Pitch fly mode enabled");
} else {
m_game_ui->showTranslatedStatusText("Pitch fly mode disabled");
}
}
void Game::toggleFast()
{
bool fast_move = !g_settings->getBool("fast_move");