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
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