Advertisement
Alexr360

Bastion Reciever Fireplace

Feb 23rd, 2024 (edited)
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local modem = peripheral.find("modem") or error("No modem attached", 0)
  2. CHANNEL = 15
  3. modem.open(CHANNEL)
  4.  
  5. local function receiveMessage()
  6.     local event, _, channel, _, message = os.pullEvent("modem_message")
  7.     if channel == CHANNEL then
  8.         return message
  9.     else
  10.         return receiveMessage()
  11.     end
  12. end
  13.  
  14. term.clear()
  15. term.setCursorPos(1, 1)
  16. print("Bastion Network Online!")
  17.  
  18. local message = receiveMessage()
  19.  
  20. -- Function to summon particles at a given position
  21. local function summonParticles(x, y, z)
  22.     for _ = 1, 10 do
  23.         commands.exec("particle minecraft:portal " .. x .. " " .. y .. " " .. z .. " 1 1 1 0.1 50")
  24.         sleep(0.1) -- Creates a brief delay between particle bursts
  25.     end
  26. end
  27.  
  28. -- Process the received message based on its content
  29. if message == "Recall" then
  30.     print("Recalling Player...")
  31.     modem.transmit(43, CHANNEL, "Recalling Player...")
  32.  
  33.     print("Starting Teleporter")
  34.     os.sleep(2)
  35.  
  36.     for i = 1, 100 do
  37.         local chargePercent = i
  38.         print("Charging " .. chargePercent .. "%")
  39.         modem.transmit(43, CHANNEL, "Charging " .. chargePercent .. "%")
  40.         sleep(0.05) -- 100 updates over 5 seconds
  41.     end
  42.  
  43.     -- Teleport the player
  44.     local targetX, targetY, targetZ = 293, 95, 750
  45.     commands.exec("tp Alexr036 " .. targetX .. " " .. targetY .. " " .. targetZ)
  46.  
  47.     -- Summon teleport particles
  48.     summonParticles(targetX, targetY, targetZ)
  49.  
  50. elseif message == "Teleport" then
  51.     print("Programming Started")
  52.  
  53.     local positionX = receiveMessage()
  54.     print("Position X: " .. positionX)
  55.  
  56.     local positionY = receiveMessage()
  57.     print("Position Y: " .. positionY)
  58.  
  59.     local positionZ = receiveMessage()
  60.     print("Position Z: " .. positionZ)
  61.    
  62.     print("Starting Teleporter")
  63.     os.sleep(2)
  64.  
  65.     for i = 1, 100 do
  66.         local chargePercent = i
  67.         print("Charging " .. chargePercent .. "%")
  68.         modem.transmit(43, CHANNEL, "Charging " .. chargePercent .. "%")
  69.         sleep(0.05) -- 100 updates over 5 seconds
  70.     end
  71.  
  72.     -- Teleport the player
  73.     commands.exec("tp Alexr036 " .. positionX .. " " .. positionY .. " " .. positionZ)
  74.  
  75.     -- Summon teleport particles
  76.     summonParticles(positionX, positionY, positionZ)
  77.  
  78. elseif message == "Remote Connected" then
  79.     print("Connected to System")
  80.     modem.transmit(43, CHANNEL, "Connected to System")
  81. end
  82.  
  83. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement