This commit is contained in:
Marcin 2015-06-27 12:07:31 +02:00
parent 825bd17e50
commit 795f029809
3 changed files with 60 additions and 44 deletions

View File

@ -22,43 +22,43 @@ end
function stairsplus:register_panel(modname, subname, recipeitem, fields)
local defs = {
[""] = {
[""] = { -- 8/16 high (default panel)
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
},
},
["_1"] = {
["_1"] = { -- 1/16 high
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
},
},
["_2"] = {
["_2"] = { -- 2/16 high
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
},
},
["_4"] = {
["_4"] = { -- 4/16 high
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
},
},
["_12"] = {
["_12"] = { -- 12/16 high
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
},
},
["_14"] = {
["_14"] = { -- 14/16 high
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
},
},
["_15"] = {
["_15"] = { -- 15/16 high
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
@ -85,6 +85,7 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
-- Some saw-less recipes:
-- 3 blocks shaped to stair -> 12 panels
minetest.register_craft({
output = modname .. ":panel_" .. subname .. " 12",
recipe = {
@ -93,6 +94,7 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
},
})
-- mirrored rule from above
minetest.register_craft({
output = modname .. ":panel_" .. subname .. " 12",
recipe = {
@ -101,12 +103,14 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
},
})
-- 2 microblocks -> panel
minetest.register_craft({
type = "shapeless",
output = modname .. ":panel_" .. subname,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
-- 4 panels -> full block
minetest.register_craft({
type = "shapeless",
output = recipeitem,

View File

@ -36,18 +36,25 @@ local default_nodes = { -- Default stairs/slabs/panels/microblocks:
for _, name in pairs(default_nodes) do
local nodename = "default:" .. name
local ndef = minetest.registered_nodes[nodename]
if ndef then
local groups = {}
for k, v in pairs(ndef.groups)
for k, v in pairs(ndef.groups) do
-- Ignore wood and stone groups to not make them usable in crafting:
do if k ~= "wood" and k ~= "stone" then
if k ~= "wood" and k ~= "stone" then
groups[k] = v
end
end
local drop
-- Take string part after "default:" since we want to register
-- things in microblocks namespace instead of default
if type(ndef.drop) == "string" then
drop = ndef.drop:sub(9)
end
stairsplus:register_all("moreblocks", name, nodename, {
description = ndef.description,
drop = drop,
@ -58,4 +65,3 @@ for _, name in pairs(default_nodes) do
})
end
end

View File

@ -55,39 +55,45 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
-- Some saw-less recipes:
minetest.register_craft({
output = modname .. ":slab_" .. subname .. " 6",
recipe = {{recipeitem, recipeitem, recipeitem}},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slab_" .. subname,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
minetest.register_craft({
output = modname .. ":slab_" .. subname,
recipe = {{modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}},
})
minetest.register_craft({
output = modname .. ":slab_" .. subname,
recipe = {
{modname .. ":panel_" .. subname},
{modname .. ":panel_" .. subname},
},
})
-- 3 full blocks -> 6 slabs
minetest.register_craft({
output = modname .. ":slab_" .. subname .. " 6",
recipe = {{recipeitem, recipeitem, recipeitem}},
})
-- 4 microblocks -> slab
minetest.register_craft({
type = "shapeless",
output = modname .. ":slab_" .. subname,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
})
-- 2 panels -> slab
minetest.register_craft({
output = modname .. ":slab_" .. subname,
recipe = {{modname .. ":panel_" .. subname, modname .. ":panel_" .. subname}},
})
-- same as above but vertically
minetest.register_craft({
output = modname .. ":slab_" .. subname,
recipe = {
{modname .. ":panel_" .. subname},
{modname .. ":panel_" .. subname},
},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slab_" .. subname .. " 3",
recipe = {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname},
})
-- 2 slabs -> full block
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slab_" .. subname, modname .. ":slab_" .. subname},
})
-- 2 stairs -> 3 slabs
minetest.register_craft({
type = "shapeless",
output = modname .. ":slab_" .. subname .. " 3",
recipe = {modname .. ":stair_" .. subname, modname .. ":stair_" .. subname},
})
end