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.
This commit is contained in:
lhofhansl 2023-07-06 09:36:46 -07:00 committed by GitHub
parent 26453df2f7
commit 869df17ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -180,7 +180,12 @@ void RemoteClient::GetNextBlocks (
s32 new_nearest_unsent_d = -1; s32 new_nearest_unsent_d = -1;
// Get view range and camera fov (radians) from the client // Get view range and camera fov (radians) from the client
s16 fog_distance = sao->getPlayer()->getSkyParams().fog_distance;
s16 wanted_range = sao->getWantedRange() + 1; s16 wanted_range = sao->getWantedRange() + 1;
if (fog_distance >= 0) {
// enforce if limited by mod
wanted_range = std::min<unsigned>(wanted_range, std::ceil((float)fog_distance / MAP_BLOCKSIZE));
}
float camera_fov = sao->getFov(); float camera_fov = sao->getFov();
/* /*