Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Simple shaft mining program by Xenogami
- -- If the inventory is full, put down a chest and empty inventory.
- local function dropStash()
- if turtle.getItemCount(16) > 0 then
- turtle.select(1)
- turtle.placeDown()
- for a=2,16 do
- turtle.select(a)
- turtle.dropDown()
- end
- turtle.select(1)
- end
- end
- -- Makes sure the turtle can move forward, else digs away obstacle.
- local function moveForward()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- -- Mines then check if inventory is full.
- local function mineTime()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- dropStash()
- end
- -- Turns right and move to start of next shaft.
- local function turnRight()
- turtle.turnRight()
- mineTime()
- moveForward()
- mineTime()
- moveForward()
- mineTime()
- moveForward()
- mineTime()
- turtle.turnRight()
- end
- -- Turns left and move to start of next shaft.
- local function turnLeft()
- turtle.turnLeft()
- mineTime()
- moveForward()
- mineTime()
- moveForward()
- mineTime()
- moveForward()
- mineTime()
- turtle.turnLeft()
- end
- -- Digs out a double length shaft with a space in the center for the return shaft.
- local function digShaft()
- for a=1,121 do
- mineTime()
- moveForward()
- end
- end
- -- Digs out the first and last shaft.
- local function shortShaft()
- for a=1,60 do
- mineTime()
- moveForward()
- end
- end
- -- Track what direction the turtle needs to turn.
- local function findFacing()
- if facing == 1 then
- turnRight()
- facing = 2
- else
- turnLeft()
- facing = 1
- end
- end
- -- Initializes tracking bit to control what direction to face when starting a new shaft.
- facing = 1
- moveForward()
- mineTime()
- turtle.turnLeft()
- shortShaft()
- for b=1,5 do
- findFacing()
- digShaft()
- end
- findFacing()
- shortShaft()
- mineTime()
- turtle.forward()
- if facing == 1 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- for b=1,20 do
- mineTime()
- moveForward()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement