Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkFuel()
- if ( turtle.getFuelLevel() < 10 ) then
- print("Fuel Level is less than 10, please place fuel in slot 1")
- while ( turtle.getFuelLevel() < 10 ) do
- if ( turtle.getItemCount(1) > 0 ) then
- turtle.refuel()
- end
- sleep(1)
- end
- print("Turtle Refuled, Fuel Level = " .. turtle.getFuelLevel())
- end
- end
- function invFull()
- full=true
- for i=1,16 do
- if ( turtle.getItemCount(i) == 0 ) then
- full=false
- end
- end
- return full
- end
- function placeTorch()
- turtle.turnRight()
- moveForward()
- turtle.turnRight()
- if ( not hasTorches() ) then
- print("No More Torches, Please replenish")
- while ( not hasTorches() ) do
- sleep(1)
- end
- end
- turtle.select(16)
- turtle.place()
- turtle.select(1)
- turtle.turnRight()
- moveForward()
- turtle.turnRight()
- end
- function hasTorches()
- if ( turtle.getItemCount(16) > 0 ) then
- return true
- else
- return false
- end
- end
- function checkInv()
- if ( invFull() ) then
- print("Inventory Full, Please Empty")
- while ( invFull() ) do
- sleep(1)
- end
- end
- end
- function moveUp()
- while ( not turtle.up() ) do
- turtle.digUp()
- checkInv()
- end
- end
- function moveDown()
- while ( not turtle.down() ) do
- turtle.digDown()
- checkInv()
- end
- end
- function moveForward()
- while ( not turtle.forward() ) do
- turtle.dig()
- checkInv()
- end
- end
- function digForward()
- while ( turtle.detect() ) do
- turtle.dig()
- checkInv()
- end
- end
- function rotate()
- for i=1,2 do
- turtle.turnLeft()
- end
- end
- function digLevel()
- turtle.turnLeft()
- digForward()
- rotate()
- digForward()
- turtle.turnLeft()
- end
- args={ ... }
- stairDepth=tonumber(args[1])
- checkFuel()
- moveForward()
- for i=1,stairDepth/2 do
- digLevel()
- for j=1,4 do
- moveUp()
- digLevel()
- checkFuel()
- end
- moveDown()
- moveForward()
- digLevel()
- if ( i%2 == 1 ) then
- placeTorch()
- end
- for j=1,4 do
- moveDown()
- digLevel()
- checkFuel()
- end
- moveForward()
- moveDown()
- end
Advertisement
Add Comment
Please, Sign In to add comment