Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.find("modem") or error("No modem attached", 0)
- CHANNEL = 15
- modem.open(CHANNEL)
- local function receiveMessage()
- local event, _, channel, _, message = os.pullEvent("modem_message")
- if channel == CHANNEL then
- return message
- else
- return receiveMessage()
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- print("Bastion Network Online!")
- local message = receiveMessage()
- -- Function to summon particles at a given position
- local function summonParticles(x, y, z)
- for _ = 1, 10 do
- commands.exec("particle minecraft:portal " .. x .. " " .. y .. " " .. z .. " 1 1 1 0.1 50")
- sleep(0.1) -- Creates a brief delay between particle bursts
- end
- end
- -- Process the received message based on its content
- if message == "Recall" then
- print("Recalling Player...")
- modem.transmit(43, CHANNEL, "Recalling Player...")
- print("Starting Teleporter")
- os.sleep(2)
- for i = 1, 100 do
- local chargePercent = i
- print("Charging " .. chargePercent .. "%")
- modem.transmit(43, CHANNEL, "Charging " .. chargePercent .. "%")
- sleep(0.05) -- 100 updates over 5 seconds
- end
- -- Teleport the player
- local targetX, targetY, targetZ = 293, 95, 750
- commands.exec("tp Alexr036 " .. targetX .. " " .. targetY .. " " .. targetZ)
- -- Summon teleport particles
- summonParticles(targetX, targetY, targetZ)
- elseif message == "Teleport" then
- print("Programming Started")
- local positionX = receiveMessage()
- print("Position X: " .. positionX)
- local positionY = receiveMessage()
- print("Position Y: " .. positionY)
- local positionZ = receiveMessage()
- print("Position Z: " .. positionZ)
- print("Starting Teleporter")
- os.sleep(2)
- for i = 1, 100 do
- local chargePercent = i
- print("Charging " .. chargePercent .. "%")
- modem.transmit(43, CHANNEL, "Charging " .. chargePercent .. "%")
- sleep(0.05) -- 100 updates over 5 seconds
- end
- -- Teleport the player
- commands.exec("tp Alexr036 " .. positionX .. " " .. positionY .. " " .. positionZ)
- -- Summon teleport particles
- summonParticles(positionX, positionY, positionZ)
- elseif message == "Remote Connected" then
- print("Connected to System")
- modem.transmit(43, CHANNEL, "Connected to System")
- end
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement