Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refuel()
- if(turtle.getFuelLevel() < 10000) then
- for i = 4, 16 do
- turtle.select(i)
- if(turtle.compareTo(1)) then
- turtle.refuel()
- end
- end
- end
- turtle.select(1)
- end
- function dropOff()
- for i = 4, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- end
- function getSaplings()
- turtle.select(2)
- turtle.suckDown()
- dropOff()
- turtle.select(1)
- end
- local function goForward()
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- end
- end
- function detectTree()
- turtle.select(1)
- if turtle.compare() then
- return true
- else
- return false
- end
- end
- function turn(dir)
- if dir == "right" then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- end
- function turnForward(dir)
- turn(dir)
- forward(3)
- turn(dir)
- end
- function placeSapling(dir)
- turtle.select(2)
- if(turtle.getItemCount() > 1) then
- turtle.place()
- end
- turtle.select(1)
- turn(dir)
- end
- function chopTree(dir)
- turtle.select(1)
- turtle.dig()
- goForward()
- while turtle.compareUp() do
- turtle.digUp()
- turtle.up()
- end
- turtle.select(3)
- while not turtle.compareDown() do
- turtle.digDown()
- turtle.down()
- end
- turtle.select(1)
- while not turtle.back() do
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- placeSapling(dir)
- end
- function chopOrPlace(dir)
- if(detectTree()) then
- chopTree(dir)
- else
- placeSapling(dir)
- end
- end
- function forward(amount)
- for i = 1, amount do
- turtle.turnLeft()
- chopOrPlace("right")
- turtle.turnRight()
- chopOrPlace("left")
- if i ~= amount then
- goForward()
- end
- end
- end
- function placePath()
- while true do
- forward(15)
- for i = 1, 2 do
- turnForward("right")
- forward(14)
- turnForward("left")
- forward(14)
- end
- turnForward("right")
- forward(15)
- goForward()
- turtle.turnRight()
- for i = 1, 10 do
- goForward()
- end
- turtle.turnRight()
- goForward()
- refuel()
- getSaplings()
- end
- end
- placePath()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement