DerReuter

Untitled

Sep 17th, 2019
174
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. monitor = peripheral.wrap("right")
  2. reactor = peripheral.wrap("BigReactors-Reactor_0")
  3.  
  4. function stringer(input, count)
  5. output = ""
  6.   for i=1,count,1 do
  7.     output = output .. input
  8.   end
  9.   return output
  10. end
  11.  
  12. lastVal = 0
  13. monitor.clear()
  14. function reactorf()
  15. monitor.setTextScale(1.5)
  16.  
  17. monitor.setCursorPos(1,1)
  18. if (reactor.getActive() == true) then
  19. monitor.blit("Reactor is online         ", stringer("f",26), stringer("d",26))
  20. else
  21. monitor.blit("Reactor is offline        ", stringer("f",26), stringer("e",26))
  22. end
  23.  
  24. monitor.setCursorPos(1,3)
  25. info = tostring(reactor.getEnergyStored())
  26. monitor.blit("Energy stored:" .. stringer(" ", 9 - string.len(info)) .. info .. " RF", stringer("4",15) .. stringer("0",9) .. "44", stringer("f", 26))
  27.  
  28. calcs = math.floor(reactor.getEnergyStored() - lastVal)
  29. pnc = "e"
  30. if calcs > 0 then
  31. calcs = "+" .. calcs
  32. pnc = "d"
  33. end
  34.  
  35. monitor.setCursorPos(1,6)
  36. if (math.floor(reactor.getEnergyStored() - lastVal)) ~= 0 then
  37. monitor.blit(stringer(" ", 20 - string.len(calcs)) .. calcs .. " RF/t ", stringer("f", 20 - string.len(calcs)) .. pnc .. stringer("0", string.len(calcs) - 1) .. stringer("4", 6), stringer("f", 26))
  38. end
  39. lastVal = reactor.getEnergyStored()
  40.  
  41.  
  42. monitor.setCursorPos(1,5)
  43. bar = reactor.getEnergyStored() / 10000000
  44. barwidth = bar * 24
  45. barwidth = math.floor(barwidth)
  46. perc = math.floor(bar * 100)
  47. perclen = string.len(tostring(perc))
  48.  
  49. last = math.floor(reactor.getEnergyProducedLastTick())
  50. lastlen = string.len(last)
  51. monitor.blit(stringer(" ", 24 - perclen) .. perc .. "% ", "f" .. stringer("f", barwidth) .. stringer("0", 24 - barwidth) .. "f", "f" .. stringer("1", barwidth) .. stringer("7", 24 - barwidth) .. "f")
  52.  
  53. monitor.setCursorPos(1,7)
  54. bar = math.floor( reactor.getEnergyProducedLastTick() / 300 * 24 )
  55. monitor.blit(" " .. last .. " RF/t" .. stringer(" ", 20 - lastlen), stringer("f", 26), " " .. stringer("5", bar) .. stringer("7", 24 - bar) .. "f")
  56.  
  57.  
  58.  
  59. info = tostring(reactor.getFuelAmount())
  60. yellow = reactor.getFuelAmount()
  61. blue = reactor.getWasteAmount()
  62. total = reactor.getFuelAmountMax()
  63. black = total - yellow - blue
  64.  
  65. yellowbar = yellow / total
  66. bluebar = blue / total
  67. blackbar = black / total
  68.  
  69.  
  70. yellowD = yellowbar * 24
  71. if (yellowD - math.floor(yellowbar * 24)) >= 0.5 then
  72. yellowD = yellowD + 1
  73. end
  74.  
  75. blueD = bluebar * 24
  76. if (blueD - math.floor(bluebar * 24)) > 0.5 then
  77. blueD = blueD + 1
  78. end
  79.  
  80. blackD = blackbar * 24
  81. if (blackD - math.floor(blackbar * 24)) > 0.5 then
  82. blackD = blackD + 1
  83. end
  84.  
  85. yellowD = math.floor(yellowD)
  86. blueD = math.floor(blueD)
  87. blackD = math.floor(blackD)
  88.  
  89. monitor.setCursorPos(1,9)
  90. monitor.blit(stringer(" ", 26), stringer("f", 26), " " .. stringer("4", yellowD) .. stringer("b", blueD) .. stringer("7", blackD) .. "f")
  91. monitor.setCursorPos(1,11)
  92. monitor.blit("Fuel stored:" .. stringer(" ", 11 - string.len(info)) .. info .. " mB", stringer("4",14) .. stringer("0",10) .. "44", stringer("f", 26))
  93. info = reactor.getWasteAmount()
  94. info = math.floor(info)
  95. monitor.setCursorPos(1,12)
  96. monitor.blit("Waste stored:" .. stringer(" ", 10 - string.len(info)) .. info .. " mB", stringer("b", 15) .. stringer("0", 9) .. "44", stringer("f", 26))
  97. info = black
  98. monitor.setCursorPos(1,13)
  99. monitor.blit("Empty:" .. stringer(" ", 17 - string.len(info)) .. info .. " mB", stringer("8", 6) .. stringer("0", 18) .. "88", stringer("f", 26))
  100. end
  101.  
  102. while true do
  103. reactorf()
  104. sleep(1/20)
  105. end
RAW Paste Data