summaryrefslogtreecommitdiff
path: root/crops/grapes.lua
diff options
context:
space:
mode:
authorroot <root@linux-forks.de>2018-07-19 19:44:13 +0200
committerroot <root@linux-forks.de>2018-07-19 19:44:13 +0200
commitaaf20dcc464966c3565d5ceef23c1170b9c430b0 (patch)
treed1d6b84237d0f64261e83513c24e364f87922eef /crops/grapes.lua
parent48422e26c9f7bc50eb2d70601230172c842410ea (diff)
parent8606b41c95b36973f0e8901cd0868290aedc018f (diff)
Merge https://notabug.org/TenPlus1/Farming
Diffstat (limited to 'crops/grapes.lua')
-rw-r--r--crops/grapes.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/crops/grapes.lua b/crops/grapes.lua
index 8b0ae2a..d8c6c3f 100644
--- a/crops/grapes.lua
+++ b/crops/grapes.lua
@@ -22,12 +22,15 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
- if def and def.on_rightclick then
+ if placer and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack)
end
+ -- is player planting seed?
+ local name = placer and placer:get_player_name() or ""
+
-- check for protection
- if minetest.is_protected(pt.under, placer:get_player_name()) then
+ if minetest.is_protected(pt.under, name) then
return
end
@@ -41,7 +44,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0})
- if not farming.is_creative(placer:get_player_name()) then
+ if placer and not farming.is_creative(placer:get_player_name()) then
itemstack:take_item()