Disappearer

Simple Big Reactor Monitor(monitor) //Computercraft

Jul 24th, 2014
2,364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.68 KB | None | 0 0
  1. -- Simple Big Reactor Monitor(monitor) by Disappearer
  2. -- This program need a wireless modem,advanced computer
  3. -- and at least 4 monitors to view informations normally.
  4. -- If you have different setup than one shown on screens
  5. -- edit these three variables below.
  6.  
  7. rednet.open("right") -- side of wireless modem
  8. local mon = peripheral.wrap("top") -- side or name of monitor
  9. local protocol = "reactor1" -- protocol of computer sending informations
  10.  
  11. while true do
  12. local id, mes, pro = rednet.receive(protocol)
  13. term.clear()
  14. term.redirect(mon)
  15. term.setCursorPos(1,1)
  16. mon.setTextScale(0.5)
  17. if mes == "false" then
  18. write("STATUS: ")
  19. mon.setBackgroundColour(colors.red)
  20. write("ERROR")
  21. mon.setBackgroundColour(colors.black)
  22. print()
  23. print()
  24. print("Something is wrong with program or reactor setup")
  25. print("Press Ctrl+T to terminate program")
  26. else
  27. write("STATUS: ")
  28. if mes.active == true then
  29. mon.setBackgroundColour(colors.lime)
  30. write("ACTIVE")
  31. elseif mes.active == false then
  32. mon.setBackgroundColour(colors.yellow)
  33. write("NOT ACTIVE")
  34. end
  35. mon.setBackgroundColour(colors.black)
  36. print()
  37. print()
  38. print("Energy Production: " .. math.floor(mes.energylasttick,0) .. " RF/t")
  39. print("Energy Stored:     " .. mes.energystored .. " RF")
  40. print()
  41. print("Fuel:              " .. mes.fuelamount .. "/" .. mes.fuelmax .. " mB")
  42. print("Fuel Usage:        " .. math.ceil(mes.fueleatlasttick*100)/100 .. " mB/t")
  43. print("Fuel Temperature:  " .. math.floor(mes.fueltemp,1) .. " C")
  44. print("Fuel Reactivity:   " .. math.floor(mes.fuelreact,1) .. " %")
  45. print("Waste:             " .. mes.wasteamount .. " mB")
  46. print()
  47. print("Casing Temperature:" .. math.floor(mes.casingtemp,1) .. " C")
  48. end
  49. sleep(0.11)
  50. end
Advertisement
Add Comment
Please, Sign In to add comment