zootsuitman

launchroom

Apr 26th, 2019
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. local modem = peripheral.wrap('top')
  2. modem.open(69)
  3.  
  4. function clear()
  5.     redstone.setBundledOutput('back', 0)
  6. end
  7.  
  8. function drawScreen()
  9.     term.clear()
  10.     term.setCursorPos(1,1)
  11.     term.write('Mission Control')
  12.  
  13.     term.setCursorPos(3,3)
  14.     term.write('E. Call elevator.')
  15.     term.setCursorPos(3,4)
  16.     term.write('O. Open launch doors.')
  17.     term.setCursorPos(3,4)
  18.     term.write('C. Close launch doors.')
  19. end
  20.  
  21. function doElevator()
  22.     redstone.setBundledOutput('back', colors.white)
  23.     sleep(15)
  24.     clear()
  25.     sleep(3)
  26.     redstone.setBundledOutput('back', colors.orange)
  27.     sleep(15)
  28.     clear()
  29. end
  30.  
  31. function doLaunch()
  32.     redstone.setBundledOutput('back', colors.magenta)
  33.     sleep(5)
  34.     clear()
  35.     sleep(2)
  36.  
  37.     redstone.setBundledOutput('back', colors.yellow)
  38.     sleep(6)
  39.     clear()
  40. end
  41.  
  42. function closeLaunch()
  43.     redstone.setBundledOutput('back', colors.lime)
  44.     sleep(6)
  45.     clear()
  46.     sleep(2)
  47.  
  48.     redstone.setBundledOutput('back', colors.lightBlue)
  49.     sleep(6)
  50.     clear()
  51. end
  52.  
  53. while true do
  54.     drawScreen()
  55.     local event, character, _, _, message, _ = os.pullEvent()
  56.  
  57.     if event == 'modem_message' then
  58.         if message == 'go' then
  59.             doElevator()
  60.         end
  61.     elseif event == 'char' then
  62.         if character == 'e' then doElevator() end
  63.         if character == 'o' then doLaunch() end
  64.         if character == 'c' then closeLaunch() end
  65.     end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment