Change some keys to be triggered once every key press (#13883)

Those keys are below:
- KeyType::CAMERA_MODE
- KeyType::SCREENSHOT
- KeyType::TOGGLE_BLOCK_BOUNDS
- KeyType::TOGGLE_HUD
- KeyType::MINIMAP
- KeyType::TOGGLE_CHAT
- KeyType::TOGGLE_FOG
- KeyType::TOGGLE_DEBUG
- KeyType::TOGGLE_PROFILER
- KeyType::RANGESELECT


Co-authored-by: Gregor Parzefall <82708541+grorp@users.noreply.github.com>
This commit is contained in:
Muhammad Rifqi Priyo Susanto 2023-10-22 02:00:08 +07:00 committed by GitHub
parent 8a9855241c
commit c9655e54ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2066,29 +2066,29 @@ void Game::processKeyInput()
#endif #endif
} else if (wasKeyDown(KeyType::CINEMATIC)) { } else if (wasKeyDown(KeyType::CINEMATIC)) {
toggleCinematic(); toggleCinematic();
} else if (wasKeyDown(KeyType::SCREENSHOT)) { } else if (wasKeyPressed(KeyType::SCREENSHOT)) {
client->makeScreenshot(); client->makeScreenshot();
} else if (wasKeyDown(KeyType::TOGGLE_BLOCK_BOUNDS)) { } else if (wasKeyPressed(KeyType::TOGGLE_BLOCK_BOUNDS)) {
toggleBlockBounds(); toggleBlockBounds();
} else if (wasKeyDown(KeyType::TOGGLE_HUD)) { } else if (wasKeyPressed(KeyType::TOGGLE_HUD)) {
m_game_ui->toggleHud(); m_game_ui->toggleHud();
} else if (wasKeyDown(KeyType::MINIMAP)) { } else if (wasKeyPressed(KeyType::MINIMAP)) {
toggleMinimap(isKeyDown(KeyType::SNEAK)); toggleMinimap(isKeyDown(KeyType::SNEAK));
} else if (wasKeyDown(KeyType::TOGGLE_CHAT)) { } else if (wasKeyPressed(KeyType::TOGGLE_CHAT)) {
m_game_ui->toggleChat(client); m_game_ui->toggleChat(client);
} else if (wasKeyDown(KeyType::TOGGLE_FOG)) { } else if (wasKeyPressed(KeyType::TOGGLE_FOG)) {
toggleFog(); toggleFog();
} else if (wasKeyDown(KeyType::TOGGLE_UPDATE_CAMERA)) { } else if (wasKeyDown(KeyType::TOGGLE_UPDATE_CAMERA)) {
toggleUpdateCamera(); toggleUpdateCamera();
} else if (wasKeyDown(KeyType::TOGGLE_DEBUG)) { } else if (wasKeyPressed(KeyType::TOGGLE_DEBUG)) {
toggleDebug(); toggleDebug();
} else if (wasKeyDown(KeyType::TOGGLE_PROFILER)) { } else if (wasKeyPressed(KeyType::TOGGLE_PROFILER)) {
m_game_ui->toggleProfiler(); m_game_ui->toggleProfiler();
} else if (wasKeyDown(KeyType::INCREASE_VIEWING_RANGE)) { } else if (wasKeyDown(KeyType::INCREASE_VIEWING_RANGE)) {
increaseViewRange(); increaseViewRange();
} else if (wasKeyDown(KeyType::DECREASE_VIEWING_RANGE)) { } else if (wasKeyDown(KeyType::DECREASE_VIEWING_RANGE)) {
decreaseViewRange(); decreaseViewRange();
} else if (wasKeyDown(KeyType::RANGESELECT)) { } else if (wasKeyPressed(KeyType::RANGESELECT)) {
toggleFullViewRange(); toggleFullViewRange();
} else if (wasKeyDown(KeyType::ZOOM)) { } else if (wasKeyDown(KeyType::ZOOM)) {
checkZoomEnabled(); checkZoomEnabled();
@ -3138,7 +3138,7 @@ void Game::updateCamera(f32 dtime)
v3s16 old_camera_offset = camera->getOffset(); v3s16 old_camera_offset = camera->getOffset();
if (wasKeyDown(KeyType::CAMERA_MODE)) { if (wasKeyPressed(KeyType::CAMERA_MODE)) {
GenericCAO *playercao = player->getCAO(); GenericCAO *playercao = player->getCAO();
// If playercao not loaded, don't change camera // If playercao not loaded, don't change camera