forked from MineClone5/MineClone5
Check node rightclick for cacti and large plants
This commit is contained in:
parent
30564e494e
commit
2dd774475f
|
@ -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})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue