Advertisement
Guest User

airLock

a guest
May 22nd, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. local outsideDoor = "right"
  2. local tibbersDoor = "left"
  3. local enterance = "top"
  4. local exit = "bottom"
  5. local monitor = peripheral.find("monitor")
  6.  
  7. function exitDoor()
  8.   sleep(3)
  9.   rs.setOutput( outsideDoor, true )
  10.   sleep(1.5)
  11.   rs.setOutput( outsideDoor, false )
  12.   sleep(.5)
  13. end
  14.  
  15. function labDoor()
  16.   sleep(3)
  17.   rs.setOutput( tibbersDoor , true )
  18.   sleep(1.5)
  19.   rs.setOutput( tibbersDoor , false )
  20.   sleep(.5)
  21. end
  22.  
  23. function displayClear()
  24.   monitor.clear()
  25.   monitor.setBackgroundColor( colors.green )
  26.   monitor.setCursorPos(1,1)
  27.   monitor.write(" Decontamination Complete ")
  28.   monitor.setCursorPos(1,2)
  29.   sleep(1)
  30.   monitor.write(" Clear to Proceed ")
  31.   sleep(1)
  32. end
  33.  
  34. function displayDecon()
  35.   monitor.clear()
  36.   monitor.setBackgroundColor( colors.red )
  37.   monitor.setCursorPos(1,1)
  38.   monitor.write(" WARNING: Decontamination in progress... ")
  39.   monitor.setCursorPos(1,2)
  40.   sleep(1)
  41.   monitor.write(" Please Wait ")
  42.   sleep(1)
  43. end
  44.  
  45. function color()
  46.   monitor.setTextColor( colors.blue )
  47. end
  48.  
  49. function reset()
  50.   monitor.setBackgroundColor( colors.black )
  51.   monitor.clear()
  52. end
  53.  
  54. while true do
  55.   reset()
  56.   color()
  57.   input1 = rs.getInput( exit )
  58.   input2 = rs.getInput( enterance )
  59.   if input1 == true then
  60.     labDoor()
  61.     displayDecon()
  62.     sleep(1.5)
  63.     displayClear()
  64.     sleep(1.5)
  65.     exitDoor()
  66.     reset()
  67.   elseif input2 == true then
  68.     exitDoor()
  69.     displayDecon()
  70.     sleep(1.5)
  71.     displayClear()
  72.     sleep(1.5)
  73.     labDoor()
  74.     sleep(1.5)
  75.     reset()
  76.   end
  77.   sleep(1)
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement