Advertisement
Proaxel

Untitled

May 24th, 2020
1,784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. args = {...}
  2. dist = args[1]
  3. run = true
  4. torchDistance = 0
  5. currentDistance = 0
  6. print("Enter the distance as an integer...")
  7. maxDistance = io.read()
  8. distance = tonumber(distance)
  9. print("Starting mine")
  10.  
  11. while run do
  12.     turtle.dig()
  13.     turtle.digUp()
  14.     turtle.digDown()
  15.    
  16.     turtle.turnRight()
  17.     turtle.dig()
  18.     turtle.digUp()
  19.     turtle.digDown()
  20.     turtle.turnLeft()
  21.    
  22.     turtle.turnLeft()
  23.     turtle.dig()
  24.     turtle.digUp()
  25.     turtle.digDown()
  26.     turtle.turnRight()
  27.  
  28.     turtle.forward()
  29.     currentDistance = currentDistance + 1
  30.     torchDistance = torchDistance + 1
  31.    
  32.     if turtle.getItemCount(15) > 0 then
  33.         if torchDistance >= 5 then
  34.             print("Setting Torch")
  35.             turtle.select(15)
  36.             turtle.dropDown()
  37.             turtle.select(1)
  38.             torchDistance = 0
  39.         end
  40.     end
  41.     if turtle.getItemCount(13) > 0 then
  42.         print("nearly full, chest dumping")
  43.         turtle.select(16)
  44.         turtle.placeDown()
  45.         for a = 1, 14 do
  46.             turtle.select(a)
  47.             turtle.dropDown()
  48.         end
  49.         if turtle.getItemCount(16) < 0 then
  50.             print("Out of chests!! Stopping")
  51.             run = false
  52.         end
  53.         turtle.select(1)
  54.     end
  55.    
  56.     if currentDistance >= maxDistance then
  57.         print("Max distance reached. Stopping")
  58.         run = false    
  59.     end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement