Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Done()
- print("Finished mining!")
- end
- function TurnBack()
- print("Turning back and going up...")
- turtle.turnRight()
- turtle.turnRight()
- if turtle.detectUp() then
- turtle.digUp()
- end
- while not turtle.up() do
- turtle.digUp()
- end
- end
- function DigLine(lineLength,lineHeight,layers)
- while CheckStorageFull() do
- DropItems()
- end
- print("Digging layer...")
- for e=1,lineHeight do
- for i=1,lineLength do
- while turtle.detect() do
- turtle.dig()
- end
- while not turtle.forward() do
- turtle.dig()
- end
- end
- TurnBack()
- end
- end
- function ResetHeight(height)
- print("Resetting height...")
- for i=1,height do
- turtle.down()
- end
- end
- function NextLine()
- print("Preparing for next layer...")
- turtle.turnLeft()
- if turtle.detect() then
- turtle.dig()
- end
- while not turtle.forward() do
- turtle.dig()
- end
- turtle.turnRight()
- end
- function CheckStorageFull()
- for i=2,16 do
- if turtle.getItemCount(i) > 0 then
- return true
- end
- return false
- end
- end
- function DropItems()
- for i=2,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- function Start()
- print("Miner started.")
- local area = RequestInput()
- for i=1,area[3] do
- DigLine(area[1],area[2], area[3])
- ResetHeight(area[2])
- NextLine()
- end
- Done()
- end
- function RequestInput()
- io.write("Enter length:")
- local length = io.read()
- io.write("Enter height:")
- local height = io.read()
- io.write("Enter how many rows should be mined:")
- local layers = io.read()
- local area = {tonumber(length),tonumber(height),tonumber(layers)}
- return area
- end
- Start()
Add Comment
Please, Sign In to add comment