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