Advertisement
LostMiner

Untitled

Nov 1st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ----Quarry Bot Redux----
  2.  
  3. --Variables--
  4.  
  5. t = turtle
  6.  
  7. --Functions--
  8.  
  9. function f()
  10.     if t.detect() then
  11.         t.dig()
  12.         t.forward()
  13.     else
  14.         t.forward()
  15.     end
  16. end
  17. function d()
  18.     if t.detectDown() then
  19.         t.digDown()
  20.         t.down()
  21.     else
  22.         t.down()
  23.     end
  24. end
  25.  
  26. function refuel()
  27.     if t.getFuelLevel() == 0 then
  28.             pleaseRefuel()
  29.         end
  30.     end
  31. function store()
  32.  if t.getItemCount(16) > 0 then
  33.         pleaseStore()
  34.     end
  35. end
  36.  
  37. function pleaseRefuel()
  38.     t.select(1)
  39.     t.digUp()
  40.     t.placeUp()
  41.     t.suckUp()
  42.     t.refuel()
  43.     t.digUp()
  44. end
  45. function pleaseStore()
  46.     t.select(2)
  47.     t.digUp()
  48.     t.placeUp()
  49.     num = 3
  50.     while num < 17 do
  51.         t.select(num)
  52.         t.dropUp()
  53.     num = num + 1
  54.     end
  55.     t.select(2)
  56.     t.digUp()
  57. end
  58.  
  59. function checkers()
  60.   refuel()
  61.   store()
  62. end
  63.  
  64. function layer()
  65.     x = 16
  66.     z = 16
  67.     dot = true
  68.     while x > 1 do
  69.         while z > 1 do
  70.             checkers()
  71.             f()
  72.             z = z - 1
  73.         end
  74.         if dot then
  75.             t.turnRight()
  76.             if not (x == 2) then
  77.                 f()
  78.             end
  79.             t.turnRight()
  80.             dot = not dot
  81.         else
  82.             t.turnLeft()
  83.             if not (x == 2) then
  84.                 f()
  85.             end
  86.             t.turnLeft()
  87.             dot = not dot
  88.         end
  89.         z = 16
  90.         x = x - 1
  91.     end
  92.     d()
  93. end
  94.  
  95. function quarry()
  96.   y = io.read()
  97.   y = tonumber(y)
  98.   while y > 0 do
  99.     layer()
  100.     y = y - 1
  101.   end
  102. end  
  103.  
  104. quarry()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement