Advertisement
Patriik

Untitled

Mar 4th, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. local modules = peripheral.find("neuralInterface")
  2. if not modules then
  3. error("Must have a neural interface", 0)
  4. end
  5.  
  6. if not modules.hasModule("plethora:sensor") then error("Must have a sensor", 0) end
  7. if not modules.hasModule("plethora:introspection") then error("Must have an introspection module", 0) end
  8. if not modules.hasModule("plethora:kinetic", 0) then error("Must have a kinetic agument", 0) end
  9. if not modules.hasModule("plethora:glasses", 0) then error("Must have fat glasses", 0) end
  10.  
  11. local text = canvas.addText({ x = 1, y = 0.5 }, "")
  12. text.setScale(0.9)
  13.  
  14. local meta = {}
  15. local hover = false
  16. parallel.waitForAny(function()
  17. while true do
  18. local event, key = os.pullEvent()
  19. if event == "key" and key == keys.o then
  20. -- The O key launches you high into the air.
  21. modules.launch(0, -90, 3)
  22. elseif event == "key" and key == keys.p then
  23. -- The P key launches you a little into the air.
  24. modules.launch(0, -90, 1)
  25. elseif event == "key" and key == keys.l then
  26. -- The l key launches you in whatever direction you are looking.
  27. modules.launch(meta.yaw, meta.pitch, 3)
  28. elseif event == "key" and key == keys.k then
  29. -- Holding the K key enables "hover" mode. We disable it when it is released.
  30. if not hover then
  31. hover = true
  32. os.queueEvent("hover")
  33. end
  34. elseif event == "key_up" and key == keys.k then
  35. hover = false
  36. end
  37. end
  38. end,function()
  39. while true do
  40. if modules.getMetaOwner() then
  41. meta = modules.getMetaOwner()
  42. end
  43. end
  44. end,function()
  45. while true do
  46. if hover then
  47. -- We calculate the required motion we need to take
  48. local mY = meta.motionY
  49. mY = (mY - 0.138) / 0.8
  50.  
  51. -- If it is sufficiently large then we fire ourselves in that direction.
  52. if mY > 0.5 or mY < 0 then
  53. local sign = 1
  54. if mY < 0 then sign = -1 end
  55. modules.launch(0, 90 * sign, math.min(4, math.abs(mY)))
  56. else
  57. sleep(0)
  58. end
  59. else
  60. os.pullEvent("hover")
  61. end
  62. end
  63. end, function()
  64. while true do
  65. sleep(1)
  66. local tps = http.get("https://tps.switchcraft.pw/")
  67. local tpsData = tps.readAll()
  68. text.setText(tpsData)
  69. tps.close()
  70. end
  71. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement