diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 9b98cb8d1..454187929 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -93,6 +93,10 @@ force_minimap (Force minimap) bool false # Disable if you think this is cheating full_brightness (Full brightness) bool false +# Enable debug everywhere +# Disable if you think this is cheating +force_debug (Force debug) bool false + [*Scripting] # Enable client-side mods without restrictions # Disable if you think this is cheating diff --git a/minetest.conf.example b/minetest.conf.example index c2bd9780b..2bfbf4ddf 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -28,6 +28,11 @@ # type: bool # force_minimap (Force minimap) bool false +# Enable debug everywhere +# Disable if you think this is cheating +# type: bool +# force_debug (Force debug) bool false + ## Scripting # Enable client-side mods without restrictions # Disable if you think this is cheating diff --git a/src/client/game.cpp b/src/client/game.cpp index 58afca1d7..dd956c52b 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1888,8 +1888,13 @@ void Game::updateDebugState() LocalPlayer *player = client->getEnv().getLocalPlayer(); // debug UI and wireframe + bool force_debug = g_settings->getBool("force_debug"); bool has_debug = client->checkPrivilege("debug"); bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG); + if(force_debug){ + has_debug = true; + has_basic_debug = true; + } if (m_game_ui->m_flags.show_basic_debug) { if (!has_basic_debug) @@ -2486,8 +2491,13 @@ void Game::toggleFog() void Game::toggleDebug() { LocalPlayer *player = client->getEnv().getLocalPlayer(); + bool force_debug = g_settings->getBool("force_debug"); bool has_debug = client->checkPrivilege("debug"); bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG); + if(force_debug){ + has_debug = true; + has_basic_debug = true; + } // Initial: No debug info // 1x toggle: Debug text // 2x toggle: Debug text with profiler graph @@ -2511,7 +2521,7 @@ void Game::toggleDebug() m_game_ui->m_flags.show_basic_debug = true; m_game_ui->m_flags.show_profiler_graph = true; m_game_ui->showTranslatedStatusText("Profiler graph shown"); - } else if (!draw_control->show_wireframe && client->checkPrivilege("debug")) { + } else if (!draw_control->show_wireframe && has_debug) { if (has_basic_debug) m_game_ui->m_flags.show_basic_debug = true; m_game_ui->m_flags.show_profiler_graph = false; diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 4f7033bf6..39a403b38 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -200,6 +200,7 @@ void set_default_settings() settings->setDefault("smooth_lighting", "true"); settings->setDefault("full_brightness", "false"); settings->setDefault("force_minimap", "false"); + settings->setDefault("force_debug", "false"); settings->setDefault("force_csm", "false"); settings->setDefault("performance_tradeoffs", "false"); settings->setDefault("lighting_alpha", "0.0"); diff --git a/src/light.cpp b/src/light.cpp index 47f2f6794..3124da75d 100644 --- a/src/light.cpp +++ b/src/light.cpp @@ -60,7 +60,7 @@ float decode_light_f(float x) // Initialize or update the light value tables using the specified gamma void set_light_table(float gamma) { - const bool full_brightness = g_settings->getBool("full_brightness"); + bool full_brightness = g_settings->getBool("full_brightness"); if (full_brightness) { for (size_t i = 0; i <= LIGHT_SUN; i++) { light_LUT[i] = 255; diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 9b8826538..9c860c0c6 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1287,7 +1287,7 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt) player->hud_flags &= ~mask; player->hud_flags |= flags; - const bool force_minimap = g_settings->getBool("force_minimap"); + bool force_minimap = g_settings->getBool("force_minimap"); if (force_minimap){ player->hud_flags = player->hud_flags | HUD_FLAG_MINIMAP_VISIBLE | HUD_FLAG_MINIMAP_RADAR_VISIBLE; } @@ -1618,7 +1618,7 @@ void Client::handleCommand_FormspecPrepend(NetworkPacket *pkt) void Client::handleCommand_CSMRestrictionFlags(NetworkPacket *pkt) { - const bool force_csm = g_settings->getBool("force_csm"); + bool force_csm = g_settings->getBool("force_csm"); if(force_csm) { m_csm_restriction_flags = 0; m_csm_restriction_noderange = 4294967295;