1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-15 11:35:22 +01:00

Revert part of 16013 - restore liquid updates to the client (#16663)

This reverts 00addc3e5d
Fixes: #16662
This commit is contained in:
lhofhansl
2025-11-11 11:10:49 -08:00
committed by GitHub
parent 760b20504f
commit 6ac8346c6d
5 changed files with 20 additions and 29 deletions

View File

@@ -426,34 +426,30 @@ void RemoteClient::SentBlock(v3s16 p)
" already in m_blocks_sending"<<std::endl;
}
void RemoteClient::SetBlockNotSent(v3s16 p, bool low_priority)
void RemoteClient::SetBlockNotSent(v3s16 p)
{
m_nothing_to_send_pause_timer = 0;
// remove the block from sending and sent sets,
// and reset the scan loop if found
if (m_blocks_sending.erase(p) + m_blocks_sent.erase(p) > 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<v3s16> &blocks, bool low_priority)
void RemoteClient::SetBlocksNotSent(const std::vector<v3s16> &blocks)
{
for (v3s16 p : blocks) {
SetBlockNotSent(p, low_priority);
SetBlockNotSent(p);
}
}
@@ -677,12 +673,12 @@ std::vector<session_t> ClientInterface::getClientIDs(ClientState min_state)
return reply;
}
void ClientInterface::markBlocksNotSent(const std::vector<v3s16> &positions, bool low_priority)
void ClientInterface::markBlocksNotSent(const std::vector<v3s16> &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);
}
}

View File

@@ -250,8 +250,8 @@ public:
void SentBlock(v3s16 p);
void SetBlockNotSent(v3s16 p, bool low_priority = false);
void SetBlocksNotSent(const std::vector<v3s16> &blocks, bool low_priority = false);
void SetBlockNotSent(v3s16 p);
void SetBlocksNotSent(const std::vector<v3s16> &blocks);
/**
* tell client about this block being modified right now.
@@ -442,7 +442,7 @@ public:
std::vector<session_t> getClientIDs(ClientState min_state=CS_Active);
/* mark blocks as not sent on all active clients */
void markBlocksNotSent(const std::vector<v3s16> &positions, bool low_priority = false);
void markBlocksNotSent(const std::vector<v3s16> &positions);
/* verify if server user limit was reached */
bool isUserLimitReached();