Notze

Quarry v2.4

Aug 22nd, 2013
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.79 KB | None | 0 0
  1. --[[
  2. Version 2.4
  3. Written by: Tom Nordloh (Notze)
  4.  
  5. This script will dig a box with the
  6. length you wish!
  7. Place the following things into the
  8. Turtles inventory:
  9. Slot 1: cole
  10. ]]
  11.  
  12. -- make your adjustments here
  13. local int x = 5 -- from Turtle's direction right
  14. local int y = 5 -- height, like Minecraft (F3) y
  15. local int z = 5 -- in Turtle's looking direction
  16. -- end of adjustments
  17.  
  18. function main()
  19.     local futherDown = false
  20.     for i=1, y, 1 do
  21.         refuel( 1 + ((x*z)/96) + ((x+y)/96) )
  22.         down(1)
  23.         local boolean nextEndUp = true
  24.         forward(z-1)
  25.         for j=2, x, 1 do
  26.  
  27.             if nextEndUp then
  28.                 turnRight()
  29.                 forward(1)
  30.                 turnRight()
  31.                 forward(z-1, futherDown)
  32.                 nextEndUp = false
  33.             else
  34.                 turnLeft()
  35.                 forward(1)
  36.                 turnLeft()
  37.                 forward(z-1, futherDown)
  38.                 nextEndUp = true
  39.             end
  40.  
  41.         end
  42.  
  43.         if nextEndUp then
  44.             turnAround()
  45.         else
  46.             turnRight()
  47.             forward(x-1, futherDown)
  48.             turnRight()
  49.         end
  50.         futherDown = true
  51.     end
  52.     up(y)
  53. end
  54.  
  55. function refuel(amount)
  56.     if turtle.getFuelLevel() < 96*amount then
  57.         turtle.select(1)
  58.         turtle.refuel(amount)
  59.     end
  60. end
  61.  
  62. function forward(length, fast)
  63.     for i=1, length, 1 do
  64.         if fast then
  65.             turtle.dig()
  66.             turtle.forward()
  67.         else
  68.             while turtle.detect() do
  69.                 turtle.dig()
  70.                 --sleep(0.5)
  71.             end
  72.             turtle.forward()
  73.         end
  74.     end
  75. end
  76.  
  77. function back(length)
  78.     for i=1, length, 1 do
  79.         turtle.back()
  80.     end
  81. end
  82.  
  83. function turnRight()
  84.     turtle.turnRight()
  85. end
  86.  
  87. function turnLeft()
  88.     turtle.turnLeft()
  89. end
  90.  
  91. function turnAround()
  92.     turnRight()
  93.     turnRight()
  94. end
  95.  
  96. function up(length)
  97.     for i=1, length, 1 do
  98.         while turtle.detectUp() do
  99.             turtle.digUp()
  100.             sleep(0.5)
  101.         end
  102.         turtle.up()
  103.     end
  104. end
  105.  
  106. function down(length)
  107.     for i=1, length, 1 do
  108.         turtle.digDown()
  109.         turtle.down()
  110.     end
  111. end
  112.  
  113. main()
Advertisement
Add Comment
Please, Sign In to add comment