Guest User

quarry

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