From 2dd774475f3734063624cf38aa5867c24e1cb505 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 29 Mar 2017 23:42:28 +0200 Subject: [PATCH] Check node rightclick for cacti and large plants --- mods/ITEMS/mcl_core/nodes.lua | 8 ++++++++ mods/ITEMS/mcl_flowers/init.lua | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/mods/ITEMS/mcl_core/nodes.lua b/mods/ITEMS/mcl_core/nodes.lua index 565d07fe39..69fe14b9c4 100644 --- a/mods/ITEMS/mcl_core/nodes.lua +++ b/mods/ITEMS/mcl_core/nodes.lua @@ -1168,6 +1168,14 @@ minetest.register_node("mcl_core:cactus", { return itemstack end + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + local a = pointed_thing.above local node_above = minetest.get_node(a) local node_below = minetest.get_node({x=a.x, y=a.y-1, z=a.z}) diff --git a/mods/ITEMS/mcl_flowers/init.lua b/mods/ITEMS/mcl_flowers/init.lua index e577349a94..03c0c7d85c 100644 --- a/mods/ITEMS/mcl_flowers/init.lua +++ b/mods/ITEMS/mcl_flowers/init.lua @@ -130,6 +130,15 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im if pointed_thing.type ~= "node" then --return end + + -- Call on_rightclick if the pointed node defines it + local node = minetest.get_node(pointed_thing.under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + -- Check for a floor and a space of 1×2×1 local ptu_node = minetest.get_node(pointed_thing.under) local bottom