Skip to content

Commit 88d1fcf

Browse files
authoredMar 30, 2021
Block & report player self-interaction (#11137)
1 parent f4118a4 commit 88d1fcf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
 

Diff for: ‎doc/lua_api.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4662,6 +4662,7 @@ Call these functions only at load time!
46624662
* `cheat`: `{type=<cheat_type>}`, where `<cheat_type>` is one of:
46634663
* `moved_too_fast`
46644664
* `interacted_too_far`
4665+
* `interacted_with_self`
46654666
* `interacted_while_dead`
46664667
* `finished_unknown_dig`
46674668
* `dug_unbreakable`

Diff for: ‎src/network/serverpackethandler.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,12 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
10511051
if (pointed.type == POINTEDTHING_NODE) {
10521052
target_pos = intToFloat(pointed.node_undersurface, BS);
10531053
} else if (pointed.type == POINTEDTHING_OBJECT) {
1054+
if (playersao->getId() == pointed_object->getId()) {
1055+
actionstream << "Server: " << player->getName()
1056+
<< " attempted to interact with themselves" << std::endl;
1057+
m_script->on_cheat(playersao, "interacted_with_self");
1058+
return;
1059+
}
10541060
target_pos = pointed_object->getBasePosition();
10551061
}
10561062
float d = playersao->getEyePosition().getDistanceFrom(target_pos);

0 commit comments

Comments
 (0)