Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Improvements to add:
- --Make sure the turtle has enough fuel and torches to do a run
- --Doesn't drop fuel in the chest
- local function prerunCheck()
- end
- local function storeAll()
- for i = 1,16 do
- turtle.select(i)
- turtle.drop()
- end
- end
- local function store()
- for i =1,16 do
- details = turtle.getItemDetail(i)
- if details.name ~= "minecraft:torch" then
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- local function home()
- lastPosX = movement.x
- lastPosY = movement.y
- lastPosZ = movement.z
- lastPhase = phase
- if phase == 3 then
- movement.gotoZXY(-length, 0, 1)
- movement.gotoZXY(0, 0, 0)
- else
- movement.gotoXZY(0, 0, 0)
- end
- movement.turnTo(0)
- store()
- if lastPhase == 3 then
- movement.gotoYZX(lastPosY, -length, lastPosX)
- movement.gotoYZX(lastPosY, lastPosZ, lastPosX)
- else
- movement.gotoYZX(lastPosY, lastPosZ, lastPosX)
- end
- end
- args = {...}
- torchSpace = 9
- phase = 1
- gap = 3
- if args[1] == nil then
- print("Usage: mineshaft (length)")
- return
- end
- length = tonumber(args[1])
- os.loadAPI("movement")
- os.loadAPI("util")
- turtle.select(1)
- movement.init()
- movement.up()
- local function digColumn()
- movement.digForward()
- turtle.digUp()
- turtle.digDown()
- if util.isFull() then
- home()
- end
- end
- for i = 1,length do
- digColumn()
- if i % torchSpace == 0 then
- util.select("torch")
- turtle.placeDown()
- turtle.select(1)
- end
- end
- phase = 2
- movement.turnLeft()
- for i = 0,gap do
- digColumn()
- end
- movement.turnLeft()
- util.select("torch")
- turtle.placeDown()
- phase = 3
- for i = 1,length do
- digColumn()
- if i % torchSpace == 0 then
- util.select("torch")
- turtle.placeDown()
- turtle.select(1)
- end
- end
- phase = 4
- movement.gotoXZY(0, 0, 0)
- movement.turnTo(0)
- storeAll()
- movement.turnTo(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement