Advertisement
colhaydutu

atm9 powah reactor screen

Jan 25th, 2024 (edited)
136
0
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. local lowproblem
  2.  
  3.  
  4. local reactor = peripheral.wrap("back")
  5. local monitor = peripheral.wrap("left")
  6.  
  7. local function drawControls()
  8. monitor.setBackgroundColor(colors.gray)
  9. monitor.clear()
  10. term.redirect(monitor)
  11. monitor.setCursorPos(1, 1)
  12. monitor.setTextScale(1)
  13. paintutils.drawLine(1, 2, 2, 2, colors.lime)
  14. monitor.setCursorPos(4, 2)
  15. monitor.setBackgroundColor(colors.gray)
  16. monitor.write("Reactor Info")
  17. paintutils.drawLine(17, 2, 17, 2, colors.lime)
  18. paintutils.drawLine(18, 2, 18, 11, colors.lime)
  19. paintutils.drawLine(1, 2, 1, 11, colors.lime)
  20. paintutils.drawLine(1, 11, 2, 11, colors.lime)
  21. paintutils.drawLine(17, 11, 19, 11, colors.lime)
  22. end
  23.  
  24. drawControls()
  25.  
  26. while true do
  27. local heat = reactor.getTemperature() * 10
  28. local red = reactor.getRedstone()
  29. local coal = reactor.getCarbon()
  30. local ura = reactor.getFuel()
  31.  
  32. monitor.clear()
  33. drawControls()
  34.  
  35. monitor.setCursorPos(4, 4)
  36. monitor.setBackgroundColor(colors.gray)
  37. monitor.write("Temp: " .. heat .. " °C")
  38. monitor.setCursorPos(4, 6)
  39. monitor.write("RedStone: " .. math.floor(red) .. "%")
  40. monitor.setCursorPos(4, 8)
  41. monitor.write("Coal: " .. math.floor(coal) .. "%")
  42. monitor.setCursorPos(4, 10)
  43. monitor.write("Fuel: " .. math.floor(ura) .. "%")
  44.  
  45. sleep(1)
  46.  
  47. if heat > 35 or coal == 0 or ura == 0 or red == 0 then
  48. redstone.setOutput("top", true)
  49. sleep(1)
  50. redstone.setOutput("top", false)
  51.  
  52. if coal == 0 then
  53. lowproblem = "LOW COAL"
  54. end
  55.  
  56. if ura == 0 then
  57. lowproblem = "LOW FUEL"
  58. end
  59.  
  60. if red == 0 then
  61. lowproblem = "LOW REDSTONE"
  62. end
  63.  
  64. if heat > 100 then
  65. lowproblem = "HIGH TEMP"
  66. end
  67.  
  68. monitor.clear()
  69. sleep(1)
  70. monitor.setCursorPos(1, 1)
  71. monitor.setBackgroundColor(colors.red)
  72. monitor.setTextScale(2)
  73. monitor.setTextColor(colors.white)
  74. sleep(0.1)
  75. monitor.setCursorPos(1, 2)
  76. monitor.write("ALARM")
  77. monitor.setCursorPos(1, 5)
  78. monitor.write(lowproblem)
  79. sleep(2)
  80. else
  81. redstone.setOutput("top", false)
  82. end
  83. end
  84.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement