From d76b478b9fac602f5a5d0f7f6d717fc6b5683281 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 30 Jun 2023 20:40:17 +0200 Subject: [PATCH] Fix cut woodframe glass if workbench is off --- {src => handlers}/glasscut.lua | 0 handlers/registration.lua | 32 +++++++++++++++++++++++++------- init.lua | 1 + src/workbench.lua | 6 ++---- 4 files changed, 28 insertions(+), 11 deletions(-) rename {src => handlers}/glasscut.lua (100%) diff --git a/src/glasscut.lua b/handlers/glasscut.lua similarity index 100% rename from src/glasscut.lua rename to handlers/glasscut.lua diff --git a/handlers/registration.lua b/handlers/registration.lua index bbead1e..41cd738 100644 --- a/handlers/registration.lua +++ b/handlers/registration.lua @@ -68,13 +68,31 @@ local function xdecor_stairs_alternative(nodename, def) } ) elseif minetest.get_modpath("stairs") then - stairs.register_stair_and_slab(name,nodename, - def.groups, - def.tiles, - S("@1 Stair", def.description), - S("@1 Slab", def.description), - def.sounds - ) + local custom_tiles = xdecor.glasscuts[nodename] + if custom_tiles and (custom_tiles.slab or custom_tiles.stair) then + if custom_tiles.stair then + stairs.register_stair(name, nodename, + def.groups, custom_tiles.stair, S("@1 Stair", def.description), + def.sounds) + stairs.register_stair_inner(name, nodename, + def.groups, custom_tiles.stair_inner, "", def.sounds, nil, S("Inner @1 Stair", def.description)) + stairs.register_stair_outer(name, nodename, + def.groups, custom_tiles.stair_outer, "", def.sounds, nil, S("Outer @1 Stair", def.description)) + end + if custom_tiles.slab then + stairs.register_slab(name, nodename, + def.groups, custom_tiles.slab, S("@1 Slab", def.description), + def.sounds) + end + else + stairs.register_stair_and_slab(name,nodename, + def.groups, + def.tiles, + S("@1 Stair", def.description), + S("@1 Slab", def.description), + def.sounds + ) + end end end diff --git a/init.lua b/init.lua index 1399a1c..2d3f1ec 100644 --- a/init.lua +++ b/init.lua @@ -3,6 +3,7 @@ xdecor = {} local modpath = minetest.get_modpath("xdecor") +dofile(modpath .. "/handlers/glasscut.lua") dofile(modpath .. "/handlers/animations.lua") dofile(modpath .. "/handlers/helpers.lua") dofile(modpath .. "/handlers/nodeboxes.lua") diff --git a/src/workbench.lua b/src/workbench.lua index 47dba11..f23472f 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -1,5 +1,3 @@ -dofile(minetest.get_modpath("xdecor") .. "/src/glasscut.lua") - local workbench = {} local nodes = {} @@ -325,9 +323,9 @@ for i = 1, #nodes do groups, custom_tiles.stair, S("@1 Stair", def.description), def.sounds) stairs.register_stair_inner(item_name, node, - groups, custom_tiles.stair_inner, "", def.sounds) + groups, custom_tiles.stair_inner, "", def.sounds, nil, S("Inner @1 Stair", def.description)) stairs.register_stair_outer(item_name, node, - groups, custom_tiles.stair_outer, "", def.sounds) + groups, custom_tiles.stair_outer, "", def.sounds, nil, S("Outer @1 Stair", def.description)) end if custom_tiles.slab then stairs.register_slab(item_name, node,