diff --git a/src/client/game.cpp b/src/client/game.cpp index 2e27d6b0d..88892beb5 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1914,6 +1914,10 @@ void Game::updateDebugState() if (!has_debug) { draw_control->show_wireframe = false; m_flags.disable_camera_update = false; + auto formspec = m_game_ui->getFormspecGUI(); + if (formspec) { + formspec->setDebugView(false); + } } // noclip diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index ca9401091..98974c6f6 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -4184,8 +4184,10 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) m_client->makeScreenshot(); } - if (event.KeyInput.PressedDown && kp == getKeySetting("keymap_toggle_debug")) - m_show_debug = !m_show_debug; + if (event.KeyInput.PressedDown && kp == getKeySetting("keymap_toggle_debug")) { + if (!m_client || m_client->checkPrivilege("debug")) + m_show_debug = !m_show_debug; + } if (event.KeyInput.PressedDown && (event.KeyInput.Key==KEY_RETURN || diff --git a/src/gui/guiFormSpecMenu.h b/src/gui/guiFormSpecMenu.h index 616971bc6..9ded4c7a8 100644 --- a/src/gui/guiFormSpecMenu.h +++ b/src/gui/guiFormSpecMenu.h @@ -223,6 +223,11 @@ class GUIFormSpecMenu : public GUIModalMenu m_allowclose = value; } + void setDebugView(bool value) + { + m_show_debug = value; + } + void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0)) { m_lock = lock;