Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- depth = 0
- write("Stairs = slot 1-3, Coal(or any fuel source) = slot 4-5, Torches = slot 6-7. ~ Now what is the depth of stairs you would fancy?: ")
- depth = read()
- depthNew = depth - 1
- stairAmount = depth * 3
- currentStair = turtle.getItemCount(1) + turtle.getItemCount(2) + turtle.getItemCount(3)
- ItemFuel = turtle.getItemCount(4) + turtle.getItemCount(5)
- local Fuel = 0
- local NeedFuel = 0
- torches = (depth / 6) * 2
- torch = 5
- straif = 0
- --Functions
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function goForward()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- end
- function goDown()
- while turtle.detectDown() do
- turtle.digDown()
- end
- turtle.down()
- end
- function goUp()
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.up()
- end
- function torchMe()
- torch1 = 0
- if turtle.getItemCount(6) > 0 then
- stair1 = 1
- elseif turtle.getItemCount(7) > 0 then
- stair1 = 2
- end
- if stair1 == 1 then
- turtle.select(6)
- turtle.place()
- elseif stair1 == 2 then
- turtle.select(7)
- turtle.place()
- end
- end
- function stairMe()
- stair1 = 0
- if turtle.getItemCount(1) > 0 then
- stair1 = 1
- elseif turtle.getItemCount(2) > 0 then
- stair1 = 2
- elseif turtle.getItemCount(3) > 0 then
- stair1 = 3
- end
- if stair1 == 1 then
- turtle.select(1)
- turtle.place()
- elseif stair1 == 2 then
- turtle.select(2)
- turtle.place()
- elseif stair1 == 3 then
- turtle.select(3)
- turtle.place()
- end
- end
- function mine()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function mineUp()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- function mineDown()
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- function trippleMine()
- goForward()
- while turtle.detectUp() or turtle.detectDown() do
- turtle.digUp()
- turtle.digDown()
- end
- end
- function check()
- if ItemFuel == 0 then
- print("No Fuel Items")
- else
- print("there is fuel")
- end
- repeat
- if turtle.getFuelLevel() == "unlimited" then
- print("NO NEED FOR FUEL")
- Needfuel = 0
- elseif turtle.getFuelLevel() < 100 then
- if turtle.getItemCount(4) > 0 then
- turtle.select(4)
- turtle.refuel(1)
- elseif turtle.getFuelLevel(5) > 0 then
- turtle.select(4)
- turtle.refuel(1)
- end
- Needfuel = 1
- ItemFuel = ItemFuel - 1
- elseif NeedFuel == 1 then
- Needfuel = 0
- end
- until NeedFuel == 0
- end
- function mineSides()
- turtle.turnLeft()
- mine()
- turnAround()
- mine()
- turtle.turnLeft()
- end
- --logical functions
- function wholeEnd()
- check()
- --1
- goUp()
- goForward()
- goUp()
- turtle.turnLeft()
- mine()
- turnAround()
- mine()
- --2
- goDown()
- mine()
- torchMe()
- turnAround()
- mine()
- torchMe()
- --3
- goDown()
- mine()
- turnAround()
- mine()
- --4
- goDown()
- mine()
- turnAround()
- mine()
- --5
- goDown()
- mine()
- turnAround()
- mine()
- goForward()
- turtle.turnRight()
- torch = 0
- end
- function stair()
- if straif == 0 then
- stairMe()
- turtle.turnRight()
- goForward()
- turtle.turnLeft()
- stairMe()
- turtle.turnRight()
- goForward()
- turtle.turnLeft()
- stairMe()
- goUp()
- goForward()
- straif = straif + 1
- elseif straif == 1 then
- stairMe()
- turtle.turnLeft()
- goForward()
- turtle.turnRight()
- stairMe()
- turtle.turnLeft()
- goForward()
- turtle.turnRight()
- stairMe()
- goUp()
- goForward()
- straif = 0
- end
- end
- function whole()
- check()
- if torch == 5 then
- --1
- goUp()
- turtle.turnLeft()
- mine()
- turnAround()
- mine()
- --2
- goDown()
- mine()
- torchMe()
- turnAround()
- mine()
- torchMe()
- --3
- goDown()
- mine()
- turnAround()
- mine()
- --4
- goDown()
- mine()
- turnAround()
- mine()
- --5
- goDown()
- mine()
- turnAround()
- mine()
- turtle.turnLeft()
- --6
- goUp()
- --7
- goUp()
- torch = 0
- elseif torch < 6 then
- --1
- goUp()
- turtle.turnLeft()
- mine()
- turnAround()
- mine()
- --2
- goDown()
- mine()
- turnAround()
- mine()
- --3
- goDown()
- mine()
- turnAround()
- mine()
- --4
- goDown()
- mine()
- turnAround()
- mine()
- --5
- goDown()
- mine()
- turnAround()
- mine()
- turtle.turnLeft()
- --6
- goUp()
- --7
- goUp()
- torch = torch + 1
- end
- end
- torchAmount = turtle.getItemCount(6) + turtle.getItemCount(7)
- if currentStair < stairAmount then
- print( "You will need "..stairAmount.." pieces of any kind of stairs in slot 1-3. Press Y once filled or Press N to continue with out stairs")
- while true do
- local _, char = os.pullEvent( "char" )
- if char:lower() == "n" then
- error()
- elseif char:lower() == "y" then
- break
- end
- end
- end
- if torchAmount == 0 then
- print("you will need around "..torches.." torches in slot 3. Press Y once filled or Press N to continue with out torches")
- while true do
- local _, char = os.pullEvent( "char" )
- if char:lower() == "n" then
- error()
- elseif char:lower() == "y" then
- break
- end
- end
- end
- --StartMain
- for i = 1,depthNew do
- check()
- whole()
- goForward()
- end
- for i = 1,1 do
- check()
- whole()
- end
- --EndMain
- --StartSecondary
- for i = 1,1 do
- check()
- wholeEnd()
- end
- --EndSecondary
- currentStair = turtle.getItemCount(1) + turtle.getItemCount(2) + turtle.getItemCount(3)
- --StartStairs
- if currentStair < stairAmount then
- print("Done!")
- else
- for i = 1,depth do
- stair()
- end
- print("Done!")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement