Move node registrations to a separate file

This commit is contained in:
Thomas--S
2018-03-03 20:15:09 +01:00
committed by Hugo Locurcio
parent 4d2a7ab6fe
commit c711946453
7 changed files with 66 additions and 91 deletions

View File

@ -36,24 +36,8 @@ end
function stairsplus:register_stair(modname, subname, recipeitem, fields)
local defs = table.copy(stairsplus.defs["stair"])
local desc = S("%s Stairs"):format(fields.description)
for alternate, def in pairs(defs) do
for k, v in pairs(fields) do
def[k] = v
end
def.drawtype = "nodebox"
def.paramtype = "light"
def.paramtype2 = def.paramtype2 or "facedir"
def.on_place = minetest.rotate_node
def.description = desc
def.groups = stairsplus:prepare_groups(fields.groups)
if alternate == "" then
def.groups.stair = 1
end
if fields.drop and not (type(fields.drop) == "table") then
def.drop = modname .. ":stair_" .. fields.drop .. alternate
end
minetest.register_node(":" .. modname .. ":stair_" .. subname .. alternate, def)
stairsplus.register_single("stair", alternate, def, modname, subname, recipeitem, fields)
end
circular_saw.known_nodes[recipeitem] = {modname, subname}