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

Properly keep noclip state in Game and ClientMap

This commit is contained in:
sfan5 2022-05-21 20:29:44 +02:00
parent 5f3af7d18b
commit 575caa8015
3 changed files with 23 additions and 17 deletions

View file

@ -1743,6 +1743,8 @@ void Game::processQueues()
void Game::updateDebugState()
{
LocalPlayer *player = client->getEnv().getLocalPlayer();
// debug UI and wireframe
bool has_debug = client->checkPrivilege("debug");
bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG);
@ -1757,6 +1759,9 @@ void Game::updateDebugState()
hud->disableBlockBounds();
if (!has_debug)
draw_control->show_wireframe = false;
// noclip
draw_control->allow_noclip = m_cache_enable_noclip && client->checkPrivilege("noclip");
}
void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,
@ -3762,7 +3767,10 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
float direct_brightness;
bool sunlight_seen;
if (m_cache_enable_noclip && m_cache_enable_free_move) {
// When in noclip mode force same sky brightness as above ground so you
// can see properly
if (draw_control->allow_noclip && m_cache_enable_free_move &&
client->checkPrivilege("fly")) {
direct_brightness = time_brightness;
sunlight_seen = true;
} else {