Cwackers

Base new mine test

Mar 21st, 2022 (edited)
1,330
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.1)
  21.     end
  22.     while turtle.detectDown() do
  23.       turtle.digDown()
  24.       sleep(0.1)
  25.     end
  26.    
  27.     if line%8 == 0 then
  28.         if i%8 == 0 then
  29.          turtle.select(16)
  30.           while not turtle.forward() do turtle.dig() end
  31.           while turtle.detectDown() do
  32.          turtle.digDown()
  33.           sleep(0.1)
  34.           end
  35.       if not turtle.back() then
  36.         turtle.turnLeft()
  37.         turtle.turnLeft()
  38.         while not turtle.forward do turtle.dig() end
  39.         turtle.turnLeft()
  40.         turtle.turnLeft()
  41.       end
  42.       turtle.down()
  43.       if not turtle.detectDown() then
  44.          turtle.select(1)
  45.          turtle.placeDown()
  46.          turtle.select(16)
  47.       end
  48.       turtle.up()
  49.       turtle.placeDown()
  50.       turtle.select(1)
  51.     end
  52. end
  53.   end
  54.  
  55.   turtle.turnLeft()
  56.   turtle.turnLeft()
  57.  
  58.   for i=1,stripLength do
  59.     while not turtle.forward() do turtle.dig() end
  60.   end
  61. end
  62.  
  63. function checkInv()
  64.   isFull = true
  65.  
  66.   for i=1,14 do
  67.     if turtle.getItemCount(i) == 0 then
  68.       isFull = false
  69.     end
  70.   end
  71.  
  72.   if isFull == true then
  73.     turtle.select(15)
  74.     while not turtle.placeDown() do turtle.digDown() end
  75.     for i=1,14 do
  76.       turtle.select(i)
  77.       turtle.dropDown()
  78.     end
  79.     turtle.select(15)
  80.     turtle.digDown()
  81.     sleep(0.1)
  82.     turtle.select(1)
  83.   end
  84. end
  85.  
  86. function emptyInv()
  87.     turtle.select(15)
  88.     while not turtle.placeDown() do turtle.digDown() end
  89.     for i=1,14 do
  90.         turtle.select(i)
  91.         turtle.dropDown()
  92.     end
  93.     turtle.select(15)
  94.     turtle.digDown()
  95.     sleep(0.1)
  96.     turtle.select(1)
  97. end
  98.  
  99. for x=1,args[1] do
  100.   turtle.turnLeft()
  101.   strip()
  102.   strip()
  103.   turtle.turnRight()
  104.  if line%8 == 0 then
  105.       turtle.select(16)
  106.       turtle.placeDown()
  107.       turtle.select(1)
  108.   end
  109.   while not turtle.forward() do turtle.dig() end
  110.     while turtle.detectUp() do
  111.       turtle.digUp()
  112.       sleep(0.1)
  113.     end
  114.     while turtle.detectDown() do
  115.       turtle.digDown()
  116.     end
  117.   line = line + 1
  118. print("Mined " .. x .. ", " .. args[1]-x .. " left to go.")
  119. end
  120. emptyInv()
Advertisement
Add Comment
Please, Sign In to add comment