Advertisement
ALpha_R

rcScreen

Dec 8th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6. -------------------------------------------------//Initilisation
  7.  
  8. local monitor = peripheral.wrap("right")
  9. monitor.setTextScale(1)
  10. term.redirect(monitor)
  11.  
  12. local ptc = "reactorNetwork"
  13. local hostname = "rcScreen"
  14.  
  15. rednet.open("top")
  16. rednet.host(ptc, hostname)
  17.  
  18. local info = {}
  19. local color = {}
  20.  
  21. local res
  22.  
  23. print("Connection ...")
  24.  
  25. -------------------------------------------------//getInfo()
  26.  
  27. function getInfo()
  28. res, info = rednet.receive(ptc, 10)
  29. end
  30.  
  31. -------------------------------------------------//serialize()
  32. function serialize()
  33. fuelAPerc = ((info.fuelAmount/100000)*47)
  34. wasteAPerc = ((info.wasteAmount/100000)*47)
  35. fuelTPerc = ((info.fuelTemp/2500)*47)
  36. caseTPerc = ((info.caseTemp/2500)*47)
  37. end
  38.  
  39. -------------------------------------------------//affichage()
  40.  
  41. function affichage()
  42. term.setBackgroundColor(colors.black)
  43. term.clear()
  44.  
  45. term.setCursorPos(21, 2)
  46. term.write("REACTEUR")
  47. term.setCursorPos(21, 4)
  48. term.write((info.rcActive and "POWER ON" or "POWER OFF"))
  49.  
  50. paintutils.drawFilledBox(1, 6, 50, 33, colors.lightGray)
  51.  
  52. term.setCursorPos(2, 7)
  53. term.write("Fuel Amount : "..(math.floor(info.fuelAmount/100)/10))
  54. term.setCursorPos(2, 14)
  55. term.write("Waste Amount : "..(math.floor(info.wasteAmount/100)/10))
  56. term.setCursorPos(2, 21)
  57. term.write("Fuel Temperature : "..math.floor(info.fuelTemp))
  58. term.setCursorPos(2, 28)
  59. term.write("Casing Temperature : "..math.floor(info.caseTemp))
  60.  
  61. paintutils.drawFilledBox(2, 9, 2 + fuelAPerc, 11, colors.yellow)
  62. paintutils.drawFilledBox(2, 16, 2 + wasteAPerc, 18, colors.yellow)
  63. paintutils.drawFilledBox(2, 23, 2 + fuelTPerc, 25, colors.yellow)
  64. paintutils.drawFilledBox(2, 30, 2 + caseTPerc, 32, colors.yellow)
  65. end
  66.  
  67. while(true)do
  68. getInfo()
  69. serialize()
  70. affichage()
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement