Advertisement
Justin8303

controller

Dec 11th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. side = "back"
  2. modem = "right"
  3. rednet.open(modem)
  4.  
  5. function ts(string)
  6.     return textutils.serialize(string)
  7. end
  8.  
  9. while true do
  10.     channel,message = rednet.receive()
  11.     if message == "lock" then
  12.         lock = true
  13.     elseif message == "unlock" then
  14.         lock = false
  15.     elseif message == "open" then
  16.         door = false
  17.     elseif message == "close" then
  18.         door = true
  19.     end
  20.     print("lock: "..ts(lock))
  21.     print("door: "..ts(door))
  22.     if lock and not door then
  23.         rs.setBundledOutput(side,colors.white)
  24.     elseif not lock and not door then
  25.         rs.setBundledOutput(side,0)
  26.     elseif lock and door then
  27.         rs.setBundledOutput(side,colors.combine(colors.white,colors.red))
  28.     elseif not lock and door then
  29.         rs.setBundledOutput(side,colors.red)
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement