summaryrefslogtreecommitdiff
path: root/cocoa.lua
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2016-12-16 13:41:55 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2016-12-16 13:41:55 +0000
commit4d5bd4fff1bd5ebf1212e14dc2392c049be68505 (patch)
tree862cbe57c7ad9f23a3aaec37ccc6639a5d0b349b /cocoa.lua
parentb2f013ba025b8d67518938846dd7d16e35d4b6f1 (diff)
added cocoa beans on_rightclick check for custom nodes
Diffstat (limited to 'cocoa.lua')
-rw-r--r--cocoa.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/cocoa.lua b/cocoa.lua
index 29cc96b..fad1733 100644
--- a/cocoa.lua
+++ b/cocoa.lua
@@ -10,14 +10,21 @@ function place_cocoa(itemstack, placer, pointed_thing, plantname)
if not pt or pt.type ~= "node" then
return
end
-
+
local under = minetest.get_node(pt.under)
-
+
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
+ -- 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
+ return def.on_rightclick(pt.under, under, placer, itemstack)
+ end
+
-- check if pointing at jungletree
if under.name ~= "default:jungletree"
or minetest.get_node(pt.above).name ~= "air" then