From 26ac17f1adeedfaf64c6f190060bc610ce1cd20e Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 9 Dec 2019 19:09:44 +0100 Subject: [PATCH] Can flip slabs with screwdriver --- mods/ITEMS/mcl_stairs/api.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_stairs/api.lua b/mods/ITEMS/mcl_stairs/api.lua index b28d2d245..9f396473b 100644 --- a/mods/ITEMS/mcl_stairs/api.lua +++ b/mods/ITEMS/mcl_stairs/api.lua @@ -143,7 +143,7 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript node.param2 = node.param2 + 20 end minetest.set_node(pos, node) - return false + return true end end, _mcl_hardness = hardness, @@ -262,6 +262,15 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti end, _mcl_hardness = hardness, _mcl_other_slab_half = upper_slab, + on_rotate = function(pos, node, user, mode, param2) + -- Flip slab + if mode == screwdriver.ROTATE_AXIS then + node.name = upper_slab + minetest.set_node(pos, node) + return true + end + return false + end, } minetest.register_node(":"..lower_slab, slabdef) @@ -280,6 +289,15 @@ function mcl_stairs.register_slab(subname, recipeitem, groups, images, descripti topdef._doc_items_usagehelp = nil topdef.drop = lower_slab topdef._mcl_other_slab_half = lower_slab + topdef.on_rotate = function(pos, node, user, mode, param2) + -- Flip slab + if mode == screwdriver.ROTATE_AXIS then + node.name = lower_slab + minetest.set_node(pos, node) + return true + end + return false + end topdef.node_box = { type = "fixed", fixed = {-0.5, 0, -0.5, 0.5, 0.5, 0.5},