Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function checkFuel()
- if turtle.getFuelLevel() < 1 then
- turtle.select(2)
- turtle.refuel(1)
- end
- end
- --
- local function Saplings()
- if turtle.getItemCount(1) > 3 then
- sleep(0)
- else
- print "Need at least 4 saplings in Slot 1"
- while turtle.getItemCount(1) < 4 do
- sleep(0)
- end
- end
- end
- --
- local function Start()
- turtle.dig()
- checkFuel()
- turtle.forward()
- end
- --
- local function FellUp()
- up = 0
- while turtle.detectUp() do
- turtle.digUp()
- turtle.dig()
- checkFuel()
- turtle.up()
- up = up + 1
- end
- end
- --
- local function Move()
- turtle.dig()
- checkFuel()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- --
- local function FellDown()
- while up > 0 do
- turtle.dig()
- turtle.digDown()
- checkFuel()
- turtle.down()
- up = up - 1
- end
- end
- --
- local function Plant() --That's a mess. Sorry :)
- turtle.dig()
- checkFuel()
- turtle.up()
- turtle.select(1)
- turtle.placeDown()
- checkFuel()
- turtle.forward()
- turtle.select(1)
- turtle.placeDown()
- turtle.turnLeft()
- checkFuel()
- turtle.forward()
- turtle.select(1)
- turtle.placeDown()
- turtle.turnLeft()
- checkFuel()
- turtle.forward()
- turtle.select(1)
- turtle.placeDown()
- checkFuel()
- turtle.forward()
- checkFuel()
- turtle.turnRight()
- turtle.down()
- end
- --
- local function Drop()
- for i = 2,16 do
- turtle.select(i)
- turtle.drop()
- end
- end
- -- Begin
- local function CheckTree()
- turtle.select(1)
- if turtle.compare() then
- Check = 0
- else
- Check = 1
- end
- end
- --
- local function Chop() -- Main function
- while Check == 1 do
- term.clear() term.setCursorPos(1,1) term.write("Tree detected...Chopping")
- Start()
- FellUp()
- Move()
- FellDown()
- Plant()
- Drop()
- turtle.turnRight()
- Check = 0
- end
- end
- --
- while true do
- Saplings()
- CheckTree()
- Chop()
- sleep(1)
- if Check == 0 then
- term.clear()
- term.setCursorPos(1,1)
- term.write("Waiting for Tree")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement