Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- be careful of fuel lvl
- local args = {...}
- if #args < 2 then
- print("Usage: stripMine <number of strips> <depth per strip>")
- return
- end
- local strips = tonumber(args[1])
- local depth = tonumber(args[2])
- assert(loadfile("utils"))()
- assert(loadfile("movement"))()
- local blacklist = {
- "minecraft:cobblestone",
- "minecraft:dirt",
- "minecraft:stone",
- "ProjRed:Exploration:projectred.exporation.ore",
- "minecraft:gravel"
- }
- local items = {
- end_chest = "EnderStorage:enderChest"
- }
- local function selectiveMining(direction)
- direction = direction or "forward"
- local inspectionMethod
- local digMethod
- if direction == "forward" then
- inspectionMethod = turtle.inspect
- digMethod = turtle.dig
- elseif direction == "up" then
- inspectionMethod = turtle.inspectUp
- digMethod = turtle.digUp
- elseif direction == "down" then
- inspectionMethod = turtle.inspectDown
- digMethod = turtle.digDown
- else
- print("selectiveMining(direction): Expects direction to be one of: ['up', 'down','forward', nil]")
- return false
- end
- local success, data = inspectionMethod()
- if not success then
- return false
- end
- if inList(data.name, blacklist) then
- return false
- end
- digMethod()
- return true
- end
- local function deposit()
- local inventory = getInventory()
- if #inventory < 10 then
- return false
- end
- for k, v in pairs(inventory) do
- if v.name == items.end_chest then
- turtle.select(v.slot)
- turtle.placeUp()
- break
- end
- end
- for k, v in pairs(inventory) do
- if v.name ~= items.end_chest then
- turtle.select(v.slot)
- turtle.dropUp()
- end
- end
- turtle.digUp()
- end
- local function mineLocal()
- --Main section
- while turtle.dig() do end
- f()
- selectiveMining("down")
- while turtle.digUp() do end
- deposit()
- --Left wall
- l()
- selectiveMining()
- u()
- selectiveMining()
- r()
- selectiveMining("up")
- --Right wall
- r()
- selectiveMining()
- d()
- selectiveMining()
- l()
- end
- local function mineStrip(depth)
- for d = 1, depth do
- mineLocal()
- end
- end
- local function handleTurn(strip)
- local turnFunction = (strip % 2 == 1) and turtle.turnLeft or turtle.turnRight
- turnFunction()
- mineLocal()
- mineLocal()
- mineLocal()
- turnFunction()
- end
- local function mine(strips, depth)
- for strip = 1, strips do
- mineStrip(depth)
- handleTurn(strip)
- end
- end
- mine(strips, depth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement