Cobra_Tomtrein-temp-

Untitled

May 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. local meta = {}
  2. local modules = peripheral.wrap("back")
  3.  
  4.  
  5. function doHover()
  6. while true do
  7. -- We calculate the required motion we need to take
  8. local mY = meta.motionY
  9. mY = (mY - 0.138) / 0.8
  10.  
  11. -- If it is sufficiently large then we fire ourselves in that direction.
  12. if mY > 0.5 or mY < 0 then
  13. local sign = 1
  14. if mY < 0 then sign = -1 end
  15. modules.launch(0, 90 * sign, math.min(4, math.abs(mY)))
  16. else
  17. sleep(0)
  18. end
  19. end
  20. end
  21.  
  22. function getMeta()
  23. while true do
  24. meta = modules.getMetaOwner()
  25. end
  26. end
  27.  
  28. meta = modules.getMetaOwner()
  29. parallel.waitForAny(doHover,getMeta)
Advertisement
Add Comment
Please, Sign In to add comment