Advertisement
electronic_steve

geotablet

Aug 23rd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local com = require('component')
  2. local event = require('event')
  3. local keyboard=require('keyboard')
  4. local geo=com.geolyzer
  5.  
  6. arg={...}
  7. rad=(tonumber(arg[1]) or 5)
  8. ef=(tonumber(arg[2]) or 2.8)
  9. targ={999,0,0,0,0}
  10. ores={
  11. {2.9,3.1,"iron/diamons/redstone"}
  12. }
  13.  
  14. for x=-rad,rad do
  15.     for z=-rad,rad do
  16.         map=geo.scan(x,z)
  17.         for y=-rad,rad do
  18.             if map[y+32]>ef and map[y+32]<50 then
  19.                 local dist=(x^2+y^2+z^2)^0.5
  20.                 if targ[1]>dist then
  21.                     targ[1]=dist
  22.                     targ[2],targ[3],targ[4]=x,y,z
  23.                     targ[5]=map[y+32]
  24.                 end
  25.             end
  26.         end
  27.     end
  28. end
  29. print("distances from ore:"..targ[1].." coords: X:"..targ[2].." Y:"..targ[3].." Z:"..targ[4].." density:"..targ[5])
  30. targ[1]=999
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement