Advertisement
charlesthepenguin

Untitled

Jul 29th, 2020
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. c = require("component")
  2. local term = require("term")
  3. local component = require("component")
  4. local sides = require("sides")
  5. event = require("event")
  6. os = require("os")
  7. event = require("event")
  8. computer = require("computer")
  9. serialization = require("serialization")
  10. local tun = component.tunnel
  11. local gpu = component.gpu -- get primary gpu component
  12. local w, h = gpu.getResolution()
  13. gpu.fill(1, 1, w, h, " ") -- clears the screen
  14. tun = c.tunnel
  15. red = c.redstone
  16. modem = c.modem
  17. sg = c.stargate
  18. port = 123
  19. bm = c.beamer
  20. local asd = 1
  21. print("SGC Gate Computer Program v1.1 /by Kevlaris")
  22. print("--------------------------------------------------------------------------------------------------------------------------------------------------------------")
  23. print()
  24.  
  25. repeat
  26. term.clear(true)
  27. print("Listening for incoming messages and events across dimensions")
  28. print()
  29.  
  30. local _, _, _, _, _, raw, address_raw = event.pull(nil, "modem_message")
  31. print("Message recieved.")
  32. os.sleep(0.5)
  33.  
  34. if raw == "AlphaT" then
  35. print("Sending Message Relay 1")
  36. modem.broadcast(port, "Relay1A")
  37. os.sleep(1)
  38. elseif raw == "BaseT" then
  39. print("preparing base")
  40. modem.broadcast(port, "prepare")
  41. print("Engaging IO")
  42. red.setOutput(sides.left, 1)
  43. address = {"Crater", "Monoceros", "Scorpius", "Serpens Caput", "Sculptor", "Aquarius", "Point of Origin"}
  44. os.sleep(0.5)
  45. print("Dialing")
  46. for i,v in ipairs(address) do print(i,v) end
  47. print()
  48. function dialNext(dialed)
  49. glyph = address[dialed + 1]
  50. print("Engaging "..glyph.."... ")
  51. sg.engageSymbol(glyph)
  52. end
  53. eventID = event.listen("stargate_spin_chevron_engaged", function(evname, address, caller, num, lock, glyph)
  54. os.sleep(2)
  55. if lock then
  56. if (event.cancel(eventID)) then
  57. print("Event cancelled successfully")
  58. end
  59. print("Engaging...")
  60. sg.engageGate()
  61. bm.setBeamerRole("transmit")
  62. bm.setActive(true)
  63. print("Transmitting")
  64. os.sleep(1)
  65. os.sleep(10)
  66. bm.setBeamerRole("disabled")
  67. red.setOutput(sides.left, 0)
  68. doing = false
  69. os.sleep(1)
  70. print("Stargate Shutdown")
  71. sg.disengageGate()
  72. os.sleep(5)
  73. bm.setBeamerRole("receive")
  74. os.sleep(2)
  75. else
  76. dialNext(num)
  77. end
  78.  
  79.  
  80.  
  81. end)
  82.  
  83.  
  84.  
  85. dialNext(0)
  86. doing = true
  87. print()
  88. while doing do os.sleep(0.1) end
  89.  
  90. elseif raw == "Relay2B" then
  91. print("Recieving")
  92. bm.setBeamerRole("receive")
  93. bm.setActive(true)
  94. red.setOutput(sides.right, 1)
  95. os.sleep(83)
  96. print("Engaging IO")
  97. red.setOutput(sides.right, 0)
  98. os.sleep(1)
  99. red.setOutput(sides.right, 1)
  100. os.sleep(1)
  101. red.setOutput(sides.right, 0)
  102. print("Resetting")
  103. red.setOutput(sides.back, 1)
  104. os.sleep(1)
  105. red.setOutput(sides.back, 0)
  106.  
  107. end
  108. until asd == 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement