Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function refuel()
- local fuelLevel = turtle.getFuelLevel()
- if fuelLevel == "unlimited" or fuelLevel > 0 then
- return
- end
- local function tryRefuel()
- for n=15,16 do
- if turtle.getItemCount(n) > 0 then
- turtle.select(n)
- if turtle.refuel(1) then
- turtle.select(1)
- return true
- end
- end
- end
- turtle.select(1)
- return false
- end
- if not tryRefuel() then
- print( "Add more fuel to continue." )
- while not tryRefuel() do
- sleep(1)
- end
- print( "Resuming." )
- end
- end
- local function tryUp()
- refuel()
- while not turtle.up() do
- if turtle.detectUp() then
- if not tryDigUp() then
- return false
- end
- elseif turtle.attackUp() then
- collect()
- else
- sleep( 0.5 )
- end
- end
- return true
- end
- local function tryDown()
- refuel()
- while not turtle.down() do
- if turtle.detectDown() then
- if not tryDigDown() then
- return false
- end
- elseif turtle.attackDown() then
- collect()
- else
- sleep( 0.5 )
- end
- end
- return true
- end
- local function tryForward()
- refuel()
- while not turtle.forward() do
- if turtle.detect() then
- if not tryDig() then
- return false
- end
- elseif turtle.attack() then
- collect()
- else
- sleep( 0.5 )
- end
- end
- return true
- end
- write("Wie breit ist der Baum? : ")
- bb=io.read()
- bb=bb+0
- write("Wie lange ist der Baum? : ")
- ll=io.read()
- ll=ll+0
- write("Wie hoch ist der Baum? : ")
- hh=io.read()
- hh=hh+0
- bb2=0
- ll2=ll
- hh2=hh
- hn = 0
- ln = 0
- bn=0
- while bb < bb2 do
- while ll > 0 do
- while hn < hh do
- tryUp()
- hn=hn+1
- end
- hn = 0
- tryForward()
- while hn < hh do
- tryDown()
- hn=hn+1
- end
- hn = 0
- tryForward()
- ll=ll-2
- end
- turtle.turnLeft()
- bb2=bb2+1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement