Ledger Nano X - The secure hardware wallet
SHARE
TWEET

dig.lua

a guest Apr 10th, 2020 137 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 do
  66.             for k = 1, digFront + digBack do
  67.                 turtle.dig()
  68.                 turtle.forward()
  69.             end
  70.             if turnDirection == "right" then
  71.                 turtle.turnRight()
  72.                 turtle.dig()
  73.                 turtle.forward()
  74.                 turtle.turnRight()
  75.                 turnDirection = "left"
  76.             else
  77.                 turtle.turnLeft()
  78.                 turtle.dig()
  79.                 turtle.forward()
  80.                 turtle.turnLeft()
  81.                 turnDirection = "right"
  82.             end
  83.         end
  84.         --turtle.turnLeft()
  85.         --turtle.turnLeft()
  86.         --turtle.digDown()
  87.         --turtle.down()
  88.         --if turnDirection == "right" then
  89.         --    turnDirection = "left"
  90.         --else
  91.         --    turnDirection = "right"
  92.         --end
  93.         turtle.turnLeft()
  94.         turtle.turnLeft()
  95.         turtle.digDown()
  96.         turtle.down()
  97.         if turnDirection == "right" then
  98.             turnDirection = "left"
  99.         else
  100.             turnDirection = "right"
  101.         end
  102.     end
  103. 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