Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs == 0 then
- print("Usage: <blocks> [torches y/n]")
- return
- end
- turtle.dig()
- if turtle.getFuelLevel() == 0 then
- print("The turtle must have at least some fuel to start with.")
- return
- elseif turtle.getFuelLevel() == "unlimited" then
- print("This turtle does not use fuel to move")
- return
- end
- --Number of blocks to mine
- local maxDistance = tArgs[1]
- --do to place torches slot 1
- local torch = "n"
- if #tArgs >= 2 then
- if turtle.getItemCount(1) < 1 then
- print("No Torches")
- return
- end
- torch = tArgs[2]
- end
- --local counter for how far the turtle has traveled
- local traveled = 0
- local tInt = 0
- --main function of digging
- function miner() -- mining
- while turtle.dig() do
- sleep(.2)
- end
- while turtle.digUp() do
- sleep(.2)
- end
- while turtle.digDown() do
- sleep(.2)
- end
- while turtle.dig() do
- sleep(.2)
- end
- end
- function pTorch()
- if torch == "y" then
- tInt = tInt + 1
- if tInt >= 8 then
- turtle.select(1)
- turtle.placeDown()
- tInt = 0
- end
- if turtle.getItemCount(1) < 1 then
- torch = "n"
- end
- end
- end
- --Attempt to travel to max distance for mining
- for i = 1, maxDistance do
- miner()
- traveled = traveled + 1
- pTorch()
- turtle.forward()
- end
- print("Traveled "..traveled.." Blocks")
Advertisement
Add Comment
Please, Sign In to add comment