BeastmodeJD

Reactor_Control-Monitor

Mar 20th, 2020
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.52 KB | None | 0 0
  1. monitor = peripheral.wrap("right")
  2. reactor = peripheral.wrap("BigReactors-Reactor_0")
  3. print("Working...")
  4.  
  5. function writeInGreen(message, x, y)
  6.     monitor.setTextColor(colors.green)
  7.     monitor.setCursorPos(x,y)
  8.     monitor.write(message)
  9.     monitor.setTextColor(colors.white)
  10. end
  11.  
  12. function writeInRed(message, x, y)
  13.     monitor.setTextColor(colors.red)
  14.     monitor.setCursorPos(x,y)
  15.     monitor.write(message)
  16.     monitor.setTextColor(colors.white)
  17. end
  18.  
  19. function writeInWhite(message, x, y)
  20.     monitor.setTextColor(colors.white)
  21.     monitor.setCursorPos(x,y)
  22.     monitor.write(message)
  23. end
  24.  
  25. function writeInYellow(message, x, y)
  26.     monitor.setTextColor(colors.yellow)
  27.     monitor.setCursorPos(x,y)
  28.     monitor.write(message)
  29.     monitor.setTextColor(colors.white)
  30. end
  31.  
  32. ---Main code---
  33. while (true) do
  34.     monitor.clear()
  35.     monitor.setTextScale(1.5)
  36.     writeInWhite("Power Status: ", 1, 1)
  37.     if (reactor.getActive() == true) then
  38.         writeInGreen("On", 15, 1)
  39.     else
  40.         writeInRed("Off", 15, 1)
  41.     end
  42.     writeInWhite("Fuel Temp: ", 1, 2)
  43.     writeInYellow(reactor.getFuelTemperature(), 12, 2)
  44.     writeInWhite("Casing Temp: ", 1, 3)
  45.     writeInYellow(reactor.getCasingTemperature(), 14, 3)
  46.     writeInWhite("                                                                       ", 1, 4)
  47.     writeInWhite("Fuel Level (Ingots): ", 1, 5)
  48.     if (reactor.getFuelAmount() >= reactor.getFuelAmountMax() / 4) then
  49.         writeInGreen(reactor.getFuelAmount() / 1000, 22, 5)
  50.     else
  51.         writeInRed(reactor.getFuelAmount() / 1000, 22, 5)
  52.     end
  53.     writeInWhite("Waste Amount (Ingots): ", 1, 6)
  54.     if (reactor.getWasteAmount() > reactor.getFuelAmountMax() / 4) then
  55.         writeInRed(reactor.getWasteAmount() / 1000, 24, 6)
  56.     else
  57.         writeInGreen(reactor.getWasteAmount() / 1000, 24, 6)
  58.     end
  59.     writeInWhite("Fuel Reactivity: ", 1, 7)
  60.     writeInYellow(reactor.getFuelReactivity(), 18, 7)
  61.     writeInWhite("Fuel Consumed last Tick: ", 1, 8)
  62.     writeInYellow(reactor.getFuelConsumedLastTick(), 26, 8)
  63.     writeInWhite("                                                                       ", 1, 9)
  64.     writeInWhite("Energy Stored: ", 1, 10)
  65.     if (reactor.getEnergyStored() == 0) then
  66.         writeInRed(string.format("%18.0f", reactor.getEnergyStored()), 16, 10)
  67.     else
  68.         writeInGreen(reactor.getEnergyStored(), 16, 10)
  69.     end
  70.     writeInWhite("Energy Produced Last Tick: ", 1 ,11)
  71.     writeInYellow(reactor.getEnergyProducedLastTick(), 28, 11)
  72.     sleep(10)
  73. end
Advertisement
Add Comment
Please, Sign In to add comment