Advertisement
omerapp99

Untitled

Mar 18th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. monitor = peripheral.wrap("right")
  2. reactor = peripheral.wrap("BigReactors-Reactor_2")
  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. rf = reactor.getEnergyProducedLastTick()
  55. bar = (rf+0.1)/(55000-0) *( 24)
  56. monitor.blit(" " .. last .. " RF/t" .. stringer(" ", 20 - lastlen), stringer("f", 26), " " .. stringer("5", bar) .. stringer("7", 24 - bar) .. "f")
  57.  
  58.  
  59.  
  60. info = tostring(reactor.getFuelAmount())
  61. yellow = reactor.getFuelAmount()
  62. blue = reactor.getWasteAmount()
  63. total = reactor.getFuelAmountMax()
  64. black = total - yellow - blue
  65.  
  66. yellowbar = yellow / total
  67. bluebar = blue / total
  68. blackbar = black / total
  69.  
  70.  
  71. yellowD = yellowbar * 24
  72. if (yellowD - math.floor(yellowbar * 24)) >= 0.5 then
  73. yellowD = yellowD + 1
  74. end
  75.  
  76. blueD = bluebar * 24
  77. if (blueD - math.floor(bluebar * 24)) > 0.5 then
  78. blueD = blueD + 1
  79. end
  80.  
  81. blackD = blackbar * 24
  82. if (blackD - math.floor(blackbar * 24)) > 0.5 then
  83. blackD = blackD + 1
  84. end
  85.  
  86. yellowD = math.floor(yellowD)
  87. blueD = math.floor(blueD)
  88. blackD = math.floor(blackD)
  89.  
  90. monitor.setCursorPos(1,9)
  91. monitor.blit(stringer(" ", 26), stringer("f", 26), " " .. stringer("4", yellowD) .. stringer("b", blueD) .. stringer("7", blackD) .. "f")
  92. monitor.setCursorPos(1,11)
  93. monitor.blit("Fuel stored:" .. stringer(" ", 11 - string.len(info)) .. info .. " mB", stringer("4",14) .. stringer("0",10) .. "44", stringer("f", 26))
  94. info = reactor.getWasteAmount()
  95. info = math.floor(info)
  96. monitor.setCursorPos(1,12)
  97. monitor.blit("Waste stored:" .. stringer(" ", 10 - string.len(info)) .. info .. " mB", stringer("b", 15) .. stringer("0", 9) .. "44", stringer("f", 26))
  98. info = black
  99. monitor.setCursorPos(1,13)
  100. monitor.blit("Empty:" .. stringer(" ", 17 - string.len(info)) .. info .. " mB", stringer("8", 6) .. stringer("0", 18) .. "88", stringer("f", 26))
  101. end
  102.  
  103. while true do
  104. reactorf()
  105. sleep(1/20)
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement