Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- local togo = tonumber(tArgs[1])
- togo = togo or 1
- local sapling = 0
- term.clear()
- term.setCursorPos(1,1)
- -- print stuff... nothing to be honest...
- print(" *******************************")
- print(" * Treefarm By BlackApple *")
- print(" *******************************")
- print(" * How to start?? *")
- print(" * Put Coal in the right chest *")
- print(" * Put sapplings in the left *")
- print(" * *")
- print(" * Press [ENTER] when ready *")
- print(" *******************************")
- read(input)
- -- Fuel CHEST startup
- if turtle.getItemCount(16) < 10 then
- turtle.select(16)
- turtle.turnRight()
- turtle.drop()
- turtle.suck()
- turtle.drop(54)
- turtle.turnLeft()
- end
- sappling = 0
- if turtle.getItemCount(15) < 32 then
- turtle.select(15)
- turtle.turnLeft()
- turtle.drop()
- turtle.suck()
- turtle.turnRight()
- end
- -- Functions
- local function tfuel(amount)
- if turtle.getFuelLevel() < 16 then
- turtle.select(1)
- turtle.refuel(amount)
- end
- end
- local function tforward(steps) -- turtle takes x steps forward
- if steps==nil or steps==0 then steps=1 end
- tfuel(1)
- for i=1,steps do
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- end
- end
- end
- local function turnaround()
- turtle.turnRight()
- turtle.turnRight()
- end
- local function discard() -- drop off extra stuff into water
- if turtle.getItemCount(3)<1 then
- return
- end
- while not turtle.down() do
- turtle.digDown()
- end
- for i = 1,13 do
- if turtle.getItemCount(i)>0 then
- turtle.select(i)
- turtle.dropDown()
- end
- end
- while not turtle.up() do
- turtle.digUp()
- end
- turtle.select(16)
- end
- local function climb()
- if turtle.detect() then
- turtle.dig()
- tforward()
- local cnt=0
- repeat
- cnt = cnt + 1
- turtle.dig()
- sleep(0.5)
- turtle.digUp()
- tfuel(1)
- turtle.up()
- until not turtle.detect()
- turtle.turnRight()
- tforward()
- turtle.turnLeft()
- for i = 1,cnt do
- turtle.digDown()
- sleep(0.5)
- tfuel(1)
- turtle.down()
- turtle.dig()
- end
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- tforward()
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.turnLeft()
- tforward()
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.turnLeft()
- tforward()
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turnaround()
- tforward(2)
- else
- tforward(3)
- end
- discard()
- end
- -- Main Loop
- tforward(2) -- move into first position
- for r = 1,4 do
- for i = 1,4 do
- climb() -- climb and cut tree
- if i<4 then
- tforward(2)
- end
- end
- if r<4 then
- if r%2>0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- tforward(4+2*(r%2))
- if r%2>0 then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- end
- end
- turtle.turnRight()
- tforward(16) -- move back to base
- turtle.turnLeft()
- tforward(2)
- turnaround()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement