Some nice stats to look at
authorOlav Bakke Svendsen <mail@olavbs.no>
Wed, 11 Oct 2023 22:57:40 +0000 (00:57 +0200)
committerOlav Bakke Svendsen <mail@olavbs.no>
Wed, 11 Oct 2023 22:57:40 +0000 (00:57 +0200)
steam/temporary-coal-feeder.lua

index a3a20cc2d47209d4619433e94a98b4b8bf004680..7984e73e39b79bc58f5196aa1b45c54c64ad5a26 100644 (file)
@@ -1,21 +1,22 @@
 -- very temporary coal feeder.
 
--- local config = dofile=("temporary-coal-feeder.config")
-local deployers = {}
-local barrels = {}
-
 local refill_when = function(amt) return amt < 2 end
 local refill_amt  = 2
 
--- for peripherals, mactch deployers and barrels
+local deployers = {}
+local num_deployers = 0
+local barrels = {}
+local num_barrels = 0
 
 for _,p in pairs(peripheral.getNames()) do
   local deployer = string.match(p, "^create\:deployer_%d+$")
   local barrel = string.match(p, "^sophisticatedstorage\:limited_barrel_%d+$")
   if deployer then
     deployers[deployer] = peripheral.wrap(deployer)
+    num_deployers = num_deployers + 1
   elseif barrel then
     barrels[barrel] = peripheral.wrap(barrel)
+    num_barrels = num_barrels + 1
   end
 end
 
@@ -58,9 +59,11 @@ while true 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)
-
+  term.clear()
+  term.setCursorPos(1,1)
+  print(tostring(num_barrels).." barrels and "..tostring(num_deployers).." deployers connected\n")
+  print(num_deployers/2.." charcoal/minute needed")
+  print(tostring(total_coal).." available\n"..str.."\n")
   feed(stock)
   os.sleep(60)
 end