Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xCoord = 110
- local yCoord = 67
- local zCoord = -26
- local targetCoordX = 0
- local targetCoordY = 0
- local targetCoordZ = 0
- local yTravel = 105
- locations = {home = {108, 69, -26}}
- local m = component.proxy(component.list('modem')())
- local drone = component.proxy(component.list('drone')())
- local l = component.proxy(component.list('leash')())
- function wait()
- while drone.getOffset() > 0.7 or drone.getVelocity() > 0.9 do
- computer.pullSignal(0.2)
- end
- end
- m.open(2412)
- local function respond(...)
- local args = table.pack(...)
- pcall(function() m.broadcast(2412, table.unpack(args)) end)
- end
- local function recieve()
- while true do
- local evt, _, _, _, _, cmds = computer.pullSignal()
- if evt == "modem_message" then
- return cmds
- end
- end
- end
- while true do
- local result, reason = pcall(function()
- local result = recieve()
- if not result or result == "" then
- return
- end
- local words = {}
- for word in result:gmatch("([^%s]+)") do
- table.insert(words, word)
- end
- if words[1] == "goto" then
- targetCoordX = words[3]-xCoord
- targetCoordZ = words[5]-zCoord
- drone.move(0, (yTravel-yCoord), 0)
- wait()
- yCoord = yTravel
- drone.move(targetCoordX, 0, targetCoordZ)
- wait()
- targetCoordY = words[4]-yCoord
- drone.move(0, targetCoordY, 0)
- wait()
- xCoord = words[3]
- yCoord = words[4]
- zCoord = words[5]
- elseif words[1] == "leash" then
- l.leash(0)
- else
- local ok,err = pcall(load(result))
- if not ok then
- respond(err)
- end
- end
- end)
- if not result then respond(reason) end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement