G2A Many GEOs
SHARE
TWEET

dig

a guest Apr 10th, 2020 156 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local runif = true
  2. local turnDirection = "right"
  3. term.clear()
  4. term.setCursorPos(1, 1)
  5.  
  6. print("Please input dig dimensions :")
  7. print("Left :")
  8. local digLeft = read()
  9.  
  10. print("Right :")
  11. local digRight = read()
  12.  
  13. print("Front :")
  14. local digFront = read()
  15.  
  16. print("Back :")
  17. local digBack = read()
  18.  
  19. print("Top :")
  20. local digTop = read()
  21.  
  22. print("Bottom :")
  23. local digBottom = read()
  24.  
  25. term.clear()
  26. term.setCursorPos(1, 1)
  27.  
  28. local totalBlocks = (digFront + 1 + digBack) * (digRight + 1 + digLeft) * (digTop + 1 + digBottom)
  29. if totalBlocks > 1024 then
  30.     runif = false
  31.     print("Estimated dig volume is "..totalBlocks.." blocks. Insufficient inventory space.")
  32. end
  33.  
  34. for i = 1, 16 do
  35.     turtle.select(i)
  36.     turtle.refuel()
  37. end
  38.  
  39. if totalBlocks > turtle.getFuelLevel() then
  40.     print("Fuel level is "..turtle.getFuelLevel()..". Insufficient fuel.")
  41.     runif = false
  42. end
  43.  
  44. if runif then
  45.     turtle.turnLeft()
  46.     turtle.turnLeft()
  47.     for i = 1, digBack do
  48.         turtle.dig()
  49.         turtle.forward()
  50.     end
  51.     turtle.turnRight()
  52.     for i = 1, digLeft do
  53.         turtle.dig()
  54.         turtle.forward()
  55.     end
  56.     for i = 1, digTop do
  57.         turtle.digUp()
  58.         turtle.up()
  59.     end
  60.     turtle.turnRight()
  61. end
  62.  
  63. while runif do
  64.     for i = 1, digTop + digBottom do
  65.         for j = 1, digLeft + digRight + 1 do
  66.             for k = 1, digFront + digBack do
  67.                 turtle.dig()
  68.                 turtle.forward()
  69.             end
  70.             if j ~= digLeft + digRight + 1 then
  71.                 if turnDirection == "right" then
  72.                     turtle.turnRight()
  73.                     turtle.dig()
  74.                     turtle.forward()
  75.                     turtle.turnRight()
  76.                     turnDirection = "left"
  77.                 else
  78.                     turtle.turnLeft()
  79.                     turtle.dig()
  80.                     turtle.forward()
  81.                     turtle.turnLeft()
  82.                     turnDirection = "right"
  83.                 end
  84.             end
  85.         end
  86.         turtle.turnLeft()
  87.         turtle.turnLeft()
  88.         turtle.digDown()
  89.         turtle.down()
  90.         --if turnDirection == "right" then
  91.         --    turnDirection = "left"
  92.         --else
  93.         --    turnDirection = "right"
  94.         --end
  95.     end
  96. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top