mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-29 18:43:53 +01:00
Put protection condition as late as possible to reduce work, and skip but do not exit if protected
This commit is contained in:
parent
ac558e89fe
commit
7aca6c68b6
@ -216,14 +216,11 @@ local function harvest_field(this, meta)
|
|||||||
end
|
end
|
||||||
for y_pos = start_y_pos,stop_y_pos,-1 do
|
for y_pos = start_y_pos,stop_y_pos,-1 do
|
||||||
pos.y = y_pos
|
pos.y = y_pos
|
||||||
if minetest.is_protected(pos, this.owner) then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
local node = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if node and node.name ~= "air" then
|
if node and node.name ~= "air" then
|
||||||
local order = tubelib_addons1.FarmingNodes[node.name] or tubelib_addons1.Flowers[node.name]
|
local order = tubelib_addons1.FarmingNodes[node.name] or tubelib_addons1.Flowers[node.name]
|
||||||
if order then
|
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
|
return false
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user