From 742614180cbbe598694a48bd9eb6f7b97a762243 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 3 Aug 2013 23:16:37 +0300 Subject: Fix anticheat --- src/server.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'src/server.cpp') diff --git a/src/server.cpp b/src/server.cpp index 8c67846c5..cdd42c2e9 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1090,6 +1090,16 @@ void Server::AsyncRunStep() { JMutexAutoLock lock(m_env_mutex); + // Figure out and report maximum lag to environment + float max_lag = m_env->getMaxLagEstimate(); + max_lag *= 0.9998; // Decrease slowly (about half per 5 minutes) + if(dtime > max_lag){ + if(dtime > 0.1 && dtime > max_lag * 2.0) + infostream<<"Server: Maximum lag peaked to "<reportMaxLagEstimate(max_lag); // Step environment ScopeProfiler sp(g_profiler, "SEnv step"); ScopeProfiler sp2(g_profiler, "SEnv step avg", SPT_AVG); @@ -2241,6 +2251,8 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) player->control.LMB = (bool)(keyPressed&128); player->control.RMB = (bool)(keyPressed&256); + playersao->checkMovementCheat(); + /*infostream<<"Server::ProcessData(): Moved player "<getName() - <<" completed digging " - <