Skip to content

Commit

Permalink
Block & report player self-interaction (#11137)
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu committed Mar 30, 2021
1 parent f4118a4 commit 88d1fcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/lua_api.txt
Expand Up @@ -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`
Expand Down
6 changes: 6 additions & 0 deletions src/network/serverpackethandler.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 88d1fcf

Please sign in to comment.