From f7f56b064ae4665028d6297cf4c1cf78dd2939dc Mon Sep 17 00:00:00 2001 From: Olav Bakke Svendsen Date: Thu, 12 Oct 2023 08:07:06 +0200 Subject: [PATCH] Checking how far behind treefarm is --- steam/temporary-coal-feeder.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/steam/temporary-coal-feeder.lua b/steam/temporary-coal-feeder.lua index 3e96b54..306d813 100644 --- a/steam/temporary-coal-feeder.lua +++ b/steam/temporary-coal-feeder.lua @@ -57,6 +57,9 @@ local feed = function(stock) end end +local coal_at_boot = false +local minutes_passed = -1 + local print_stats = function(monitor, stock) local total_coal = 0 local str = "" @@ -77,6 +80,14 @@ local print_stats = function(monitor, stock) monitor.write(string.gsub(str, "^%s++%s*", "")) monitor.setCursorPos(1,12) monitor.write("refreshes once every minute") + + coal_at_boot = coal_at_boot or total_coal + minutes_passed = minutes_passed + 1 + if minutes_passed < 0 then + local avg = (coal_at_boot - total_coal)/minutes_passed + monitor.setCursorPos(1,6) + monitor.write("losing on average "..avg.."cc/m") + end end local spinner_chars = {"\\","-","/","|"} -- 2.30.2