Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ScanAndDig()
- if turtle.compareUp() == true then
- DigAndMove("up")
- else
- return false
- end
- return true
- end
- function DigAndScan( psDirection )
- local iSleep=0.5
- if psDirection=="up" then
- while turtle.detectUp() do
- if not turtle.digUp() then return false end
- sleep(iSleep)
- end
- elseif psDirection=="down" then
- while turtle.detectDown() do
- if not turtle.digDown() then return false end
- sleep(iSleep)
- end
- else
- while turtle.detect() do
- if not turtle.dig() then return false end
- sleep(iSleep)
- end
- end
- return true
- end
- function DigAndMove(psDirection)
- local bExit=false
- local iSleep=0.5
- while bExit==false do
- if not DigAndScan(psDirection) then
- return false
- end
- if psDirection=="up" then
- if not turtle.up() then
- turtle.attackUp()
- sleep(iSleep)
- else
- bExit=true
- end
- elseif psDirection=="down" then
- if not turtle.down() then
- turtle.attackDown()
- sleep(iSleep)
- else
- bExit=true
- end
- else
- if not turtle.forward() then
- turtle.attack()
- sleep(iSleep)
- else
- bExit=true
- end
- end
- end
- return true
- end
- if turtle.detect() == false and turtle.detectUp() == false then
- print("No tree detected")
- print("Place turtle under or against tree")
- return false
- end
- if turtle.getItemCount(1) > 0 then
- turtle.select(1)
- turtle.dropUp()
- for q=2,16 do
- turtle.select(q)
- if turtle.getItemCount(q) == 0 then
- turtle.suckUp()
- break
- end
- end
- end
- turtle.select(1)
- local iLevel = 0
- if turtle.detect() == true then
- DigAndMove("forward")
- elseif turtle.detectUp() == true then
- DigAndMove("up")
- iLevel = iLevel + 1
- end
- while ScanAndDig() == true do
- iLevel = iLevel + 1
- end
- for q=(iLevel-1),0,-1 do
- DigAndMove("down")
- end
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement