Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- variables
- height = 0
- distFront = 0
- distRight = 0
- curDepth = 0
- -- Functions
- local function tMove(distance)
- for i=1,distance do
- while turtle.forward() == false do
- turtle.dig()
- turtle.attack()
- sleep(0.5)
- end
- end
- end
- local function tDescend(distance)
- for i=1,distance do
- while turtle.down() == false do
- turtle.digDown()
- turtle.attackDown()
- sleep(0.5)
- end
- end
- end
- local function tAscend(distance)
- for i=1,distance do
- while turtle.up() == false do
- turtle.digUp()
- turtle.attackUp()
- sleep(0.5)
- end
- end
- end
- local function turnaround()
- turtle.turnRight()
- turtle.turnRight()
- end
- local function checkInv()
- if turtle.getItemCount(16) > 0 do
- tAscend(curDepth)
- turtle.turnLeft()
- tMove(distRight)
- turtle.turnLeft()
- tMove(distFront)
- for i=1,16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.set(1)
- turnaround()
- tMove(distFront)
- turtle.turnRight()
- tMove(distRight)
- turtle.turnLeft()
- tDescend(curDepth)
- end
- end
- -- Startup
- term.clear()
- term.setCursorPos(1,1)
- print("Ready to mine shafts!")
- print()
- print()
- print("Choose forward offset:")
- distFront = read(input)
- print("Choose right offset:")
- distRight = read(input)
- print("Choose depth:")
- depth = read(input)
- --Main Loop
- tMove(distFront)
- turtle.turnRight()
- tMove(distRight)
- turtle.turnLeft()
- for i=0,depth do
- checkInv()
- tDescend(1)
- curDepth = curDepth + 1
- end
- tAscend(depth)
- turtle.turnLeft()
- tMove(distRight)
- turtle.turnLeft()
- tMove(distFront)
- for i=1,16 do
- turtle.set(i)
- turtle.drop()
- end
- turtle.select(1)
- turnaround()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement