Fix aluminum powder recipe bug

This commit is contained in:
Joachim Stolberg 2021-09-10 15:43:48 +02:00
parent 3918f61437
commit f48ebf1b67
2 changed files with 20 additions and 1 deletions

View File

@ -342,9 +342,9 @@ dofile(MP.."/items/petroleum.lua")
dofile(MP.."/items/bauxit.lua")
dofile(MP.."/items/silicon.lua")
dofile(MP.."/items/steelmat.lua")
dofile(MP.."/items/aluminium.lua")
dofile(MP.."/items/powder.lua")
dofile(MP.."/items/epoxy.lua")
dofile(MP.."/items/aluminium.lua")
dofile(MP.."/items/plastic.lua")
dofile(MP.."/items/hydrogen.lua")
dofile(MP.."/items/electronic.lua")

View File

@ -30,6 +30,7 @@ help . . . print this text
cls . . . . . clear screen
gen . . . . print all generators
sto . . . . . print all storage systems
con . . . . . print main consumers
]])
local function row(num, label, data)
@ -137,6 +138,22 @@ local function storages(pos)
return table.concat(tbl, "\n")
end
local function consumers(pos)
local tbl = {}
local outdir = M(pos):get_int("outdir")
local netw = networks.get_network_table(pos, Cable, outdir) or {}
for _,item in ipairs(netw.con or {}) do
local number = techage.get_node_number(item.pos)
if number then
local name = techage.get_node_lvm(item.pos).name
name = (minetest.registered_nodes[name] or {}).description or "unknown"
tbl[#tbl + 1] = name .. " (" .. number .. ")"
end
end
table.sort(tbl)
return table.concat(tbl, "\n")
end
local function output(pos, command, text)
local meta = M(pos)
text = meta:get_string("output") .. "\n$ " .. command .. "\n" .. (text or "")
@ -160,6 +177,8 @@ local function command(pos, nvm, command)
output(pos, command, generators(pos))
elseif cmd == "sto" then
output(pos, command, storages(pos))
elseif cmd == "con" then
output(pos, command, consumers(pos))
elseif command ~= "" then
output(pos, command, "")
end