This commit is contained in:
beyondlimits 2015-06-27 12:10:19 +00:00
commit ac9b0424db
7 changed files with 102 additions and 303 deletions

View File

@ -21,12 +21,14 @@ circular_saw.known_stairs = setmetatable({}, {
circular_saw.known_nodes = {}
-- How many microblocks does this shape at the output inventory cost:
-- It may cause slight loss, but no gain.
circular_saw.cost_in_microblocks = {
1, 1, 1, 1, 1, 1, 1, 2,
2, 3, 2, 4, 2, 4, 5, 6,
7, 1, 1, 2, 4, 6, 7, 8,
3, 1, 1, 2, 4, 4, 2, 7,
7, 2, 7, 6, 4, 6, 5, 4,
3, 1, 1, 2, 4, 4, 2, 6,
7, 3, 7, 7, 4, 8, 3, 2,
6, 2, 1, 3, 4
}
circular_saw.names = {
@ -65,11 +67,16 @@ circular_saw.names = {
{"slope", "_inner"},
{"slope", "_inner_half"},
{"slope", "_inner_half_raised"},
{"slope", "_inner_cut"},
{"slope", "_inner_cut_half"},
{"slope", "_inner_cut_half_raised"},
{"slope", "_outer"},
{"slope", "_outer_half"},
{"slope", "_outer_half_raised"},
{"slope", "_outer_cut"},
{"slope", "_outer_cut_half"},
{"slope", "_outer_cut_half_raised"},
{"slope", "_cut"},
}
function circular_saw:get_cost(inv, stackname)
@ -303,7 +310,7 @@ gui_slots = "listcolors[#606060AA;#808080;#101010;#202020;#FFF]"
function circular_saw.on_construct(pos)
local meta = minetest.get_meta(pos)
local fancy_inv = default.gui_bg..default.gui_bg_img..default.gui_slots
meta:set_string("formspec", "size[11,9]"..fancy_inv..
meta:set_string("formspec", "size[11,10]"..fancy_inv..
"label[0,0;" ..S("Input\nmaterial").. "]" ..
"list[current_name;input;1.5,0;1,1;]" ..
"label[0,1;" ..S("Left-over").. "]" ..
@ -312,8 +319,8 @@ function circular_saw.on_construct(pos)
"list[current_name;recycle;1.5,2;1,1;]" ..
"field[0.3,3.5;1,1;max_offered;" ..S("Max").. ":;${max_offered}]" ..
"button[1,3.2;1,1;Set;" ..S("Set").. "]" ..
"list[current_name;output;2.8,0;8,5;]" ..
"list[current_player;main;1.5,5.25;8,4;]")
"list[current_name;output;2.8,0;8,6;]" ..
"list[current_player;main;1.5,6.25;8,4;]")
meta:set_int("anz", 0) -- No microblocks inside yet.
meta:set_string("max_offered", 99) -- How many items of this kind are offered by default?
@ -323,7 +330,7 @@ function circular_saw.on_construct(pos)
inv:set_size("input", 1) -- Input slot for full blocks of material x.
inv:set_size("micro", 1) -- Storage for 1-7 surplus microblocks.
inv:set_size("recycle", 1) -- Surplus partial blocks can be placed here.
inv:set_size("output", 5*8) -- 5x8 versions of stair-parts of material x.
inv:set_size("output", 6*8) -- 6x8 versions of stair-parts of material x.
circular_saw:reset(pos)
end

View File

@ -85,40 +85,66 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
minetest.register_alias(modname.. ":micro_" ..subname.. "_bottom", modname.. ":micro_" ..subname)
-- Some saw-less recipes:
-- chopping into microblocks
-- full block minus 1 microblock
minetest.register_craft({
type = "shapeless",
output = modname .. ":micro_" .. subname .. " 7",
recipe = {modname .. ":stair_" .. subname .. "_inner"},
})
-- stair
minetest.register_craft({
output = modname .. ":micro_" .. subname .. " 6",
type = "shapeless",
recipe = {modname .. ":stair_" .. subname},
})
-- slab + 1 microblock
minetest.register_craft({
type = "shapeless",
output = modname .. ":micro_" .. subname .. " 5",
recipe = {modname .. ":stair_" .. subname .. "_outer"},
})
-- slab
minetest.register_craft({
type = "shapeless",
output = modname .. ":micro_" .. subname .. " 4",
recipe = {modname .. ":slab_" .. subname},
})
-- right half stair
-- NOTE: this is circular crafting rule:
-- 3 microblocks -> left half stair -> right half stair -> 3 microblocks
minetest.register_craft({
type = "shapeless",
output = modname .. ":micro_" .. subname .. " 3",
recipe = {modname .. ":stair_" .. subname .. "_right_half"},
})
-- panel
minetest.register_craft({
type = "shapeless",
output = modname .. ":micro_" .. subname .. " 2",
recipe = {modname .. ":panel_" .. subname},
})
})
-- coupling microblocks back to full block
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname, modname .. ":micro_" .. subname},
recipe = {
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
modname .. ":micro_" .. subname,
}
})
end

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

View File

@ -235,248 +235,4 @@ function stairsplus:register_slope(modname, subname, recipeitem, fields)
end
minetest.register_node(":" ..modname.. ":slope_" ..subname..alternate, def)
end
-- Some saw-less recipes:
minetest.register_craft({
output = modname .. ":slope_" .. subname .. " 7",
recipe = {
{modname .. ":panel_" .. subname, "", ""},
{recipeitem, modname .. ":panel_" .. subname, ""},
{recipeitem, recipeitem, modname .. ":panel_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. " 7",
recipe = {
{"", "", modname .. ":panel_" .. subname},
{"", modname .. ":panel_" .. subname, recipeitem},
{modname .. ":panel_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half 10",
recipe = {
{modname .. ":panel_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":panel_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half 10",
recipe = {
{"", "", modname .. ":panel_" .. subname},
{modname .. ":panel_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half_raised 7",
recipe = {
{modname .. ":panel_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":panel_" .. subname},
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_half_raised 7",
recipe = {
{"", "", modname .. ":panel_" .. subname},
{modname .. ":panel_" .. subname, recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
--===================================================== Inner ==
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner 7",
recipe = {
{modname .. ":stair_" .. subname .. "_half", "", ""},
{recipeitem, modname .. ":stair_" .. subname .. "_half", ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname .. "_half"},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner 7",
recipe = {
{"", "", modname .. ":stair_" .. subname .. "_half"},
{"", modname .. ":stair_" .. subname .. "_half", recipeitem},
{modname .. ":stair_" .. subname .. "_half", recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half 10",
recipe = {
{modname .. ":stair_" .. subname .. "_half", "", ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname .. "_half"},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half 10",
recipe = {
{"", "", modname .. ":stair_" .. subname .. "_half"},
{modname .. ":stair_" .. subname .. "_half", recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half_raised 7",
recipe = {
{modname .. ":stair_" .. subname .. "_half", "", ""},
{recipeitem, recipeitem, modname .. ":stair_" .. subname .. "_half"},
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_inner_half_raised 7",
recipe = {
{"", "", modname .. ":stair_" .. subname .. "_half"},
{modname .. ":stair_" .. subname .. "_half", recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
--===================================================== Outer ==
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer 7",
recipe = {
{modname .. ":micro_" .. subname, "", ""},
{recipeitem, modname .. ":micro_" .. subname, ""},
{recipeitem, recipeitem, modname .. ":micro_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer 7",
recipe = {
{"", "", modname .. ":micro_" .. subname},
{"", modname .. ":micro_" .. subname, recipeitem},
{modname .. ":micro_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half 10",
recipe = {
{modname .. ":micro_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":micro_" .. subname},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half 10",
recipe = {
{"", "", modname .. ":micro_" .. subname},
{modname .. ":micro_" .. subname, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half_raised 7",
recipe = {
{modname .. ":micro_" .. subname, "", ""},
{recipeitem, recipeitem, modname .. ":micro_" .. subname},
{recipeitem, recipeitem, recipeitem},
},
})
minetest.register_craft({
output = modname .. ":slope_" .. subname .. "_outer_half_raised 7",
recipe = {
{"", "", modname .. ":micro_" .. subname},
{modname .. ":micro_" .. subname, recipeitem, recipeitem},
{recipeitem, recipeitem, recipeitem},
},
})
--================================================= Shapeless ==
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname, modname .. ":slope_" .. subname},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname .. "_outer_cut", modname .. ":slope_" .. subname .. "_outer_cut"},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half_raised"},
})
minetest.register_craft({
type = "shapeless",
output = recipeitem,
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half",
modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slab_" .. subname,
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_half_raised",
recipe = {modname .. ":slope_" .. subname .. "_half", modname .. ":slope_" .. subname .. "_half",
modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_half_raised",
recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_inner_half_raised",
recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_inner_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_half_raised",
recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_outer_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut_half_raised",
recipe = {modname .. ":slab_" .. subname, modname .. ":slope_" .. subname .. "_outer_cut_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut",
recipe = {modname .. ":slope_" .. subname .. "_outer"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut_half",
recipe = {modname .. ":slope_" .. subname .. "_outer_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":slope_" .. subname .. "_outer_cut_half_raised",
recipe = {modname .. ":slope_" .. subname .. "_outer_half_raised"},
})
end

View File

@ -179,12 +179,6 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
recipe = {modname .. ":stair_" .. subname .. "_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname .. "_half",
recipe = {modname .. ":stair_" .. subname .. "_right_half"},
})
minetest.register_craft({
type = "shapeless",
output = modname .. ":stair_" .. subname,