unknown 2022-05-03 16:28:49 -04:00
parent fe1b9a1ef1
commit 2e3a826ced
2 changed files with 62 additions and 0 deletions

View File

@ -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", {

View File

@ -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