mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 01:30:38 +01:00
[moreblocks] Remove and alias some cut nodes
This commit is contained in:
parent
60b52b806b
commit
a253f5478d
@ -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,12 +97,14 @@ function circular_saw:get_output_inv(modname, material, amount, max)
|
||||
|
||||
for i = 1, #circular_saw.names do
|
||||
local t = circular_saw.names[i]
|
||||
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]
|
||||
if minetest.registered_nodes[nodename] then
|
||||
pos = pos + 1
|
||||
list[pos] = nodename .. " " .. balance
|
||||
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]
|
||||
if minetest.registered_nodes[nodename] then
|
||||
pos = pos + 1
|
||||
list[pos] = nodename .. " " .. balance
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
|
@ -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,19 +53,24 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
|
||||
|
||||
local desc = S("%s Microblock"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
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
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
def.description = desc
|
||||
if fields.drop then
|
||||
def.drop = modname.. ":micro_" ..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":" ..modname.. ":micro_" ..subname..alternate, def)
|
||||
end
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
def.description = desc
|
||||
if fields.drop then
|
||||
def.drop = modname.. ":micro_" ..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":" ..modname.. ":micro_" ..subname..alternate, def)
|
||||
end
|
||||
minetest.register_alias(modname.. ":micro_" ..subname.. "_bottom", modname.. ":micro_" ..subname)
|
||||
|
||||
|
@ -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,19 +53,24 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
|
||||
|
||||
local desc = S("%s Panel"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
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
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.description = desc
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
if fields.drop then
|
||||
def.drop = modname.. ":panel_" ..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":" ..modname.. ":panel_" ..subname..alternate, def)
|
||||
end
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.description = desc
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
if fields.drop then
|
||||
def.drop = modname.. ":panel_" ..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":" ..modname.. ":panel_" ..subname..alternate, def)
|
||||
end
|
||||
minetest.register_alias(modname.. ":panel_" ..subname.. "_bottom", modname.. ":panel_" ..subname)
|
||||
|
||||
|
@ -26,32 +26,37 @@ 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
|
||||
local def = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, (num/16)-0.5, 0.5},
|
||||
if type(num) == type("moo") then
|
||||
minetest.register_alias(modname .. ":slab_" .. subname .. alternate,
|
||||
modname .. ":slab_" .. subname .. num)
|
||||
else
|
||||
local def = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
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
|
||||
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
|
||||
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
|
||||
minetest.register_node(":" .. modname .. ":slab_" .. subname .. alternate, def)
|
||||
end
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
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
|
||||
minetest.register_node(":" .. modname .. ":slab_" .. subname .. alternate, def)
|
||||
end
|
||||
minetest.register_alias("stairs:slab_" .. subname, modname .. ":slab_" .. subname)
|
||||
|
||||
|
@ -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,19 +100,24 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
|
||||
|
||||
local desc = S("%s Stairs"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
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
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.description = desc
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
if fields.drop then
|
||||
def.drop = modname .. ":stair_" .. fields.drop .. alternate
|
||||
end
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. alternate, def)
|
||||
end
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
def.description = desc
|
||||
def.groups = stairsplus:prepare_groups(fields.groups)
|
||||
if fields.drop then
|
||||
def.drop = modname .. ":stair_" .. fields.drop .. alternate
|
||||
end
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. alternate, def)
|
||||
end
|
||||
minetest.register_alias("stairs:stair_" .. subname, modname .. ":stair_" .. subname)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user