From f48ebf1b678fea36215847b68bbbfdbb5105d70d Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Fri, 10 Sep 2021 15:43:48 +0200 Subject: [PATCH] Fix aluminum powder recipe bug --- init.lua | 2 +- power/power_terminal2.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 53e0ca4..0d6810f 100644 --- a/init.lua +++ b/init.lua @@ -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") diff --git a/power/power_terminal2.lua b/power/power_terminal2.lua index e1513b2..9cb8dd4 100644 --- a/power/power_terminal2.lua +++ b/power/power_terminal2.lua @@ -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