Make stairplus:register_* functions work without using register_all.

This commit is contained in:
Pierre-Yves Rollo
2015-11-01 17:54:29 +01:00
parent f02a871c30
commit 54a7102291
8 changed files with 57 additions and 38 deletions

View File

@ -10,7 +10,7 @@ local S = moreblocks.intllib
-- Node will be called <modname>:slab_<subname>
function register_slab(modname, subname, recipeitem, groups, images, description, drop, light)
return stairsplus:register_slab(modname, subname, recipeitem, {
stairsplus:register_slab(modname, subname, recipeitem, {
groups = groups,
tiles = images,
description = description,
@ -30,6 +30,7 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
["_14"] = 14,
["_15"] = 15,
}
local desc_base = S("%s Slab"):format(fields.description)
for alternate, num in pairs(defs) do
local def = {
@ -38,14 +39,15 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
fixed = {-0.5, -0.5, -0.5, 0.5, (num/16)-0.5, 0.5},
}
}
for k, v in pairs(fields) do
def[k] = v
end
def.drawtype = "nodebox"
def.paramtype = "light"
def.paramtype2 = "facedir"
def.on_place = minetest.rotate_node
for k, v in pairs(fields) do
def[k] = v
end
def.description = ("%s (%d/16)"):format(desc_base, num)
def.groups = stairsplus:prepare_groups(fields.groups)
if fields.drop then
def.drop = modname.. ":slab_" .. fields.drop .. alternate
end
@ -53,6 +55,8 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
end
minetest.register_alias("stairs:slab_" .. subname, modname .. ":slab_" .. subname)
circular_saw.known_nodes[recipeitem] = {modname, subname}
-- Some saw-less recipes:
minetest.register_craft({