KnowThyParadox icon

SimpleSectorMining

KnowThyParadox | PRO | 11/08/13 01:49:45 AM UTC | 0 ⭐ | 228 👁️ | Never ⏰ | []
Lua |

1.24 KB

|

None

|

0 👍

/

0 👎

local sectorDimension = 5
local depth = 64
 
for layer = 1, depth do 
  for i = 1, sectorDimension do
    for j = 1, sectorDimension do
      if turtle.detectDown() then
        turtle.digDown()
      end
      if j < sectorDimension then
        turtle.forward()
      end
    end
  
    turtle.digDown()
  
    if i == sectorDimension then
      turtle.down()
      turtle.turnRight()
      turtle.turnRight()
  
    elseif i % 2 == 1 then
      turtle.turnRight()
      turtle.forward()
      turtle.turnRight()
  
    else
      turtle.turnLeft()
      turtle.forward()
      turtle.turnLeft()
    end
  end
  
  if layer % 2 == 0 then
    -- Check for inventory full
    local freeInvSpots = 16
    for spot = 1, 16 do
      if turtle.getItemCount( spot ) > 0 then
        freeInvSpots = freeInvSpots - 1
      end
    end
    if freeInvSpots < 4 then
      for depth = 1, layer do
        turtle.up()
      end
      
      turtle.turnLeft()
      for slot = 1, 16 do
         turtle.select( slot )
         turtle.drop( turtle.getItemCount( slot ) )
      end
      turtle.turnRight()
      for depth = 1, layer do
        turtle.down()
      end
    end
  end
end
 
for layer = 1, depth do
  turtle.up()
end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎