From 644187e204c9b4777a28f57e836eb2da7fb9e69d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 9 Dec 2019 16:27:11 +0100 Subject: [PATCH] Add secondary screwdriver support for stairs --- mods/ITEMS/mcl_stairs/api.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/mods/ITEMS/mcl_stairs/api.lua b/mods/ITEMS/mcl_stairs/api.lua index a6e6c65945..b28d2d2450 100644 --- a/mods/ITEMS/mcl_stairs/api.lua +++ b/mods/ITEMS/mcl_stairs/api.lua @@ -121,6 +121,31 @@ function mcl_stairs.register_stair(subname, recipeitem, groups, images, descript return place_stair(itemstack, placer, pointed_thing) end, + on_rotate = function(pos, node, user, mode, param2) + -- Flip stairs vertically + if mode == screwdriver.ROTATE_AXIS then + local minor = node.param2 + if node.param2 >= 20 then + minor = node.param2 - 20 + if minor == 3 then + minor = 1 + elseif minor == 1 then + minor = 3 + end + node.param2 = minor + else + if minor == 3 then + minor = 1 + elseif minor == 1 then + minor = 3 + end + node.param2 = minor + node.param2 = node.param2 + 20 + end + minetest.set_node(pos, node) + return false + end + end, _mcl_hardness = hardness, })