summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-11-09 10:55:15 +0000
committerGitHub <noreply@github.com>2020-11-09 11:55:15 +0100
commit7589cbe086a5558eea018e1e3d25e388b26d51e8 (patch)
treeda165c066dd85fd6516a13fd7d6ba114a59acaf3 /src
parentc940a57a384b1a75730776906451078d25c5aa52 (diff)
downloadminetest-7589cbe086a5558eea018e1e3d25e388b26d51e8.tar.gz
minetest-7589cbe086a5558eea018e1e3d25e388b26d51e8.tar.bz2
minetest-7589cbe086a5558eea018e1e3d25e388b26d51e8.zip
Fix object interaction distance not being checked (#10547)
Diffstat (limited to 'src')
-rw-r--r--src/network/serverpackethandler.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 0bd09e637..95e7c548e 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -1050,12 +1050,13 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
}
float d = playersao->getEyePosition().getDistanceFrom(target_pos);
- if (!checkInteractDistance(player, d, pointed.dump())
- && pointed.type == POINTEDTHING_NODE) {
- // Re-send block to revert change on client-side
- RemoteClient *client = getClient(peer_id);
- v3s16 blockpos = getNodeBlockPos(pointed.node_undersurface);
- client->SetBlockNotSent(blockpos);
+ if (!checkInteractDistance(player, d, pointed.dump())) {
+ if (pointed.type == POINTEDTHING_NODE) {
+ // Re-send block to revert change on client-side
+ RemoteClient *client = getClient(peer_id);
+ v3s16 blockpos = getNodeBlockPos(pointed.node_undersurface);
+ client->SetBlockNotSent(blockpos);
+ }
return;
}
}