Skip to content

Commit 869df17

Browse files
authored
Server enforcement for fog_distance (luanti-org#13448) to block cheating (luanti-org#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.
1 parent 26453df commit 869df17

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/clientiface.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ void RemoteClient::GetNextBlocks (
180180
s32 new_nearest_unsent_d = -1;
181181

182182
// Get view range and camera fov (radians) from the client
183+
s16 fog_distance = sao->getPlayer()->getSkyParams().fog_distance;
183184
s16 wanted_range = sao->getWantedRange() + 1;
185+
if (fog_distance >= 0) {
186+
// enforce if limited by mod
187+
wanted_range = std::min<unsigned>(wanted_range, std::ceil((float)fog_distance / MAP_BLOCKSIZE));
188+
}
184189
float camera_fov = sao->getFov();
185190

186191
/*

0 commit comments

Comments
 (0)