From ac558e89fe76db8de9a36ba6a808796b92288346 Mon Sep 17 00:00:00 2001 From: Cam B Date: Sun, 13 Dec 2020 02:31:26 +0000 Subject: [PATCH 1/2] Check harvester protection for each node it attempts to harvest --- tubelib_addons1/harvester.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tubelib_addons1/harvester.lua b/tubelib_addons1/harvester.lua index 37b05f6..a486d84 100644 --- a/tubelib_addons1/harvester.lua +++ b/tubelib_addons1/harvester.lua @@ -216,6 +216,9 @@ local function harvest_field(this, meta) end for y_pos = start_y_pos,stop_y_pos,-1 do pos.y = y_pos + if minetest.is_protected(pos, this.owner) then + return true + end local node = minetest.get_node_or_nil(pos) if node and node.name ~= "air" then local order = tubelib_addons1.FarmingNodes[node.name] or tubelib_addons1.Flowers[node.name] From 7aca6c68b6ba7c925d7cd85b6739c52cfc0234cd Mon Sep 17 00:00:00 2001 From: Cam B Date: Mon, 14 Dec 2020 22:05:29 +0000 Subject: [PATCH 2/2] Put protection condition as late as possible to reduce work, and skip but do not exit if protected --- tubelib_addons1/harvester.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tubelib_addons1/harvester.lua b/tubelib_addons1/harvester.lua index a486d84..e371a6d 100644 --- a/tubelib_addons1/harvester.lua +++ b/tubelib_addons1/harvester.lua @@ -216,14 +216,11 @@ local function harvest_field(this, meta) end for y_pos = start_y_pos,stop_y_pos,-1 do pos.y = y_pos - if minetest.is_protected(pos, this.owner) then - return true - end local node = minetest.get_node_or_nil(pos) if node and node.name ~= "air" then local order = tubelib_addons1.FarmingNodes[node.name] or tubelib_addons1.Flowers[node.name] if order then - if not remove_or_replace_node(this, pos, inv, node, order) then + if not minetest.is_protected(pos, this.owner) and not remove_or_replace_node(this, pos, inv, node, order) then return false end else