Advertisement
charlesthepenguin

iocentral

Jul 29th, 2020 (edited)
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 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. local 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, "Relay1")
  37. os.sleep(1)
  38. elseif raw == "BaseT" then
  39. address = {"Crater", "Monoceros", "Scorpius", "Serpens Caput", "Sculptor", "Aquarius", "Point of Origin"}
  40. os.sleep(0.5)
  41. print("Dialing")
  42. for i,v in ipairs(address) do print(i,v) end
  43. print()
  44. function dialNext(dialed)
  45. glyph = address[dialed + 1]
  46. print("Engaging "..glyph.."... ")
  47. sg.engageSymbol(glyph)
  48. end
  49. eventID = event.listen("stargate_spin_chevron_engaged", function(evname, address, caller, num, lock, glyph)
  50. os.sleep(2)
  51. if lock then
  52. if (event.cancel(eventID)) then
  53. print("Event cancelled successfully")
  54. end
  55. print("Engaging...")
  56. sg.engageGate()
  57. bm.setBeamerRole("transmit")
  58. print("Transmitting")
  59. os.sleep(1)
  60. print("Engaging IO")
  61. red.setOutput(sides.left, 1)
  62. os.sleep(1)
  63. os.sleep(5)
  64. bm.setBeamerRole("disabled")
  65. red.setOutput(sides.left, 0)
  66. doing = false
  67. os.sleep(1)
  68. print("Stargate Shutdown")
  69. sg.disengageGate()
  70. os.sleep(5)
  71. bm.setBeamerRole("receive")
  72. os.sleep(2)
  73. else
  74. dialNext(num)
  75. end
  76.  
  77.  
  78.  
  79. end)
  80.  
  81.  
  82.  
  83. dialNext(0)
  84. doing = true
  85. print()
  86. while doing do os.sleep(0.1) end
  87.  
  88. elseif raw == "Relay2" then
  89. print("Recieving")
  90. bm.setBeamerRole("receive")
  91. red.setOutput(sides.right, 1)
  92. os.sleep(83)
  93. print("Engaging IO")
  94. red.setOutput(sides.right, 0)
  95. os.sleep(1)
  96. red.setOutput(sides.right, 1)
  97. os.sleep(1)
  98. red.setOutput(sides.right, 0)
  99. print("Resetting")
  100. red.setOutput(sides.back, 1)
  101. os.sleep(1)
  102. red.setOutput(sides.back, 0)
  103.  
  104. end
  105. until asd == 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement