Advertisement
ReIative

meme

Jun 28th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. local modules = peripheral.find("neuralInterface")
  2. if not modules then
  3. error("No neural interface detected!", 0)
  4. end
  5.  
  6. local meta = {}
  7. local hover = false
  8. local launch = false
  9.  
  10. parallel.waitForAny(function()
  11. while true do
  12. local event, key = os.pullEvent()
  13. if event == "key" and key == keys.b then
  14. if not launch then
  15. launch = true
  16. os.queueEvent("launch")
  17. end
  18. elseif event == "key_up" and key == keys.b then
  19. launch = false
  20. elseif event == "key" and key == keys.h then
  21. if not hover then
  22. hover = true
  23. os.queueEvent("hover")
  24. end
  25. elseif event == "key_up" and key == keys.h then
  26. hover = false
  27. end
  28. end
  29. end, function()
  30. while true do
  31. meta = modules.getMetaOwner()
  32. end
  33. end, function()
  34. while true do
  35. if hover then
  36. local mY = meta.motionY
  37. mY = (mY - 0.138) / 0.8
  38. if mY > 0.5 or mY < 0 then
  39. local sign = 1
  40. if mY < 0 then sign = -1 end
  41. pcall(function() modules.launch(0, 90 * sign, math.min(0.5, math.abs(mY))) end)
  42. else
  43. os.pullEvent("hover")
  44. end
  45. end
  46. end
  47. end, function()
  48. while true do
  49. if launch then
  50. pcall(function() modules.launch(meta.yaw, meta.pitch, 2) end)
  51. else
  52. os.pullEvent("launch")
  53. end
  54. end
  55. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement