Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if rednet.isOpen() ~= true then
- rednet.open('right')
- end
- local proto = 'waypoint'
- rednet.host(proto, 'Philip')
- local waypoints = List.new()
- local target = vector.new(gps.locate())
- print(target)
- function listen()
- while true do
- local sender, loc = rednet.receive(proto)
- target.x, target.y, target.z = unpack(loc)
- print(target)
- print('#'..sender..' ('..loc[1]..', '..loc[2]..', '..loc[3]..')')
- --waypoints:push(loc)
- --print(turtle.position())
- --print(turtle.position())
- end
- end
- function travel()
- while true do
- --while #waypoints > 0 do
- --local loc = waypoints:pop()
- --print('travel',target)
- turtle.follow(target, 1)
- --end
- sleep(1)
- end
- end
- parallel.waitForAny(listen, travel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement