Advertisement
Guest User

startup

a guest
Nov 22nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. function periUptd()
  2.  
  3.   tanks = {}
  4.   tanks[1] = peripheral.wrap("thermalexpansion_tank_3")
  5.   tanks[2] = peripheral.wrap("thermalexpansion_tank_4")
  6.   tanks[3] = peripheral.wrap("thermalexpansion_tank_5")
  7.   tanks[4] = peripheral.wrap("thermalexpansion_tank_6")
  8.   tanks[5] = peripheral.wrap("thermalexpansion_tank_7")
  9.  
  10. end
  11.  
  12. periUptd()
  13. glass = peripheral.wrap("left")
  14.  
  15. Xpos = 5
  16. Ypos = 5
  17. color = 0xff8800
  18.  
  19.  
  20. function tankInfo()
  21.  
  22.   num = 1
  23.   tankNum = 0
  24.   while true do
  25.     if tanks[num] == nil then
  26.       break
  27.     end
  28.     num = num+1
  29.     tankNum = tankNum+1
  30.   end
  31.  
  32.   tanksInfo = {}
  33.  
  34.   for num = 1, tankNum do
  35.     tanksInfo[num] = tanks[num].getTankInfo()
  36.   end
  37.  
  38. end
  39.  
  40. function clear()
  41.   term.setCursorPos(1, 1)
  42.   term.clear()
  43. end
  44.  
  45. tankInfo()
  46.  
  47. function tanksCap()
  48.   capacity = 0
  49.  
  50.   for num = 1, tankNum do
  51.     capacity = capacity + tanksInfo[num][1].capacity
  52.   end
  53.  
  54.   capacity = capacity / 1000
  55. end
  56.  
  57. function tanksAmo()
  58.   amount = 0
  59.  
  60.   for num = 1, tankNum do
  61.     if tanksInfo[num][1].contents then
  62.       amount = amount + tanksInfo[num][1].contents.amount
  63.     end
  64.   end
  65.  
  66.   amount = amount / 1000
  67. end
  68.  
  69.  
  70. while true do
  71.  
  72.   periUptd()
  73.  
  74.   tankInfo()
  75.  
  76.   tanksCap()
  77.  
  78.   tanksAmo()
  79.  
  80.   clear()
  81.   print(tankNum)
  82.   print(amount .. "/" .. capacity)
  83.   glass.clear()
  84.   glass.addText(Xpos, Ypos, amount .. "/" .. capacity, color)
  85.   glass.sync()
  86.   sleep(0.25)
  87.  
  88. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement