Advertisement
osmarks

Radar Target Scanner

Nov 10th, 2019
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local radar = peripheral.find "radar"
  2. local radar_offset = {0, 0, -1}
  3. local x, y, z = gps.locate()
  4.  
  5. while true do
  6.     write "Target: "
  7.     local target = read()
  8.     print "Scanning..."
  9.     local es = radar.getEntities()
  10.     for _, e in pairs(es) do
  11.         if e.name == target then
  12.             print "Found matching entity."
  13.             local tx, ty, tz = x + e.x + radar_offset[1], y + e.y + radar_offset[2], z + e.z + radar_offset[3]
  14.             print(("Target is at %f %f %f"):format(tx, ty, tz))
  15.             break
  16.         end
  17.     end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement