mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-07-01 07:30:43 +02:00
Move node registrations to a separate file
This commit is contained in:
@ -38,38 +38,7 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
|
||||
local defs = table.copy(stairsplus.defs["slab"])
|
||||
local desc_base = S("%s Slab"):format(fields.description)
|
||||
for alternate, shape in pairs(defs) do
|
||||
local def = {}
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
end
|
||||
if type(shape) ~= "table" then
|
||||
def.node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, (shape/16)-0.5, 0.5},
|
||||
}
|
||||
def.description = ("%s (%d/16)"):format(desc_base, shape)
|
||||
else
|
||||
def.node_box = {
|
||||
type = "fixed",
|
||||
fixed = shape,
|
||||
}
|
||||
local desc_x = alternate:gsub("_", " ")
|
||||
desc_x = desc_x:gsub("(%a)(%S*)", function(a, b) return a:upper() .. b end)
|
||||
def.description = desc_base .. desc_x
|
||||
end
|
||||
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = def.paramtype2 or "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
if alternate == "" then
|
||||
def.groups.slab = 1
|
||||
end
|
||||
if fields.drop and not (type(fields.drop) == "table") then
|
||||
def.drop = modname.. ":slab_" .. fields.drop .. alternate
|
||||
end
|
||||
minetest.register_node(":" .. modname .. ":slab_" .. subname .. alternate, def)
|
||||
stairsplus.register_single("slab", alternate, shape, modname, subname, recipeitem, fields)
|
||||
end
|
||||
|
||||
circular_saw.known_nodes[recipeitem] = {modname, subname}
|
||||
|
Reference in New Issue
Block a user