Advertisement
charlesthepenguin

baseiot

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