From 32fd156585b28bdd1d9852878b8cade29a2349f6 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Sun, 17 Sep 2023 20:47:55 -0400 Subject: [PATCH] Revert "antihacks: Patch fast/teleport vulnerability when attached to an entity" * This reverts commit d99faef084aa89741b9192414fcb6c6d7785fa22. due unable to have the required structure of the more advanced code so leave as is and impleent antihacks into mods (in any case, this hack only if for x/z axis, not for y axis --- src/content_sao.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 4b6bf055f..6cf63c33d 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -1373,34 +1373,12 @@ std::string PlayerSAO::getPropertyPacket() bool PlayerSAO::checkMovementCheat() { - if (m_is_singleplayer || + if (isAttached() || m_is_singleplayer || g_settings->getBool("disable_anticheat")) { m_last_good_position = m_base_position; return false; } - if (UnitSAO *parent = dynamic_cast(getParent())) { - v3f attachment_pos; - { - int parent_id; - std::string bone; - v3f attachment_rot; - getAttachment(&parent_id, &bone, &attachment_pos, &attachment_rot); - } - v3f parent_pos = parent->getBasePosition(); - f32 diff = m_base_position.getDistanceFromSQ(parent_pos) - attachment_pos.getLengthSQ(); - const f32 maxdiff = 4.0f * BS; // fair trade-off value for various latencies - - if (diff > maxdiff * maxdiff) { - setBasePosition(parent_pos); - actionstream << "Server: " << m_player->getName() - << " moved away from parent; diff=" << sqrtf(diff) / BS - << " resetting position." << std::endl; - return true; - } - // Player movement is locked to the entity. Skip further checks - return false; - } bool cheated = false; /* Check player movements