Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. --- Firstly we want to ensure that we have a neural interface and wrap it.
  2. local modules = peripheral.find("neuralInterface")
  3. if not modules then
  4. error("Must have a neural interface", 0)
  5. end
  6.  
  7. if not modules.hasModule("plethora:kinetic", 0) then error("Must have a kinetic agument", 0) end
  8.  
  9. --- We run several loop at once, to ensure that various components do not delay each other.
  10. local meta = {}
  11. local hover = false
  12. parallel.waitForAny(
  13. --- This loop just pulls user input. It handles a couple of function keys, as well as
  14. --- setting the "hover" field to true/false.
  15. function()
  16. while true do
  17. local event, key = os.pullEvent()
  18. if event == "key" and key == keys.o then
  19. -- The O key launches you high into the air.
  20. modules.launch(0, -90, 3)
  21. elseif event == "key" and key == keys.p then
  22. -- The P key launches you a little into the air.
  23. modules.launch(0, -90, 1)
  24. elseif event == "key" and key == keys.k then
  25. -- Holding the K key enables "hover" mode. We disable it when it is released.
  26. if not hover then
  27. hover = true
  28. os.queueEvent("hover")
  29. end
  30. elseif event == "key_up" and key == keys.k then
  31. hover = false
  32. end
  33. end
  34. end
  35. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement