Advertisement
Tommo5261

Warp Drive Laser

Aug 2nd, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. modem = peripheral.wrap("right")
  2. laser = peripheral.wrap("left")
  3. laser.beamFrequency(1420)
  4. laser.videoChannel(100)
  5.  
  6. -- Shoots fired count
  7. firedCount = 0
  8.  
  9. while true do
  10. -- pull a laser head for new target
  11. type, x_, y_, z_, id, meta, res = laser.getScanResult()
  12. if res ~= -1 then
  13. firedCount = firedCount + 1
  14.  
  15. -- send serialized target info
  16. target = textutils.serialize( { x = x_, y = y_, z = z_ } )
  17. print("Target#" .. firedCount .. " is " .. target)
  18.  
  19. -- init main laser with target
  20. modem.transmit(3, 1, target)
  21.  
  22. -- init boost (remove comment on next line if you use boosters)
  23. end
  24. sleep(0.05)
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement