Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function up()
- while not turtle.up() do
- turtle.digUp()
- end
- end
- function cutTree()
- while turtle.compare() do
- turtle.dig()
- up()
- end
- while not turtle.detectDown() do
- turtle.down()
- end
- end
- function search(dist)
- while dist > 0 do
- if turtle.compare() then
- cutTree()
- elseif not turtle.forward() then
- up()
- else
- dist = dist - 1
- while not turtle.detectDown() do
- turtle.down()
- end
- end
- end
- end
- local args = {...}
- if #args ~= 1 then
- print('Usage: lumberjack <size>')
- return
- end
- turtle.select(1)
- if turtle.getItemCount(1) == 0 then
- print('ERROR: Requires unrefined wood block in slot #1.')
- return
- end
- for n = 1, args[1], 1 do
- search(n)
- turtle.turnRight()
- search(n)
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement