Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Firstly we want to ensure that we have a neural interface and wrap it.
- local modules = peripheral.find("neuralInterface")
- if not modules then
- error("Must have a neural interface", 0)
- end
- if not modules.hasModule("plethora:kinetic", 0) then error("Must have a kinetic agument", 0) end
- --- We run several loop at once, to ensure that various components do not delay each other.
- local meta = {}
- local hover = false
- parallel.waitForAny(
- --- This loop just pulls user input. It handles a couple of function keys, as well as
- --- setting the "hover" field to true/false.
- function()
- while true do
- local event, key = os.pullEvent()
- if event == "key" and key == keys.o then
- -- The O key launches you high into the air.
- modules.launch(0, -90, 3)
- elseif event == "key" and key == keys.p then
- -- The P key launches you a little into the air.
- modules.launch(0, -90, 1)
- elseif event == "key" and key == keys.k then
- -- Holding the K key enables "hover" mode. We disable it when it is released.
- if not hover then
- hover = true
- os.queueEvent("hover")
- end
- elseif event == "key_up" and key == keys.k then
- hover = false
- end
- end
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement