From 869df17ddf3736cc013ce24384b8e71aee392049 Mon Sep 17 00:00:00 2001 From: lhofhansl Date: Thu, 6 Jul 2023 09:36:46 -0700 Subject: [PATCH] Server enforcement for fog_distance (#13448) to block cheating (#13643) This enforces the fog_distance (if set) at the server, so that a hacked client could not cheat and retrieve blocks beyond the set distance. --- src/clientiface.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/clientiface.cpp b/src/clientiface.cpp index a45242e1c..45df9684a 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -180,7 +180,12 @@ void RemoteClient::GetNextBlocks ( s32 new_nearest_unsent_d = -1; // Get view range and camera fov (radians) from the client + s16 fog_distance = sao->getPlayer()->getSkyParams().fog_distance; s16 wanted_range = sao->getWantedRange() + 1; + if (fog_distance >= 0) { + // enforce if limited by mod + wanted_range = std::min(wanted_range, std::ceil((float)fog_distance / MAP_BLOCKSIZE)); + } float camera_fov = sao->getFov(); /*