Advertisement
Guest User

philip

a guest
Oct 25th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. if rednet.isOpen() ~= true then
  2.   rednet.open('right')
  3. end
  4. local proto = 'waypoint'
  5. rednet.host(proto, 'Philip')
  6.  
  7.  
  8. local waypoints = List.new()
  9. local target = vector.new(gps.locate())
  10. print(target)
  11.  
  12. function listen()
  13. while true do
  14.   local sender, loc = rednet.receive(proto)
  15.   target.x, target.y, target.z = unpack(loc)
  16.   print(target)
  17.   print('#'..sender..' ('..loc[1]..', '..loc[2]..', '..loc[3]..')')
  18.   --waypoints:push(loc)
  19.   --print(turtle.position())
  20.   --print(turtle.position())
  21. end
  22. end
  23.  
  24. function travel()
  25. while true do
  26.   --while #waypoints > 0 do
  27.     --local loc = waypoints:pop()
  28.     --print('travel',target)
  29.   turtle.follow(target, 1)
  30.   --end
  31.   sleep(1)
  32. end  
  33. end
  34.  
  35. parallel.waitForAny(listen, travel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement