SHOW:
|
|
- or go back to the newest paste.
| 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 | - | event, sender, message, protocol = os.pullEvent("rednet_message")
|
| 11 | + | radius = 3 |
| 12 | - | if protocol == sendLoc then |
| 12 | + | for angle = 0,360,1 do |
| 13 | - | droneCon.clearArea() |
| 13 | + | event, sender, message, protocol = os.pullEvent("rednet_message")
|
| 14 | - | userLoc = message |
| 14 | + | if protocol == sendLoc then |
| 15 | - | term.setCursorPos(1,2) |
| 15 | + | userLoc = message |
| 16 | - | print(userLoc[1]) |
| 16 | + | --term.setCursorPos(1,2) |
| 17 | - | print(userLoc[2]) |
| 17 | + | --print(userLoc[1]) |
| 18 | - | print(userLoc[3]) |
| 18 | + | --print(userLoc[2]) |
| 19 | - | x = tonumber(userLoc[1]) |
| 19 | + | --print(userLoc[3]) |
| 20 | - | y = tonumber(userLoc[2]) |
| 20 | + | droneCon.clearArea() |
| 21 | - | z = tonumber(userLoc[3]) |
| 21 | + | x = tonumber(userLoc[1]) |
| 22 | - | droneCon.addArea(x, y, z) |
| 22 | + | y = tonumber(userLoc[2]) |
| 23 | - | droneCon.setAction("goto")
|
| 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 |