Advertisement
Volaik

orbit.lua

Oct 8th, 2023
1,112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. modem = peripheral.find("modem")
  2. droneCon = peripheral.find("drone_interface")
  3.  
  4. rednet.open("left")
  5.  
  6. io.write("Input tablet ID: ")
  7. buddy = tonumber(read())
  8. rednet.send(buddy, "con1")
  9.  
  10. while true do
  11. radius = 3
  12.     for angle = 0,360,1 do
  13.         event, sender, message, protocol = os.pullEvent("rednet_message")
  14.         if protocol == sendLoc then
  15.             userLoc = message
  16.             --term.setCursorPos(1,2)
  17.             --print(userLoc[1])
  18.             --print(userLoc[2])
  19.             --print(userLoc[3])
  20.             droneCon.clearArea()
  21.             x = tonumber(userLoc[1])
  22.             y = tonumber(userLoc[2])
  23.             z = tonumber(userLoc[3])
  24.             radians = math.rad(angle)
  25.             deltaX = radius * math.cos(radians)
  26.             deltaY = radius * math.sin(radians)
  27.             droneCon.addArea(x+deltaX, y+deltaY, z)
  28.             droneCon.setAction("goto")
  29.         end
  30.     end
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement