Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: stairdown <length>. Place 1 cobble in slot 16, then stacks in the remainder of the inventory and ensure turtle has sufficient fuel." )
- return
- end
- local depth = tonumber( tArgs[1] )
- if depth < 1 then
- print( "Stair depth must be positive" )
- return
- end
- local forward = 0
- local down = 0
- local slot = 1
- local function PlaceBlock()
- turtle.select(slot)
- for testSlot=1,15 do
- if turtle.compareTo(testSlot,16) then
- slot = testSlot
- return true
- end
- end
- if turtle.detectDown() then
- turtle.digDown()
- turtle.placeDown()
- else
- turtle.placeDown()
- end
- return true
- end
- local function MoveForward()
- turtle.forward()
- forward = forward + 1
- return true
- end
- local function MoveDown()
- turtle.down()
- down = down + 1
- return true
- end
- local function DigForward()
- if turtle.detect() then
- turtle.dig()
- MoveForward()
- else
- MoveForward()
- end
- return true
- end
- local function DigDown()
- if turtle.detectDown() then
- turtle.digDown()
- MoveDown()
- else
- MoveDown()
- end
- return true
- end
- local function StairDown()
- if turtle.detectDown() then
- turtle.digDown()
- MoveDown()
- PlaceBlock()
- else
- turtle.down()
- PlaceBlock()
- end
- return true
- end
- --[[ while turtle.detectDown() do
- if turtle.digDown() then
- MoveDown()
- sleep(0.5)
- else
- return false
- end
- end
- return true
- ]]
- print( "Making stairs..." )
- for n=1,depth do
- StairDown()
- DigForward()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement