Famous1337

Untitled

Apr 13th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 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.     -- modem.transmit(4, 1, "go")
  24.   end
  25.   sleep(0.05)
  26. end
Add Comment
Please, Sign In to add comment