From 2e3a826ced504fcb72df95433474da909ff705ff Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Tue, 3 May 2022 16:28:49 -0400 Subject: [PATCH] fix https://github.com/mt-mods/homedecor_modpack/issues/17 --- building_blocks/node_stairs.lua | 8 +++++ building_blocks/stairs_compat.lua | 54 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 building_blocks/stairs_compat.lua diff --git a/building_blocks/node_stairs.lua b/building_blocks/node_stairs.lua index 41059212..14045282 100644 --- a/building_blocks/node_stairs.lua +++ b/building_blocks/node_stairs.lua @@ -1,4 +1,9 @@ local S = minetest.get_translator("building_blocks") +local stairs_compat + +if minetest.get_modpath("stairs") and not minetest.get_modpath("moreblocks") then + stairs_compat = dofile(minetest.get_modpath("building_blocks") .. "/stairs_compat.lua") +end local function building_blocks_stairs(nodename, def) minetest.register_node(nodename, def) @@ -11,6 +16,9 @@ local function building_blocks_stairs(nodename, def) minetest.register_alias("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner") minetest.register_alias("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer") end + if stairs_compat then + stairs_compat(nodename, def) + end end building_blocks_stairs("building_blocks:grate", { diff --git a/building_blocks/stairs_compat.lua b/building_blocks/stairs_compat.lua new file mode 100644 index 00000000..d355d303 --- /dev/null +++ b/building_blocks/stairs_compat.lua @@ -0,0 +1,54 @@ +local stairtable = { + { + "slab", + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + { + "stair", + { + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, + {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5}, + }, + }, + { + "stair_inner", + { + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, + {-0.5, 0.0, 0.0, 0.5, 0.5, 0.5}, + {-0.5, 0.0, -0.5, 0.0, 0.5, 0.0}, + }, + }, + { + "stair_outer", + { + {-0.5, -0.5, -0.5, 0.5, 0.0, 0.5}, + {-0.5, 0.0, 0.0, 0.0, 0.5, 0.5}, + }, + }, +} + +local function register(name, def) + for _, sdef in pairs(stairtable) do + local split = name:split(":") + local ndef = table.copy(def) + local item_name = ":" .. sdef[1] .. "_" .. split[2] + + ndef.description = def.description .. " " .. string.gsub(sdef[1], "_", " ") + ndef.paramtype, ndef.paramtype2 = "light", "facedir" + ndef.drawtype = "nodebox" + ndef.node_box = { + type = "fixed", + fixed = sdef[2], + } + + minetest.register_node(split[1] .. item_name, ndef) + minetest.register_alias("stairs" .. item_name, split[1] .. item_name) + end +end + +minetest.log( + "action", + "[building_blocks]: depreciated legacy support for stairs loaded, please use moreblocks for stair support" +) + +return register \ No newline at end of file