Skip to content

Commit

Permalink
Fix object interaction distance not being checked (#10547)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Nov 9, 2020
1 parent c940a57 commit 7589cbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/lua_api.txt
Expand Up @@ -6189,9 +6189,9 @@ object you are working with still exists.
* `bone`: string
* `position`: `{x=num, y=num, z=num}` (relative)
* `rotation`: `{x=num, y=num, z=num}` = Rotation on each axis, in degrees
* `forced_visible`: Boolean to control whether the attached entity
* `forced_visible`: Boolean to control whether the attached entity
should appear in first person.
* `get_attach()`: returns parent, bone, position, rotation, forced_visible,
* `get_attach()`: returns parent, bone, position, rotation, forced_visible,
or nil if it isn't attached.
* `get_children()`: returns a list of ObjectRefs that are attached to the
object.
Expand Down
13 changes: 7 additions & 6 deletions src/network/serverpackethandler.cpp
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 7589cbe

Please sign in to comment.