Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local paces = 0
- local facing = 0
- function backTrack()
- while (paces > -1) do
- refuel()
- turtle.back()
- paces = paces - 1
- end
- end
- function goTree()
- while (not turtle.detect()) do
- refuel()
- turtle.forward()
- paces = paces + 1
- end
- end
- local function comeDown()
- while (turtle.detectDown() == false)
- do
- turtle.down()
- end
- end
- function refuel()
- if turtle.getFuelLevel() < 5 then
- turtle.select(16)
- while (turtle.getItemCount(16) == 0)
- do
- print("Waiting for fuel..")
- sleep(2)
- end
- turtle.refuel(1)
- turtle.select(1)
- end
- end
- local function checkTree()
- turtle.dig()
- turtle.forward()
- if (turtle.detect()) then
- log2x2()
- else
- log1x1()
- end
- end
- function log1x1()
- turtle.select(1)
- while (turtle.compareUp()) do
- refuel()
- turtle.digUp()
- turtle.up()
- end
- end
- function log2x2()
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- if (turtle.detect()) then
- for chop = 0, 2, 1 do
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- while (turtle.compareUp()) do
- for chop = 0, 3, 1 do
- refuel()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- facing = facing + 1
- if (facing == 4) then
- facing = 0
- end
- end
- refuel()
- turtle.digUp()
- turtle.up()
- end
- else
- turtle.turnRight()
- turtle.turnRight()
- for chop = 0, 2, 1 do
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- end
- while (turtle.compareUp()) do
- for chop = 0, 3, 1 do
- refuel()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- facing = facing - 1
- if (facing == -1) then
- facing = 3
- end
- end
- refuel()
- turtle.digUp()
- turtle.up()
- end
- end
- end
- --[[Main Function]]--
- function main()
- refuel()
- goTree()
- checkTree()
- comeDown()
- backTrack()
- end
- --[[Program entry]]--
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement