Advertisement
sumguytwitches

Ore Scanner

Mar 6th, 2024 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. sgscanning off.
  2. wait 0.
  3. set lastpos to latlng(90,90).
  4. set sgmax to addons:scansat:resourceat(body, lastpos , "ore").
  5. set sgstep to 10.
  6. set sgd to 4.6e3.
  7. set sgh to -sgstep.
  8. set sgi to 20.
  9. set sgmaxgap to 2500.
  10. sgscanning on.
  11.  
  12.  
  13. when sgscanning then {
  14. set sgh to sgh + sgstep.
  15. if sgh > 360 { set sgd to sgd + 1000. set sgh to -sgstep.}
  16. print ("scanning " + sgh:tostring():padright(6) + " range " + sgd:tostring()):padright(terminal:width) at (0, sgi).
  17. local pos is body:Geopositionof(heading(sgh,0):vector * sgd).
  18. local gap is (pos:position-lastpos):mag.
  19. print ("Gap at " + round(gap)):tostring():padright(terminal:width) at (0,sgi + 1).
  20. if (gap > sgmaxgap) {
  21. set sgstep to sgstep / 2.
  22. print "Gap too big, step now " + sgstep.
  23. }
  24. set lastpos to pos:position.
  25. local sgore to addons:scansat:resourceat(body, pos, "ore").
  26. if sgore > sgmax {
  27. set sgmax to sgore.
  28. print char(7).
  29. set maxpos to pos.
  30. print "Found at " + round(maxpos:distance):tostring() + "m away".
  31. print sgore.
  32. }
  33. return sgscanning.
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement