diff options
author | lhofhansl <larsh@apache.org> | 2022-11-10 15:25:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 15:25:38 -0800 |
commit | 1a045da0dd7f086a6ca689620aeb0fa28a1f6ce6 (patch) | |
tree | 35ca9f8dade71ee0eed293a195150cad89ade292 /src/serverenvironment.cpp | |
parent | 00eb65915fb31539d747b57282f7383e8996af6a (diff) | |
download | minetest-1a045da0dd7f086a6ca689620aeb0fa28a1f6ce6.tar.xz |
Reduce active mgmt interval for a bit when a player joins. (#12925)
Diffstat (limited to 'src/serverenvironment.cpp')
-rw-r--r-- | src/serverenvironment.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp index 4f4425d72..9a58074b1 100644 --- a/src/serverenvironment.cpp +++ b/src/serverenvironment.cpp @@ -633,8 +633,8 @@ PlayerSAO *ServerEnvironment::loadPlayer(RemotePlayer *player, bool *new_player, /* Add object to environment */ addActiveObject(playersao); - // Update active blocks asap so objects in those blocks appear on the client - m_force_update_active_blocks = true; + // Update active blocks quickly for a bit so objects in those blocks appear on the client + m_fast_active_block_divider = 10; return playersao; } @@ -1327,8 +1327,7 @@ void ServerEnvironment::step(float dtime) /* Manage active block list */ - if (m_active_blocks_mgmt_interval.step(dtime, m_cache_active_block_mgmt_interval) || - m_force_update_active_blocks) { + if (m_active_blocks_mgmt_interval.step(dtime, m_cache_active_block_mgmt_interval / m_fast_active_block_divider)) { ScopeProfiler sp(g_profiler, "ServerEnv: update active blocks", SPT_AVG); /* @@ -1397,8 +1396,10 @@ void ServerEnvironment::step(float dtime) // Some blocks may be removed again by the code above so do this here m_active_block_gauge->set(m_active_blocks.size()); + + if (m_fast_active_block_divider > 1) + --m_fast_active_block_divider; } - m_force_update_active_blocks = false; /* Mess around in active blocks |