Advertisement
DoomRater

WATR Door

Aug 25th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. -- Basic side determination for wrapping
  2. function getDeviceSide(deviceType)
  3.         deviceType = deviceType:lower()
  4.    
  5.         for i, side in pairs(rs.getSides()) do
  6.                 if (peripheral.isPresent(side)) then
  7.                         if (string.lower(peripheral.getType(side)) == deviceType) then
  8.                                 return side;
  9.                         end
  10.                 end
  11.         end
  12.    
  13.         return nil;
  14. end
  15.  
  16. -- Peripheral wrapping function
  17. function wrapThis(thing, f)
  18.         local wrapped = nil
  19.         while wrapped == nil and f <= 100 do
  20.                 wrapped = peripheral.wrap(thing.."_"..f)
  21.                 f = f + 1
  22.         end
  23.  
  24.         if wrapped == nil then
  25.                 side = getDeviceSide(thing)
  26.                 if side ~= nil then
  27.                         return peripheral.wrap(side)
  28.                 else
  29.                         return nil
  30.                 end
  31.         else
  32.                 return wrapped
  33.         end
  34. end
  35.  
  36. security = "HiPass"
  37. override = "Open House"
  38.  
  39. monitor=wrapThis("monitor",0)
  40.  
  41. if monitor ~= nil then
  42.   monitor.clear()
  43.   monitor.setTextScale(.5)
  44.   monitor.setCursorPos(1,1)
  45.   monitor.write('Welcome to...')
  46.   monitor.setCursorPos(21,2)
  47.   monitor.write('___')
  48.   monitor.setCursorPos(12,3)
  49.   monitor.write('!   !  ^  T  !\\')
  50.   monitor.setCursorPos(12,4)
  51.   monitor.write('! ! ! !_! !  !/')
  52.   monitor.setCursorPos(13,5)
  53.   monitor.write('T T  ! ! !  !\\')
  54.   monitor.setCursorPos(1,7)
  55.   monitor.write('Current Announcments:')
  56.   monitor.setCursorPos(2,8)
  57.   monitor.write('-Lord DoomRater will be on vacation')
  58.   monitor.setCursorPos(1,9)
  59.   monitor.write('from September 1 to September 17.')
  60.   monitor.setCursorPos(2,10)
  61.   monitor.write('-Open House starts September 1st!')
  62. end
  63.  
  64. while true do
  65.   term.clear()
  66.   term.setCursorPos(1,1)
  67.   print("                          ___")
  68.   print("                 !   !  ^  T  !\\")
  69.   print("                 ! ! ! !_! !  !/")
  70.   print("                  T T  ! ! |  !\\")
  71.   print("                 Weapons and")
  72.   print("                   Tactics Research")
  73.   term.setCursorPos(1,9)
  74.   print("Security Clearance Required")
  75.   term.write("> ")
  76.   pass = read("x")
  77.   if pass == security then
  78.     rs.setOutput("top",false)
  79.     sleep(.2)
  80.     rs.setOutput("back",false)
  81.     sleep(4)
  82.     rs.setOutput("top",true)
  83.     sleep(.2)
  84.     rs.setOutput("back",true)
  85.   end
  86.   if pass == override then
  87.     rs.setOutput("top",false)
  88.     sleep(.2)
  89.     rs.setOutput("back",false)
  90.   end
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement