ferel

Door MagReader

Jun 16th, 2016
302
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. c = require'component'
  2. gpu = require'component'.gpu
  3. ep = require'event'.pull
  4. door = require'component'.os_door
  5. rs = require'component'.redstone
  6.  
  7. gpu.setResolution(24,5)
  8.  
  9. while true do
  10. h = 0
  11. os.sleep(3)
  12. gpu.setBackground(0xFFFF00)
  13. gpu.fill(1,1,24,5," ")
  14. gpu.setBackground(0xBDBDBD)
  15. gpu.set(5,3,"                ")
  16. gpu.setForeground(0xFFFF00)
  17. gpu.set(5,3,"Проведите карту.")
  18. type,_,_,data,_,_ = ep()
  19. if type == "magData" then
  20. h = 1
  21. else
  22. h = 0
  23. end
  24. if h == 1 then
  25. if data == "RXZlcnlib2R5" then
  26. gpu.setBackground(0x00FF00)
  27. gpu.fill(1,1,24,5," ")
  28. gpu.setBackground(0xBDBDBD)
  29. gpu.set(5,3,"                ")
  30. gpu.setForeground(0x00FF00)
  31. gpu.set(5,3,"Код карты принят")
  32. rs.setOutput(1,15)
  33. door.toggle()
  34. rs.setOutput(1,0)
  35. os.sleep(2)
  36. door.toggle()
  37. else
  38. gpu.setBackground(0xFF0000)
  39. gpu.fill(1,1,24,5," ")
  40. gpu.setBackground(0xBDBDBD)
  41. gpu.set(4,3,"                   ")
  42. gpu.setForeground(0xFF0000)
  43. gpu.set(4,3,"Ошибка кода карты!")
  44. rs.setOutput(0,15)
  45. os.sleep(1)
  46. rs.setOutput(0,0)
  47. end
  48. end
  49. end
RAW Paste Data