Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local res = {}
- local tool = require"import"
- local log = require"log"
- local t = turtle
- local sens = 0 -- 0 face aux logs, 1: regarde a droite, -1 regarde a gauche
- local slotMax = 14
- function res.ramasser()
- t.select(16)
- t.turnLeft()
- t.suck()
- tool.fd(slotMax )
- t.turnLeft()
- for i = 0,1 do --premiere descente
- t.suck()
- tool.fd(slotMax )
- end
- t.turnRight()
- t.suck()
- tool.fd(slotMax )
- t.turnRight()
- for i = 0,3 do --grosse remontée a gauche
- t.suck()
- tool.fd(slotMax )
- end
- t.turnRight()
- t.suck()
- tool.fd(slotMax )
- for i = 0,2 do
- t.suck()
- t.turnRight()
- t.suck()
- t.turnLeft()
- tool.fd(slotMax )
- end
- t.turnRight()
- t.suck()
- tool.fd(slotMax )
- for i = 0,2 do
- t.suck()
- t.turnRight()
- t.suck()
- t.turnLeft()
- tool.fd(slotMax )
- end
- t.turnRight()
- for i= 0,1 do
- t.suck()
- tool.fd(slotMax )
- end
- t.turnRight()
- t.suck()
- tool.fd(slotMax )
- t.select(1)
- tuple, name = t.inspectDown()
- if tuple then
- if not string.find(name['name'], "cobblestone") then
- error()
- end
- end
- end
- function res.planter()
- t.select(16)
- if t.getItemCount(16)==0 then
- error("plus de sappling")
- end
- t.place()
- t.select(1)
- end
- function res.tryLog()
- tuple, name = t.inspectDown()
- if tuple then
- if string.find(name['name'], "cobblestone") then
- if sens==1 then
- t.turnLeft()
- end
- if sens==-1 then
- t.turnRight()
- end
- if log.mineTree() then
- res.ramasser()
- res.planter()
- else
- res.planter()
- end
- if sens==-1 then
- t.turnLeft()
- end
- if sens==1 then
- t.turnRight()
- end
- if sens ==0 then
- sens =1
- t.turnRight()
- end
- return
- end
- end
- if sens ==0 then
- sens =1
- t.turnRight()
- end
- end
- function res.changeDir()
- tuple, name = t.inspect()
- if tuple then
- if string.find(name['name'], "torch") then
- t.turnLeft()
- t.turnLeft()
- sens = -sens
- sleep(180)
- end
- end
- end
- function res.farm()
- while true do
- res.tryLog()
- res.changeDir()
- tool.fd(slotMax )
- end
- end
- res.farm()
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement