Jackson_Pike

Reactor Control

Jun 20th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. mon = peripheral.wrap("monitor_5")
  2. react = peripheral.wrap("BigReactors-Reactor_0")
  3. monX, monY = mon.getSize()
  4. local function draw_Line(xPos, yPos, color, length)
  5.  mon.setCursorPos(xPos, yPos)
  6.  mon.setBackgroundColor(color)
  7.  mon.write(string.rep(" ", length))
  8. end
  9. local function clear()
  10.  mon.setBackgroundColor(colors.black)
  11.  mon.clear()
  12. end
  13. local function writeText(xPos, yPos, bg_color, tx_color, text)
  14.   mon.setCursorPos(xPos, yPos)
  15.   mon.setBackgroundColor(bg_color)
  16.   mon.setTextColor(tx_color)
  17.   mon.write(text)
  18. end
  19. local function drawMenus(color)
  20.   mon.setCursorPos(1, 1)
  21.   mon.setBackgroundColor(color)
  22.   mon.write(string.rep(" ", monX))
  23.   mon.setCursorPos(1, monY)
  24.   mon.write(string.rep(" ", monX))
  25. end
  26. local function homescreen(color)
  27.   clear()
  28.   while true do
  29.   energy = react.getEnergyProducedLastTick()
  30.   drawMenus(color)
  31.   writeText(monX/2-8, 1, color, colors.white, "Reactor Control")
  32.   sleep(0.1)
  33.   end
  34. end
  35. local function mon_touch()
  36.    
  37.     local event, side, x, y = os.pullEvent("monitor_touch")
  38.     if x > 1 then
  39.     shell.run("shutdown")
  40.     end
  41.     sleep(0.1)
  42.    
  43. end
  44. function call_homepage()
  45. while true do
  46. parallel.waitForAll(homescreen(colors.blue), mon_touch())
  47. sleep(0.1)
  48. end
  49. end
  50. while true do
  51. call_homepage()
  52. sleep(0.1)
  53. end
Add Comment
Please, Sign In to add comment