Advertisement
charlesthepenguin

Untitled

Jul 29th, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 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.proxy("b0ed4e8a-f364-4a87-84c7-ad30fb70dd10")
  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 = component.proxy("b0ed4e8a-f364-4a87-84c7-ad30fb70dd10")
  15. red = component.proxy("9c980497-8473-4695-a209-fab60e95b817")
  16. modem = component.proxy("8ee6aa880-f70f-4cde-82d1-5b7b79b48856")
  17. sg = component.proxy("11f5b83f-bca9-4c38-aaf6-f5c089b7e424")
  18. port = 123
  19. bm = component.proxy("68e2cef2-d43e-490d-a11a-bd43fef6e2ef")
  20. local asd = 1
  21. print("SGC Gate Computer Program v1.1 /by Kevlaris")
  22. print("--------------------------------------------------------------------------------------------------------------------------------------------------------------")
  23. print()
  24.  
  25. repeat
  26. term.clear(false)
  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.  
  39. elseif raw == "Relay2B" then
  40. print("Recieving")
  41. bm.setBeamerRole("receive")
  42. bm.setActive(true)
  43. bm.getBeamerMode()
  44. red.setOutput(sides.right, 1)
  45. os.sleep(83)
  46. print("Engaging IO")
  47. red.setOutput(sides.right, 0)
  48. os.sleep(1)
  49. red.setOutput(sides.right, 1)
  50. os.sleep(1)
  51. red.setOutput(sides.right, 0)
  52. print("Resetting")
  53. red.setOutput(sides.back, 1)
  54. os.sleep(1)
  55. red.setOutput(sides.back, 0)
  56.  
  57. elseif raw == "BaseT" then
  58. print("preparing base")
  59. modem.broadcast(port, "prepare")
  60. print("Engaging IO")
  61. red.setOutput(sides.left, 1)
  62. address = {"Crater", "Monoceros", "Scorpius", "Serpens Caput", "Sculptor", "Aquarius", "Point of Origin"}
  63. os.sleep(0.5)
  64. print("Dialing")
  65. for i,v in ipairs(address) do print(i,v) end
  66. print()
  67.  
  68. function dialNext(dialed)
  69. glyph = address[dialed + 1]
  70. print("Engaging "..glyph.."... ")
  71.  
  72. sg.engageSymbol(glyph)
  73.  
  74. end
  75.  
  76. eventID = event.listen("stargate_spin_chevron_engaged", function(evname, address, caller, num, lock, glyph)
  77. os.sleep(2)
  78. if lock then
  79. if (event.cancel(eventID)) then
  80. print("Event cancelled successfully")
  81. end
  82. print("Engaging...")
  83. sg.engageGate()
  84. bm.setBeamerRole("transmit")
  85. getBeamerMode()
  86. print("Transmitting")
  87. os.sleep(1)
  88. os.sleep(10)
  89. bm.setBeamerRole("disabled")
  90. getBeamerMode()
  91. red.setOutput(sides.left, 0)
  92. doing = false
  93. os.sleep(1)
  94. print("Stargate Shutdown")
  95. sg.disengageGate()
  96. os.sleep(5)
  97. bm.setBeamerRole("receive")
  98. getBeamerMode()
  99. os.sleep(2)
  100. else
  101. dialNext(num)
  102. end
  103. end)
  104.  
  105.  
  106.  
  107. dialNext(0)
  108. doing = true
  109. print()
  110. while doing do os.sleep(0.1) end
  111.  
  112. end
  113. until asd == 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement