]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Block & report player self-interaction (#11137)
authorLars Müller <34514239+appgurueu@users.noreply.github.com>
Tue, 30 Mar 2021 19:49:50 +0000 (21:49 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Mar 2021 19:49:50 +0000 (21:49 +0200)
doc/lua_api.txt
src/network/serverpackethandler.cpp

index 66363be7709fc8cf4e51d062db84be11795141ff..d333ca58b24681698388aa84c56b0bc6c4f4515a 100644 (file)
@@ -4662,6 +4662,7 @@ Call these functions only at load time!
     * `cheat`: `{type=<cheat_type>}`, where `<cheat_type>` is one of:
         * `moved_too_fast`
         * `interacted_too_far`
+        * `interacted_with_self`
         * `interacted_while_dead`
         * `finished_unknown_dig`
         * `dug_unbreakable`
index 5b378a0832b5c17849e1ec1ab7ef26e21ab6e6f7..708ddbf203916dae50a3bfcf2a35572fe4255ca0 100644 (file)
@@ -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);