Advertisement
kremnev8

REACTOR CLIENT

Feb 17th, 2015
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. ex = true
  2. mW = peripheral.find("modem")
  3. m = peripheral.wrap("left") -- side of reactor
  4. mW.open(51)
  5. mon = peripheral.find("monitor")
  6.  
  7. function os.pullEvent()
  8. e,p1,p2,p3,p4,p5 = os.pullEventRaw()
  9. if e == "terminate" then
  10. print("terminate")
  11. ex = false
  12. elseif e == "modem_message" then
  13. if p4 == "getRCST" then
  14. mW.transmit(51,51,"reactorST="..HEAT..";"..tostring(STATUS)..";"..OEU)
  15. elseif p4 == "actR" then
  16. rs.setOutput("left",true)
  17. elseif p4 == "disR" then
  18. rs.setOutput("left",false)
  19. end
  20. end
  21. return e,p1,p2,p3,p4,p5
  22. end
  23.  
  24. while ex do
  25. HEAT = m.getHeat()
  26. MAXHEAT = m.getMaxHeat()
  27. STATUS = m.isActive()
  28. OEU = m.getEUOutput()
  29.  
  30. OEU = tostring(tonumber(OEU) * 10)
  31.  
  32. term.clear()
  33. term.setCursorPos(1,1)
  34. if not mon == nil then
  35. mon.setCursorPos(2,1)
  36. mon.write("Reactor #1")
  37. if STATUS then
  38. if LSST == false then
  39. mon.clear()
  40. end
  41. mon.setCursorPos(1,2)
  42. mon.write("Heat:"..HEAT)
  43. mon.setCursorPos(1,3)
  44. mon.write(STATUS and "Enabled" or "Disabled")
  45. mon.setCursorPos(1,4)
  46. mon.write("EU output:"..OEU)
  47. LSST = true
  48. else
  49. mon.setCursorPos(1,5)
  50. if LSST then
  51. mon.clear()
  52. end
  53. LSST = false
  54. mon.write(STATUS and "Enabled" or "Disabled")
  55. end
  56. end
  57. print("     Reactor #1        ")
  58. print("   Heat:"..HEAT)
  59. print("MaxHeat:"..MAXHEAT)
  60. if STATUS then
  61. print("      Active           ")
  62. rs.setOutput("right",true)
  63. else
  64. print("     Inactive    ")
  65. rs.setOutput("right",false)
  66. end
  67. print("Output:"..OEU)
  68. sleep(1)
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement