Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 0.4
- -- strip mining
- local switch = false
- local runsToDo = 5
- local fuelPerRun = 65
- local fuelNeeded = runsToDo * fuelPerRun
- local fuelLevel = turtle.getFuelLevel()
- local torchesPerRun = 6
- local torchesNeeded = torchesPerRun * runsToDo
- local torchesInInv = turtle.getItemCount(16)
- local isGravel = false
- function digLine()
- compareGravel()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- end
- function compareGravel()
- turtle.select(15)
- isGravel = turtle.compare()
- print("Found gravel? " .. tostring(isGravel))
- if isGravel then dealWithGravel() end
- end
- function dealWithGravel()
- print("Dealing with gravel!")
- while isGravel do
- turtle.dig()
- compareGravel()
- end
- end
- function nextLineRight()
- turtle.turnRight()
- digLine()
- digLine()
- digLine()
- turtle.turnRight()
- end
- function nextLineLeft()
- turtle.turnLeft()
- digLine()
- digLine()
- digLine()
- turtle.turnLeft()
- end
- function fullRun()
- for i = 0, 19, 1 do
- digLine()
- if i == 3 or i == 11 or i == 18 then
- turtle.select(16)
- turtle.placeDown()
- turtle.select(1)
- end
- end
- end
- if fuelLevel < fuelNeeded then error("Not enough fuel!") end
- if torchesInInv < torchesNeeded then print("Will run out of torches!") end
- for i = 1, runsToDo, 1 do
- fullRun()
- if not switch then nextLineRight() else nextLineLeft() end
- switch = not switch
- fullRun()
- if not switch then nextLineRight() else nextLineLeft() end
- switch = not switch
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement