Advertisement
Cwackers

Mine No Torch w/ Fuel

May 25th, 2024 (edited)
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local args = {...}
  2.  
  3. local depth = 65/3
  4. local stripLength = 22
  5. local count = 0
  6. local line = 0
  7.  
  8. if not #args == 0 then
  9.   print("Usage: hole")
  10.   return
  11. end
  12.  
  13. function strip()
  14.   count = 0
  15.     while turtle.detectDown() do
  16.       turtle.digDown()
  17.       sleep(0.2)
  18.     end
  19.     while turtle.detectUp() do
  20.       turtle.digUp()
  21.       sleep(0.2)
  22.     end
  23.   for i=1,stripLength do
  24.     checkFuel(stripLength)
  25.     count = count + 1
  26.     checkInv()
  27.     while not turtle.forward() do turtle.dig() end
  28.     while turtle.detectUp() do
  29.       turtle.digUp()
  30.       sleep(0.2)
  31.     end
  32.     while turtle.detectDown() do
  33.       turtle.digDown()
  34.       sleep(0.2)
  35.     end
  36.   end
  37. end
  38.  
  39. function checkInv()
  40.   isFull = true
  41.  
  42.   for i=1,15 do
  43.     if turtle.getItemCount(i) == 0 then
  44.       isFull = false
  45.     end
  46.   end
  47.  
  48.   if isFull == true then
  49.     emptyInv()
  50.   end
  51. end
  52.  
  53. function checkFuel(count)
  54.   if turtle.getFuelLevel() <= count then
  55.     print("Error: Low fuel")
  56.     for i=1,15 do
  57.       turtle.select(i)
  58.       turtle.refuel()
  59.     end
  60.     turtle.select(1)
  61.   end
  62. end
  63.  
  64. function emptyInv()
  65.     turtle.select(16)
  66.     while not turtle.placeUp() do turtle.digUp() end
  67.     for i=1,15 do
  68.         turtle.select(i)
  69.         turtle.dropUp()
  70.     end
  71.     turtle.select(1)
  72. end
  73.  
  74. for q=1, depth do
  75. for x=1,(stripLength/2) do
  76.   turtle.turnLeft()
  77.   strip()
  78.   turtle.turnRight()
  79.  
  80.   while not turtle.forward() do turtle.dig() end
  81.     while turtle.detectUp() do
  82.       turtle.digUp()
  83.       sleep(0.2)
  84.   end
  85.   turtle.turnRight()
  86.  
  87.   strip()
  88.   turtle.turnLeft()
  89.   while not turtle.forward() do turtle.dig() end
  90.     while turtle.detectUp() do
  91.       turtle.digUp()
  92.       sleep(0.2)
  93.     end
  94.     while turtle.detectDown() do
  95.       turtle.digDown()
  96.     end
  97.   line = line + 1
  98. end
  99.  
  100. turtle.turnLeft()
  101. turtle.turnLeft()
  102. turtle.forward()
  103. for x=1,3 do
  104.     while not turtle.down() do turtle.digDown() end
  105. end
  106. turtle.turnRight()
  107. end
  108.  
  109. emptyInv()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement