Advertisement
kremnev8

drone

Mar 12th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. drone = component.proxy(component.list("drone")())
  2. modem = component.proxy(component.list("modem")())
  3. leash = component.proxy(component.list("leash")())
  4.  
  5. modem.open(27)
  6.  
  7. route = {}
  8. path = {}
  9. current = ""
  10.  
  11. while true do
  12. name, _, sender, _, _, message, x, y, z, point, from = computer.pullSignal(1)
  13. if name == "modem_message" then
  14. if message == 'add' then
  15. add(tonumber(x), tonumber(y), tonumber(z), point, from)
  16. if current == "" then current = point end
  17. elseif message == 'to' then
  18. to(x)
  19. elseif message == 'catch' then
  20. catch()
  21. elseif message == 'drop' then
  22. drop()
  23. end
  24. end
  25. if #path > 0 and drone.getOffset() < 1 then
  26. drone.move(route[path[#path]].x-route[current].x,
  27. route[path[#path]].y-route[current].y,
  28. route[path[#path]].z-route[current].z)
  29. current = path[#path]
  30. path[#path] = nil
  31. end
  32. end
  33.  
  34. modem.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement