2019-12-14 17:47:31 +01:00
|
|
|
--[[
|
|
|
|
More Blocks: registrations
|
|
|
|
|
2021-05-16 15:01:47 +02:00
|
|
|
Copyright (c) 2011-2018 Hugo Locurcio and contributors.
|
2019-12-14 17:47:31 +01:00
|
|
|
Licensed under the zlib license. See LICENSE.md for more information.
|
|
|
|
--]]
|
|
|
|
|
2021-05-16 15:01:47 +02:00
|
|
|
local S = moreblocks.intllib
|
2019-12-14 17:47:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
stairsplus.register_single = function(category, alternate, info, modname, subname, recipeitem, fields)
|
2021-05-16 15:01:47 +02:00
|
|
|
local descriptions = {
|
|
|
|
["micro"] = "Microblock",
|
|
|
|
["slab"] = "Slab",
|
|
|
|
["slope"] = "Slope",
|
|
|
|
["panel"] = "Panel",
|
|
|
|
["stair"] = "Stairs",
|
|
|
|
}
|
2019-12-14 17:47:31 +01:00
|
|
|
local def = {}
|
|
|
|
if category ~= "slab" then
|
|
|
|
def = table.copy(info)
|
|
|
|
end
|
|
|
|
|
|
|
|
for k, v in pairs(fields) do
|
|
|
|
def[k] = v
|
|
|
|
end
|
|
|
|
def.drawtype = "nodebox"
|
2021-05-16 15:01:47 +02:00
|
|
|
if category == "slope" then
|
|
|
|
def.drawtype = "mesh"
|
|
|
|
end
|
2019-12-14 17:47:31 +01:00
|
|
|
def.paramtype = "light"
|
|
|
|
def.paramtype2 = def.paramtype2 or "facedir"
|
2021-05-16 15:01:47 +02:00
|
|
|
def.on_place = minetest.rotate_node
|
|
|
|
if category ~= "slab" then
|
|
|
|
def.description = S("%s " .. descriptions[category]):format(fields.description)
|
|
|
|
else
|
|
|
|
local desc_base = S("%s " .. descriptions[category]):format(fields.description)
|
2019-12-14 17:47:31 +01:00
|
|
|
if type(info) ~= "table" then
|
|
|
|
def.node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, (info/16)-0.5, 0.5},
|
|
|
|
}
|
|
|
|
def.description = ("%s (%d/16)"):format(desc_base, info)
|
|
|
|
else
|
|
|
|
def.node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = info,
|
|
|
|
}
|
|
|
|
def.description = desc_base .. alternate:gsub("_", " "):gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end)
|
|
|
|
end
|
|
|
|
end
|
2021-05-16 15:01:47 +02:00
|
|
|
def.groups = stairsplus:prepare_groups(fields.groups)
|
|
|
|
if category == "stair" and alternate == "" then
|
|
|
|
def.groups.stair = 1
|
|
|
|
end
|
2019-12-14 17:47:31 +01:00
|
|
|
if fields.drop and not (type(fields.drop) == "table") then
|
|
|
|
def.drop = modname.. ":" .. category .. "_" .. fields.drop .. alternate
|
|
|
|
end
|
2023-07-04 18:50:42 +02:00
|
|
|
def.place_param2=nil
|
2019-12-14 17:47:31 +01:00
|
|
|
minetest.register_node(":" ..modname.. ":" .. category .. "_" .. subname .. alternate, def)
|
|
|
|
stairsplus.register_recipes(category, alternate, modname, subname, recipeitem)
|
2021-05-16 15:01:47 +02:00
|
|
|
end
|