Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this is a midway program ment to go into the end
- local gate_1 = peripheral.wrap("crystal_interface_27") --modify to the milkyway gate in the end
- local gate_2 = peripheral.wrap("crystal_interface_26") --modify to the pegasus gate in the end
- --since only you know how many interfaces you used in total
- local lantea_address = {29,5,17,34,6,12,0} -- Replace with Lantea
- local return_address = {27,25,4,35,10,28,0} -- Replace with return or home
- local last_feedback_1 = nil
- local last_feedback_2 = nil
- -- Function to dial a gate
- local function dialAddress(gate, address)
- print("Dialing: " .. table.concat(address, "-"))
- for _, symbol in ipairs(address) do
- gate.engageSymbol(symbol)
- os.sleep(0.5)
- end
- end
- local feedback = 0
- if gate_2 then
- local ok, result
- if ok then
- feedback = result
- else
- print("Pegasus gate feedback error:", result)
- end
- else
- print("Pegasus gate is nil during check.")
- end
- -- Function to check and return new feedback
- local function checkNewFeedback(gate, last_feedback)
- local feedback = gate.getRecentFeedback()
- if feedback ~= last_feedback then
- return feedback
- end
- return nil
- end
- print("Midway relay system running...")
- while true do
- local feedback_1 = checkNewFeedback(gate_1, last_feedback_1)
- local feedback_2 = checkNewFeedback(gate_2, last_feedback_2)
- if feedback_1 then
- last_feedback_1 = feedback_1
- print("Gate 1 Feedback:", feedback_1)
- if feedback_1 == -30 then
- print("Incoming wormhole detected on Gate 1. Dialing Lantea from Gate 2...")
- dialAddress(gate_2, lantea_address)
- elseif feedback_1 == 7 then
- print("Gate 1 disconnected.")
- end
- end
- if feedback_2 then
- last_feedback_2 = feedback_2
- print("Gate 2 Feedback:", feedback_2)
- if feedback_2 == -30 then
- print("Incoming wormhole detected on Gate 2. Dialing return address from Gate 1...")
- dialAddress(gate_1, return_address)
- elseif feedback_2 == 7 then
- print("Gate 2 disconnected.")
- end
- end
- os.sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement