aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorASL97 <asl97@outlook.com>2015-12-07 17:39:48 +0800
committerShadowNinja <shadowninja@minetest.net>2016-01-09 16:24:22 -0500
commit106d4b7d05cfbba901abd540113991042d77bc97 (patch)
treed18d38033d7e0ec68f8e1e77f94a6a975204517d /src
parent711808343db6d081e0aec550553a018554bed4d6 (diff)
downloadminetest-106d4b7d05cfbba901abd540113991042d77bc97.tar.gz
minetest-106d4b7d05cfbba901abd540113991042d77bc97.tar.bz2
minetest-106d4b7d05cfbba901abd540113991042d77bc97.zip
Cache disable_anticheat and check it for "interacted_too_far"
Diffstat (limited to 'src')
-rw-r--r--src/network/serverpackethandler.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index a5aaf1ecb..7e348a94d 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -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) {
@@ -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();