]> git.lizzy.rs Git - minetest.git/commitdiff
Fix object interaction distance not being checked (#10547)
authorrubenwardy <rw@rubenwardy.com>
Mon, 9 Nov 2020 10:55:15 +0000 (10:55 +0000)
committerGitHub <noreply@github.com>
Mon, 9 Nov 2020 10:55:15 +0000 (11:55 +0100)
doc/lua_api.txt
src/network/serverpackethandler.cpp

index 38fc3066ac4d12969aec5faa61d27bd23956c62c..985af2f6e308a4f852dd52576b6fb221af861671 100644 (file)
@@ -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.
index 0bd09e63766fed7bf57b4a7cb91e05227e8cf37b..95e7c548e6dab0371bf4b7d81590b73fc8ef8feb 100644 (file)
@@ -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;
                }
        }