aboutsummaryrefslogtreecommitdiff
path: root/src/serverenvironment.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-05-26 22:14:22 +0200
committersfan5 <sfan5@live.de>2022-05-29 14:00:19 +0200
commitea74680df4340172674adfc3335e6ba887c3f79e (patch)
treec7e185817ccf89d35af7cd6527daa14823d1988c /src/serverenvironment.cpp
parentbb671c308930dc4cb8d67e8eed3664a23499bd95 (diff)
downloadminetest-ea74680df4340172674adfc3335e6ba887c3f79e.tar.gz
minetest-ea74680df4340172674adfc3335e6ba887c3f79e.tar.bz2
minetest-ea74680df4340172674adfc3335e6ba887c3f79e.zip
Immediately activate blocks when a player joins
issue: #10884 This makes it possible for objects to immediately be activated, but doesn't guarantee it since blocks may still need be emerged.
Diffstat (limited to 'src/serverenvironment.cpp')
-rw-r--r--src/serverenvironment.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp
index 630c111c5..bff563a61 100644
--- a/src/serverenvironment.cpp
+++ b/src/serverenvironment.cpp
@@ -626,6 +626,9 @@ 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;
+
return playersao;
}
@@ -1332,8 +1335,10 @@ void ServerEnvironment::step(float dtime)
/*
Manage active block list
*/
- if (m_active_blocks_management_interval.step(dtime, m_cache_active_block_mgmt_interval)) {
+ if (m_active_blocks_mgmt_interval.step(dtime, m_cache_active_block_mgmt_interval) ||
+ m_force_update_active_blocks) {
ScopeProfiler sp(g_profiler, "ServerEnv: update active blocks", SPT_AVG);
+
/*
Get player block positions
*/
@@ -1396,6 +1401,7 @@ void ServerEnvironment::step(float dtime)
activateBlock(block);
}
}
+ m_force_update_active_blocks = false;
/*
Mess around in active blocks