Advertisement
Guest User

startup

a guest
Dec 20th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. reactor = "BigReactors-Reactor_23"
  2. monitor = "monitor_27"
  3. logo = "logo"
  4. rmax = 9999999
  5.  
  6. l = paintutils.loadImage(logo)
  7. r = peripheral.wrap(reactor)
  8. m = peripheral.wrap(monitor)
  9. amount = r.getEnergyStored()
  10. active = r.getActive()
  11. fuel = r.getFuelAmount()
  12. fuelmax = r.getFuelAmountMax()
  13. function printlogo(x,y)
  14. paintutils.drawImage(l,x,y)
  15. end
  16.  
  17. function resetcolors()
  18. term.setTextColor(colors.white)
  19. term.setBackgroundColor(colors.black)
  20. end
  21.  
  22. function activetog()
  23.  term.current()
  24.  active = r.getActive()
  25.  local event, side, xPos, yPos = os.pullEvent("monitor_touch")
  26.  if xPos < 2 and yPos == 1  then
  27.   if active == true then
  28.    r.setActive(false)
  29.    print("Activity off")
  30.   elseif active == false then
  31.    r.setActive(true)
  32.    print("Activity on")
  33.   end
  34.  end
  35. end
  36.  
  37. function looprun()
  38. while true do
  39. active = r.getActive()
  40. amount = r.getEnergyStored()
  41. fuel = r.getFuelAmount()
  42. percent = math.ceil((fuel / fuelmax) * 100)
  43. term.redirect(m) --Sets functions to monitor.
  44. term.clear()
  45. if active == true then
  46.  term.setCursorPos(1,1)
  47.  term.setBackgroundColor(colors.green)
  48.  write(" ")
  49. elseif active == false then
  50.  term.setCursorPos(1,1)
  51.  term.setBackgroundColor(colors.red)
  52.  write(" ")
  53. end
  54. printlogo(3,-1)
  55. resetcolors()
  56. term.setCursorPos(1,17)
  57. term.setTextColor(colors.red)
  58. write("Fuel: ")
  59. term.setTextColor(colors.green)
  60. write(fuel)
  61. term.setCursorPos(15,17)
  62. term.setTextColor(colors.red)
  63. write("Percent: ")
  64. term.setTextColor(colors.green)
  65. write("%"..percent)
  66. term.setCursorPos(1,18)
  67. term.setTextColor(colors.red)
  68. write("RF:")
  69. term.setTextColor(colors.green)
  70. write(amount)
  71. term.setCursorPos(15,18)
  72. term.setTextColor(colors.red)
  73. write("Active: ")
  74. term.setTextColor(colors.green)
  75. write(tostring(active))
  76. resetcolors()
  77. term.current()
  78. sleep(0.2)
  79. end
  80. end
  81. while true do
  82. parallel.waitForAny( looprun, activetog )
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement