From e45eca76e16ee68a0454799b8035aa2233cb72de Mon Sep 17 00:00:00 2001 From: fluxionary <25628292+fluxionary@users.noreply.github.com> Date: Sat, 17 Sep 2022 16:03:55 -0700 Subject: [PATCH] check if machine is protected before trying to break/place a node (#43) * check if target is protected before trying to break/place a node, so as not to trigger protection violations * check whether the machine is protected, not the target --- wielder.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/wielder.lua b/wielder.lua index dd4228c..6bde2df 100644 --- a/wielder.lua +++ b/wielder.lua @@ -336,11 +336,7 @@ if pipeworks.enable_node_breaker then masquerade_as_owner = true, sneak = false, act = function(virtplayer, pointed_thing) - local player_name = virtplayer:get_player_name() - if ( - minetest.is_protected(pointed_thing.above, player_name) or - minetest.is_protected(pointed_thing.under, player_name) - ) then + if minetest.is_protected(vector.add(virtplayer:get_pos(), assumed_eye_pos), virtplayer:get_player_name()) then return end @@ -435,11 +431,7 @@ if pipeworks.enable_deployer then masquerade_as_owner = true, sneak = false, act = function(virtplayer, pointed_thing) - local player_name = virtplayer:get_player_name() - if ( - minetest.is_protected(pointed_thing.above, player_name) or - minetest.is_protected(pointed_thing.under, player_name) - ) then + if minetest.is_protected(vector.add(virtplayer:get_pos(), assumed_eye_pos), virtplayer:get_player_name()) then return end