Skip to content

Commit

Permalink
Cache disable_anticheat and check it for "interacted_too_far"
Browse files Browse the repository at this point in the history
  • Loading branch information
asl97 authored and ShadowNinja committed Jan 9, 2016
1 parent 7118083 commit 106d4b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/network/serverpackethandler.cpp
Expand Up @@ -1358,7 +1358,9 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)
Check that target is reasonably close
(only when digging or placing things)
*/
if (action == 0 || action == 2 || action == 3) {
static const bool enable_anticheat = !g_settings->getBool("disable_anticheat");
if ((action == 0 || action == 2 || action == 3) &&
(enable_anticheat && !isSingleplayer())) {
float d = player_pos.getDistanceFrom(pointed_pos_under);
float max_d = BS * 14; // Just some large enough value
if (d > max_d) {
Expand Down Expand Up @@ -1495,7 +1497,7 @@ void Server::handleCommand_Interact(NetworkPacket* pkt)

/* Cheat prevention */
bool is_valid_dig = true;
if (!isSingleplayer() && !g_settings->getBool("disable_anticheat")) {
if (enable_anticheat && !isSingleplayer()) {
v3s16 nocheat_p = playersao->getNoCheatDigPos();
float nocheat_t = playersao->getNoCheatDigTime();
playersao->noCheatDigEnd();
Expand Down

0 comments on commit 106d4b7

Please sign in to comment.