Revert "antihacks: Patch fast/teleport vulnerability when attached to an entity"

* This reverts commit ed9fcb842e.
  cos this branch dont have the necesary code
stable-4.X-namespace
mckaygerhard 2023-09-17 20:52:56 -04:00
parent ed9fcb842e
commit e36906f5ba
1 changed files with 1 additions and 23 deletions

View File

@ -1372,34 +1372,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<UnitSAO *>(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