Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isBadBlock()
- if not(turtle.detect()) then
- return false
- end
- for slot=1,2,1 do
- turtle.select(slot)
- if turtle.compare() then
- return true
- end
- end
- return false
- end
- function isBadBlockDown()
- if not(turtle.detectDown()) then
- return false
- end
- for slot=1,2,1 do
- turtle.select(slot)
- if turtle.compareDown() then
- return true
- end
- end
- return false
- end
- function checkSides()
- turtle.turnRight()
- if isBadBlock() then
- turtle.dig()
- end
- turtle.turnLeft()
- if isBadBlock() then
- turtle.dig()
- end
- turtle.turnLeft()
- if isBadBlock() then
- turtle.dig()
- end
- turtle.turnRight()
- end
- function goForward()
- while not(turtle.forward()) do
- turtle.attack()
- end
- end
- function goDown()
- while not(turtle.down()) do
- turtle.attackDown()
- end
- end
- function goUp()
- while not(turtle.up()) do
- turtle.attackUp()
- end
- end
- function main()
- curHeight = 0
- while true do
- checkSides()
- while (not(turtle.detectDown()) or isBadBlockDown()) and (curHeight>-10) do
- turtle.digDown()
- goDown()
- curHeight = curHeight-1
- checkSides()
- end
- if not(turtle.detect()) or isBadBlock() then
- turtle.dig()
- goForward()
- else
- while turtle.detect() and not(isBadBlock()) do
- turtle.digUp()
- goUp()
- curHeight = curHeight+1
- end
- checkSides()
- goForward()
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement