From dde6c678ada4ccc668e5964b5f03dbcab0a0657d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 24 Jul 2017 20:10:13 +0200 Subject: [PATCH] Correct stair/slab rightclick handling --- mods/ITEMS/mcl_stairs/api.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mods/ITEMS/mcl_stairs/api.lua b/mods/ITEMS/mcl_stairs/api.lua index cacf65dbc..349ce8139 100644 --- a/mods/ITEMS/mcl_stairs/api.lua +++ b/mods/ITEMS/mcl_stairs/api.lua @@ -1,4 +1,12 @@ local function place_slab_normal(itemstack, placer, pointed_thing) + -- Use pointed node's on_rightclick function first, if present + 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 p0 = pointed_thing.under local p1 = pointed_thing.above @@ -19,6 +27,14 @@ local function place_slab_normal(itemstack, placer, pointed_thing) end local function place_stair(itemstack, placer, pointed_thing) + -- Use pointed node's on_rightclick function first, if present + 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 p0 = pointed_thing.under local p1 = pointed_thing.above local param2 = 0