1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 17:50:37 +01:00

[moreblocks] Remove and alias some cut nodes

This commit is contained in:
LeMagnesium 2016-05-07 20:06:18 +02:00
parent 60b52b806b
commit a253f5478d
5 changed files with 96 additions and 115 deletions

View File

@ -31,36 +31,33 @@ circular_saw.cost_in_microblocks = {
6, 2, 1, 3, 4,
}
-- This parameter is legacy node
circular_saw.names = {
{"micro", "_1"},
{"panel", "_1"},
{"micro", "_2"},
{"panel", "_2"},
{"micro", "_4"},
{"panel", "_4"},
{"micro", ""},
{"panel", ""},
{"micro", "_12"},
{"panel", "_12"},
{"micro", "_14"},
{"panel", "_14"},
{"micro", "_15"},
{"panel", "_15"},
{"stair", "_outer"},
{"stair", ""},
{"stair", "_inner"},
{"slab", "_1"},
{"slab", "_2"},
{"slab", "_quarter"},
{"slab", ""},
{"slab", "_three_quarter"},
{"slab", "_14"},
{"slab", "_15"},
{"stair", "_half"},
{"stair", "_alt_1"},
{"stair", "_alt_2"},
{"stair", "_alt_4"},
{"stair", "_alt"},
{"slope", ""},
{"slope", "_half"},
{"slope", "_half_raised"},
@ -100,6 +97,7 @@ function circular_saw:get_output_inv(modname, material, amount, max)
for i = 1, #circular_saw.names do
local t = circular_saw.names[i]
if not t[3] then
local cost = circular_saw.cost_in_microblocks[i]
local balance = math.min(math.floor(amount/cost), max)
local nodename = modname .. ":" .. t[1] .. "_" .. material .. t[2]
@ -108,6 +106,7 @@ function circular_saw:get_output_inv(modname, material, amount, max)
list[pos] = nodename .. " " .. balance
end
end
end
return list
end

View File

@ -34,30 +34,15 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
},
},
["_4"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
},
},
["_2"] = {legacy = "_1"},
["_4"] = {legacy = ""},
["_12"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
},
},
["_14"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
},
},
["_14"] = {legacy = "_15"},
["_15"] = {
node_box = {
type = "fixed",
@ -68,6 +53,10 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
local desc = S("%s Microblock"):format(fields.description)
for alternate, def in pairs(defs) do
if def.legacy then
minetest.register_alias(modname .. ":micro_" .. subname .. alternate,
modname .. ":micro_" .. subname .. def.legacy)
else
for k, v in pairs(fields) do
def[k] = v
end
@ -82,6 +71,7 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
end
minetest.register_node(":" ..modname.. ":micro_" ..subname..alternate, def)
end
end
minetest.register_alias(modname.. ":micro_" ..subname.. "_bottom", modname.. ":micro_" ..subname)
circular_saw.known_nodes[recipeitem] = {modname, subname}

View File

@ -34,30 +34,15 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
},
},
["_4"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
},
},
["_2"] = {legacy = "_1"},
["_4"] = {legacy = ""},
["_12"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
},
},
["_14"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
},
},
["_14"] = {legacy = "_15"},
["_15"] = {
node_box = {
type = "fixed",
@ -68,6 +53,10 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
local desc = S("%s Panel"):format(fields.description)
for alternate, def in pairs(defs) do
if def.legacy then
minetest.register_alias(modname .. ":panel_" .. subname .. alternate,
modname .. ":panel_" .. subname .. def.legacy)
else
for k, v in pairs(fields) do
def[k] = v
end
@ -82,6 +71,7 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
end
minetest.register_node(":" ..modname.. ":panel_" ..subname..alternate, def)
end
end
minetest.register_alias(modname.. ":panel_" ..subname.. "_bottom", modname.. ":panel_" ..subname)
circular_saw.known_nodes[recipeitem] = {modname, subname}

View File

@ -26,13 +26,17 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
["_quarter"] = 4,
["_three_quarter"] = 12,
["_1"] = 1,
["_2"] = 2,
["_14"] = 14,
["_2"] = "_1",
["_14"] = "_three_quarter",
["_15"] = 15,
}
local desc_base = S("%s Slab"):format(fields.description)
for alternate, num in pairs(defs) do
if type(num) == type("moo") then
minetest.register_alias(modname .. ":slab_" .. subname .. alternate,
modname .. ":slab_" .. subname .. num)
else
local def = {
node_box = {
type = "fixed",
@ -53,6 +57,7 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
end
minetest.register_node(":" .. modname .. ":slab_" .. subname .. alternate, def)
end
end
minetest.register_alias("stairs:slab_" .. subname, modname .. ":slab_" .. subname)
circular_saw.known_nodes[recipeitem] = {modname, subname}

View File

@ -86,15 +86,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
},
},
},
["_alt_2"] = {
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.125, -0.5, 0.5, 0, 0},
{-0.5, 0.375, 0, 0.5, 0.5, 0.5},
},
},
},
["_alt_2"] = {legacy = "_alt_1"},
["_alt_4"] = {
node_box = {
type = "fixed",
@ -108,6 +100,10 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
local desc = S("%s Stairs"):format(fields.description)
for alternate, def in pairs(defs) do
if def.legacy then
minetest.register_alias(modname .. ":stair_" .. subname .. alternate,
modname .. ":stair_" .. subname .. def.legacy)
else
for k, v in pairs(fields) do
def[k] = v
end
@ -122,6 +118,7 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
end
minetest.register_node(":" .. modname .. ":stair_" .. subname .. alternate, def)
end
end
minetest.register_alias("stairs:stair_" .. subname, modname .. ":stair_" .. subname)
circular_saw.known_nodes[recipeitem] = {modname, subname}