summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2018-05-31 18:13:05 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2018-05-31 18:13:05 +0100
commit20f827f4fbee4031aec571628c9096ea75f88fdc (patch)
tree4de82fd9a8e9472b582a21dfcb62d4865ada9d53
parenta2b9d8f4efad88452c4b7d8a510bf992f57dd388 (diff)
add protection checks
-rw-r--r--beanpole.lua7
-rw-r--r--cocoa.lua5
-rw-r--r--grapes.lua7
3 files changed, 17 insertions, 2 deletions
diff --git a/beanpole.lua b/beanpole.lua
index 1e81dac..888a0a1 100644
--- a/beanpole.lua
+++ b/beanpole.lua
@@ -31,6 +31,11 @@ local function place_beans(itemstack, placer, pointed_thing, plantname)
return def.on_rightclick(pt.under, under, placer, itemstack)
end
+ -- check for protection
+ if minetest.is_protected(pt.under, placer:get_player_name()) then
+ return
+ end
+
-- check if pointing at bean pole
if under.name ~= "farming:beanpole" then
return
@@ -119,7 +124,7 @@ minetest.register_node("farming:beanpole", {
return def.on_rightclick(pt.under, under, placer, itemstack)
end
- if minetest.is_protected(pt.under, placer:get_player_name()) then
+ if minetest.is_protected(pt.above, placer:get_player_name()) then
return
end
diff --git a/cocoa.lua b/cocoa.lua
index a8491ac..71d038e 100644
--- a/cocoa.lua
+++ b/cocoa.lua
@@ -31,6 +31,11 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
return
end
+ -- check for protection
+ if minetest.is_protected(pt.above, placer:get_player_name()) then
+ return
+ end
+
-- add the node and remove 1 item from the itemstack
minetest.set_node(pt.above, {name = plantname})
diff --git a/grapes.lua b/grapes.lua
index 9a6ab9e..8b0ae2a 100644
--- a/grapes.lua
+++ b/grapes.lua
@@ -26,6 +26,11 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
return def.on_rightclick(pt.under, under, placer, itemstack)
end
+ -- check for protection
+ if minetest.is_protected(pt.under, placer:get_player_name()) then
+ return
+ end
+
-- check if pointing at trellis
if under.name ~= "farming:trellis" then
return
@@ -114,7 +119,7 @@ minetest.register_node("farming:trellis", {
return def.on_rightclick(pt.under, under, placer, itemstack)
end
- if minetest.is_protected(pt.under, placer:get_player_name()) then
+ if minetest.is_protected(pt.above, placer:get_player_name()) then
return
end