Cedri

server

Jan 12th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.44 KB | None | 0 0
  1. modem = peripheral.wrap("top")
  2. modem.open(1)
  3. res = -1
  4.  
  5. function maint()
  6.     if res == 0 then
  7.         print("MAINT")
  8.         redstone.setBundledOutput("right", 16384)
  9.         res = -1
  10.     else
  11.         print("Basement 1")
  12.         redstone.setBundledOutput("right", 0)
  13.         res = -1
  14.     end
  15. end
  16.  
  17. function fll1()
  18.     if res == 0 then
  19.         print("Lobby")
  20.         redstone.setBundledOutput("right", 32)
  21.         res = -1
  22.     else
  23.         print("FLOOR1")
  24.         redstone.setBundledOutput("right", 8192)
  25.         res = -1
  26.     end
  27. end
  28.  
  29. function fl23()
  30.     if res == 0 then
  31.         print("FLOOR2")
  32.         redstone.setBundledOutput("right", 1)
  33.         res = -1
  34.     else
  35.         print("FLOOR3")
  36.         redstone.setBundledOutput("right", 8)
  37.         res = -1
  38.     end
  39. end
  40.  
  41. function fl45()
  42.     if res == 0 then
  43.         print("FLOOR4")
  44.         redstone.setBundledOutput("right", 4)
  45.         res = -1
  46.     else
  47.         print("FLOOR5")
  48.         redstone.setBundledOutput("right", 16)
  49.         res = -1
  50.     end
  51. end
  52.  
  53. while true do
  54.     event, side, frequency, replyFrequency, message, distance = os.pullEvent("modem_message")
  55.        
  56.         if message == "b1" then
  57.             res = 1
  58.             maint()
  59.         end
  60.        
  61.         if message == "maint" then
  62.             res = 0
  63.             maint()
  64.         end
  65.        
  66.         if message == "lobby" then
  67.             res = 0
  68.             fll1()
  69.         end
  70.        
  71.         if message == "one" then
  72.             res = 1
  73.             fll1()
  74.         end
  75.  
  76.         if message == "two" then
  77.             res = 0
  78.             fl23()
  79.         end
  80.  
  81.         if message == "three" then
  82.             res = 1
  83.             fl23()
  84.         end
  85.  
  86.         if message == "four" then
  87.             res = 0
  88.             fl45()
  89.         end
  90.  
  91.         if message == "five" then
  92.             res = 1
  93.             fl45()
  94.         end
  95. end
Add Comment
Please, Sign In to add comment