homedecor_modpack/building_blocks/stairs_compat.lua

54 lines
1.3 KiB
Lua

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