From 88d1fcfe237470b6eaed079f95a048e5f39b1861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:49:50 +0200 Subject: [PATCH] Block & report player self-interaction (#11137) --- doc/lua_api.txt | 1 + src/network/serverpackethandler.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 66363be77..d333ca58b 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4662,6 +4662,7 @@ Call these functions only at load time! * `cheat`: `{type=}`, where `` is one of: * `moved_too_fast` * `interacted_too_far` + * `interacted_with_self` * `interacted_while_dead` * `finished_unknown_dig` * `dug_unbreakable` diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 5b378a083..708ddbf20 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -1051,6 +1051,12 @@ void Server::handleCommand_Interact(NetworkPacket *pkt) if (pointed.type == POINTEDTHING_NODE) { target_pos = intToFloat(pointed.node_undersurface, BS); } else if (pointed.type == POINTEDTHING_OBJECT) { + if (playersao->getId() == pointed_object->getId()) { + actionstream << "Server: " << player->getName() + << " attempted to interact with themselves" << std::endl; + m_script->on_cheat(playersao, "interacted_with_self"); + return; + } target_pos = pointed_object->getBasePosition(); } float d = playersao->getEyePosition().getDistanceFrom(target_pos);