From 96c1d763e8876f20d59eea8b4d038ee9dac73f39 Mon Sep 17 00:00:00 2001 From: Olav Bakke Svendsen Date: Thu, 12 Oct 2023 00:02:11 +0200 Subject: [PATCH] Dumb mistake that took too long to figure out --- steam/temporary-coal-feeder.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/steam/temporary-coal-feeder.lua b/steam/temporary-coal-feeder.lua index 86aac3e..a3a20cc 100644 --- a/steam/temporary-coal-feeder.lua +++ b/steam/temporary-coal-feeder.lua @@ -37,7 +37,7 @@ local feed = function(stock) for barrel_addr,count in pairs(stock) do if count >= refill_amt then stock[barrel_addr] = count - refill_amt - f = function() deployer.pullItems(barrel_addr, 1, refill_amt, 1) end + f = function() return deployer.pullItems(barrel_addr, 1, refill_amt, 1) end break end end @@ -50,6 +50,17 @@ local feed = function(stock) end while true do - feed(locate_coal()) + local stock = locate_coal() + local total_coal = 0 + + local str = "" + for k,v in pairs(stock) do + total_coal = total_coal + v + str = str..tostring(v).." in "..string.match(k, "barrel_%d+$").."\n" + end + print(tostring(total_coal).." coal available") + print(str) + + feed(stock) os.sleep(60) end -- 2.30.2