Advertisement
fatboychummy

Neural.lua

Oct 21st, 2019 (edited)
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 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
  7.   error("Must have a sensor", 0)
  8. end
  9. if not modules.hasModule("plethora:introspection") then
  10.   error("Must have an introspection module", 0)
  11. end
  12. if not modules.hasModule("plethora:kinetic", 0) then
  13.   error("Must have a kinetic agument", 0)
  14. end
  15.  
  16. parallel.waitForAny(
  17.   function()
  18.     while true do
  19.       local event, key = os.pullEvent()
  20.       if event == "key" then
  21.         if key == keys.c then
  22.           -- launch strong
  23.           modules.launch(meta.yaw, meta.pitch, 4)
  24.         elseif key == keys.v then
  25.           -- launch weak
  26.           modules.launch(meta.yaw, meta.pitch, 1)
  27.         end
  28.       end
  29.     end
  30.   end,
  31.   function()
  32.     while true do
  33.       meta = modules.getMetaOwner()
  34.       os.sleep() -- 20 updates per second is more than enough. I think modules.getmetaowner takes a tick as well though, so it may only be 10 per second. Still much more than enough.
  35.     end
  36.   end
  37. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement