From 6ac8346c6d8ef1165fd6c06b2ce964e8acccafff Mon Sep 17 00:00:00 2001 From: lhofhansl Date: Tue, 11 Nov 2025 11:10:49 -0800 Subject: [PATCH] Revert part of 16013 - restore liquid updates to the client (#16663) This reverts 00addc3e5d3616f23debbfa7efd4236d2b6fdbbe Fixes: #16662 --- src/map.h | 3 --- src/server.cpp | 5 ++--- src/server/clientiface.cpp | 34 +++++++++++++++------------------- src/server/clientiface.h | 6 +++--- src/servermap.cpp | 1 - 5 files changed, 20 insertions(+), 29 deletions(-) diff --git a/src/map.h b/src/map.h index bfdee54423..0e9275fc4a 100644 --- a/src/map.h +++ b/src/map.h @@ -46,9 +46,6 @@ struct MapEditEvent MapNode n = CONTENT_AIR; std::vector modified_blocks; // Represents a set bool is_private_change = false; - // Setting low_priority to true allows the server - // to send this change to clients with some delay. - bool low_priority = false; MapEditEvent() = default; diff --git a/src/server.cpp b/src/server.cpp index 4590fda9ce..e3bb35f025 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -765,7 +765,6 @@ void Server::AsyncRunStep(float dtime, bool initial_step) if (!modified_blocks.empty()) { MapEditEvent event; event.type = MEET_OTHER; - event.low_priority = true; event.setModifiedBlocks(modified_blocks); m_env->getMap().dispatchEvent(event); } @@ -1023,7 +1022,7 @@ void Server::AsyncRunStep(float dtime, bool initial_step) } case MEET_OTHER: prof.add("MEET_OTHER", 1); - m_clients.markBlocksNotSent(event->modified_blocks, event->low_priority); + m_clients.markBlocksNotSent(event->modified_blocks); break; default: prof.add("unknown", 1); @@ -1039,7 +1038,7 @@ void Server::AsyncRunStep(float dtime, bool initial_step) */ for (const u16 far_player : far_players) { if (RemoteClient *client = getClient(far_player)) - client->SetBlocksNotSent(event->modified_blocks, event->low_priority); + client->SetBlocksNotSent(event->modified_blocks); } delete event; diff --git a/src/server/clientiface.cpp b/src/server/clientiface.cpp index 74337628be..4fcc920713 100644 --- a/src/server/clientiface.cpp +++ b/src/server/clientiface.cpp @@ -426,34 +426,30 @@ void RemoteClient::SentBlock(v3s16 p) " already in m_blocks_sending"< 0) { - // If this is a low priority event, do not reset m_nearest_unsent_d. - // Instead, the send loop will get to the block in the next full loop iteration. - if (!low_priority) { - // Note that we do NOT use the euclidean distance here. - // getNextBlocks builds successive cube-surfaces in the send loop. - // This resets the distance to the maximum cube size that - // still guarantees that this block will be scanned again right away. - // - // Using m_last_center is OK, as a change in center - // will reset m_nearest_unsent_d to 0 anyway (see getNextBlocks). - p -= m_last_center; - s16 this_d = std::max({std::abs(p.X), std::abs(p.Y), std::abs(p.Z)}); - m_nearest_unsent_d = std::min(m_nearest_unsent_d, this_d); - } + // Note that we do NOT use the euclidean distance here. + // getNextBlocks builds successive cube-surfaces in the send loop. + // This resets the distance to the maximum cube size that + // still guarantees that this block will be scanned again right away. + // + // Using m_last_center is OK, as a change in center + // will reset m_nearest_unsent_d to 0 anyway (see getNextBlocks). + p -= m_last_center; + s16 this_d = std::max({std::abs(p.X), std::abs(p.Y), std::abs(p.Z)}); + m_nearest_unsent_d = std::min(m_nearest_unsent_d, this_d); } } -void RemoteClient::SetBlocksNotSent(const std::vector &blocks, bool low_priority) +void RemoteClient::SetBlocksNotSent(const std::vector &blocks) { for (v3s16 p : blocks) { - SetBlockNotSent(p, low_priority); + SetBlockNotSent(p); } } @@ -677,12 +673,12 @@ std::vector ClientInterface::getClientIDs(ClientState min_state) return reply; } -void ClientInterface::markBlocksNotSent(const std::vector &positions, bool low_priority) +void ClientInterface::markBlocksNotSent(const std::vector &positions) { RecursiveMutexAutoLock clientslock(m_clients_mutex); for (const auto &client : m_clients) { if (client.second->getState() >= CS_Active) - client.second->SetBlocksNotSent(positions, low_priority); + client.second->SetBlocksNotSent(positions); } } diff --git a/src/server/clientiface.h b/src/server/clientiface.h index 618d61a58a..43d06329a5 100644 --- a/src/server/clientiface.h +++ b/src/server/clientiface.h @@ -250,8 +250,8 @@ public: void SentBlock(v3s16 p); - void SetBlockNotSent(v3s16 p, bool low_priority = false); - void SetBlocksNotSent(const std::vector &blocks, bool low_priority = false); + void SetBlockNotSent(v3s16 p); + void SetBlocksNotSent(const std::vector &blocks); /** * tell client about this block being modified right now. @@ -442,7 +442,7 @@ public: std::vector getClientIDs(ClientState min_state=CS_Active); /* mark blocks as not sent on all active clients */ - void markBlocksNotSent(const std::vector &positions, bool low_priority = false); + void markBlocksNotSent(const std::vector &positions); /* verify if server user limit was reached */ bool isUserLimitReached(); diff --git a/src/servermap.cpp b/src/servermap.cpp index 92b6d7e4a6..e88676bad5 100644 --- a/src/servermap.cpp +++ b/src/servermap.cpp @@ -774,7 +774,6 @@ MapBlock *ServerMap::loadBlock(const std::string &blob, v3s16 p3d, bool save_aft if (!modified_blocks.empty()) { MapEditEvent event; event.type = MEET_OTHER; - event.low_priority = true; event.setModifiedBlocks(modified_blocks); dispatchEvent(event); }