Cwackers

Mine No Torch No Fuel

Mar 22nd, 2022 (edited)
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local args = {...}
  2.  
  3. local stripLength = 35
  4. local count = 0
  5. local line = 0
  6.  
  7. if not #args == 1 then
  8.   print("Usage: smine <mines>")
  9.   return
  10. end
  11.  
  12. function strip()
  13.   count = 0
  14.   for i=1,stripLength do
  15.     count = count + 1
  16.     checkInv()
  17.     while not turtle.forward() do turtle.dig() end
  18.     while turtle.detectUp() do
  19.       turtle.digUp()
  20.       sleep(0.2)
  21.     end
  22.     while turtle.detectDown() do
  23.       turtle.digDown()
  24.       sleep(0.2)
  25.     end
  26.   end
  27.  
  28.   turtle.turnLeft()
  29.   turtle.turnLeft()
  30.  
  31.   for i=1,stripLength do
  32.     while not turtle.forward() do turtle.dig() end
  33.   end
  34. end
  35.  
  36. function checkInv()
  37.   isFull = true
  38.  
  39.   for i=1,14 do
  40.     if turtle.getItemCount(i) == 0 then
  41.       isFull = false
  42.     end
  43.   end
  44.  
  45.   if isFull == true then
  46.     turtle.select(15)
  47.     while not turtle.placeDown() do turtle.digDown() end
  48.     for i=1,14 do
  49.       turtle.select(i)
  50.       turtle.dropDown()
  51.     end
  52.     turtle.select(15)
  53.     turtle.digDown()
  54.     sleep(0.2)
  55.     turtle.select(1)
  56.   end
  57. end
  58.  
  59. function emptyInv()
  60.     turtle.select(15)
  61.     while not turtle.placeDown() do turtle.digDown() end
  62.     for i=1,14 do
  63.         turtle.select(i)
  64.         turtle.dropDown()
  65.     end
  66.     turtle.select(15)
  67.     turtle.digDown()
  68.     sleep(0.2)
  69.     turtle.select(1)
  70. end
  71.  
  72. for x=1,args[1] do
  73.   turtle.turnLeft()
  74.   strip()
  75.   strip()
  76.   turtle.turnRight()
  77.   while not turtle.forward() do turtle.dig() end
  78.     while turtle.detectUp() do
  79.       turtle.digUp()
  80.       sleep(0.2)
  81.     end
  82.     while turtle.detectDown() do
  83.       turtle.digDown()
  84.     end
  85.   line = line + 1
  86. print("Mined " .. x .. ", " .. args[1]-x .. " left to go.")
  87. end
  88. emptyInv()
Advertisement
Add Comment
Please, Sign In to add comment