Skip to content

Commit

Permalink
Server enforcement for fog_distance (minetest#13448) to block cheating (
Browse files Browse the repository at this point in the history
minetest#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.
  • Loading branch information
lhofhansl authored and Wuzzy2 committed Jul 31, 2023
1 parent b15a2ef commit 83eb592
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/clientiface.cpp
Expand Up @@ -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<unsigned>(wanted_range, std::ceil((float)fog_distance / MAP_BLOCKSIZE));
}
float camera_fov = sao->getFov();

/*
Expand Down

0 comments on commit 83eb592

Please sign in to comment.