Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local res = {}
- local slot = 15
- local h=0
- function res.mineTree()
- if analyse(0) then
- turtle.dig()
- needR()
- turtle.forward()
- digUp()
- goDown()
- return true
- end
- return false
- end
- function needR()
- if turtle.getFuelLevel()==0 then
- while not turtle.refuel(1) do
- turtle.select(turtle.getSelectedSlot()+1%15)
- end
- end
- end
- function digUp()
- while analyse(1) do
- turtle.digUp()
- needR()
- turtle.up()
- h = h+1
- end
- end
- function goDown()
- for i=0,h do
- needR()
- turtle.down()
- end
- end
- function analyse(w)
- if w == 0 then
- t, tuple = turtle.inspect()
- else
- t, tuple = turtle.inspectUp()
- end
- if t then
- name = tuple['name']
- if string.find(name, 'log') then
- return true
- end
- end
- return false
- end
- --t.mineTree()
- return res
Add Comment
Please, Sign In to add comment