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

View File

@ -36,18 +36,25 @@ local default_nodes = { -- Default stairs/slabs/panels/microblocks:
for _, name in pairs(default_nodes) do for _, name in pairs(default_nodes) do
local nodename = "default:" .. name local nodename = "default:" .. name
local ndef = minetest.registered_nodes[nodename] local ndef = minetest.registered_nodes[nodename]
if ndef then if ndef then
local groups = {} 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: -- 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 groups[k] = v
end end
end end
local drop 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 if type(ndef.drop) == "string" then
drop = ndef.drop:sub(9) drop = ndef.drop:sub(9)
end end
stairsplus:register_all("moreblocks", name, nodename, { stairsplus:register_all("moreblocks", name, nodename, {
description = ndef.description, description = ndef.description,
drop = drop, drop = drop,
@ -58,4 +65,3 @@ for _, name in pairs(default_nodes) do
}) })
end end
end end

View File

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