Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get kRkVtY4d startup
- -- -------------------------------------------
- -- one tree -Sinkir-
- -- Version 2.0 (2014/10/29)
- -- SCANER FUNCTION :
- -- slot 16 ender chest Fuel +-+-+-+-+
- -- slot 15 ender chest BoneMeal | | | | |
- -- slot 14 BoneMeal | | | | |
- -- slot 13 Saplings | | | | |
- -- |S|b|B|F|
- -- +-+-+-+-+
- -- -------------------------------------------
- -- _____
- -- | ___| _ _ __ ___
- -- | |_ | | | | '_ \ / __|
- -- | _|| |_| | | | | (__
- -- |_| \__,_|_| |_|\___|
- --
- function testFuel()
- if(fuel() < 32)then
- if(count(16) == 0)then
- print("slot 16 empty")
- sleep(20)
- os.reboot()
- end
- print('Plus de coco, test de refuel')
- while(turtle.detectUp())do
- turtle.digUp()
- sleep(1)
- end
- select(16)
- turtle.placeUp()
- sleep(1)
- --print('Placed, sucking..')
- if(turtle.suckUp() == false)then
- turtle.digUp()
- print("Suck fuel false")
- sleep(20)
- os.reboot()
- end
- turtle.refuel()
- sleep(0.2)
- turtle.digUp()
- end
- return true
- end
- function testBoneMeal()
- if(count(14) < 6)then
- if(count(15) == 0)then
- print("slot 15 empty")
- --sleep(20)
- --os.reboot()
- return false
- end
- select(1)
- while(turtle.detectUp())do
- turtle.digUp()
- sleep(1)
- end
- select(15)
- turtle.placeUp()
- sleep(1)
- select(14)
- --print('Placed, sucking..')
- if(turtle.suckUp(turtle.getItemSpace(14)) == false)then
- turtle.digUp()
- print("Suck BoneMeal false")
- sleep(20)
- os.reboot()
- end
- select(15)
- turtle.digUp()
- end
- return true
- end
- left = function()
- if(turtle.turnLeft()==false)then
- sleep(1)
- left()
- else
- return true
- end
- end
- right = function()
- if(turtle.turnRight()==false)then
- sleep(1)
- right()
- else
- return true
- end
- end
- count = function(id)
- return turtle.getItemCount(id)
- end
- back = function()
- return turtle.back()
- end
- go = function()
- return turtle.forward()
- end
- select = function(id)
- return turtle.select(id)
- end
- fuel = function()
- return turtle.getFuelLevel()
- end
- move = function(id, nb)
- return turtle.transferTo(id, nb)
- end
- --
- --
- --
- --
- function videInv()
- for i=1,12 do
- if(count(i)>0)then
- select(i)
- if(turtle.compareTo(14) == true)then
- if(count(16) < 64) then
- turtle.transferTo(16, turtle.getItemSpace(16))
- end
- end
- if(turtle.compareTo(13) == true)then
- if(count(16) < 64) then
- turtle.transferTo(16, turtle.getItemSpace(16))
- end
- end
- turtle.dropDown()
- end
- end
- return true
- end
- function lost()
- print("je suis perdu :/")
- for i=1,12 do
- if(turtle.detectUp())then
- turtle.digUp()
- turtle.up()
- end
- end
- while turtle.detectDown() == false do
- turtle.down()
- sleep(0.2)
- end
- turtle.back()
- if(turtle.detectDown() == false)then
- turtle.forward()
- turtle.left()
- turtle.back()
- end
- if(turtle.detectDown() == false)then
- turtle.forward()
- turtle.left()
- turtle.back()
- end
- if(turtle.detectDown() == false)then
- turtle.forward()
- turtle.left()
- turtle.back()
- end
- if(turtle.detectDown() == false)then
- print("i'm lost exit")
- shell.exit()
- end
- end
- function init()
- if(count(16) == 0)then
- print("No ender chest for fuel in slot 16.., exit")
- return false
- end
- if(count(15) == 0)then
- print("No ender chest for BoneMeal in slot 15")
- end
- if(count(14) == 0)then
- print("No BoneMeal in slot 14")
- end
- if(count(13) == 0)then
- print("No Saplings in slot 13, exit")
- return false
- end
- testFuel()
- testBoneMeal()
- select(1)
- if(turtle.detectDown() == false)then
- lost()
- elseif(turtle.detectDown()and turtle.detectUp())then
- lost()
- end
- return true
- end
- function tree()
- select(1)
- turtle.dig()
- turtle.forward()
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.2)
- turtle.up()
- sleep(0.5)
- turtle.dig()
- left()
- turtle.dig()
- left()
- turtle.dig()
- left()
- turtle.dig()
- left()
- end
- while turtle.detectDown() == false do
- turtle.down()
- while turtle.suckDown() do
- sleep(0.5)
- end
- sleep(0.2)
- end
- turtle.back()
- while turtle.suck() do
- sleep(0.5)
- end
- end
- -- __ __ _ ____
- -- | \/ | __ _(_)_ __ / /\ \
- -- | |\/| |/ _` | | '_ \| | | |
- -- | | | | (_| | | | | | | | |
- -- |_| |_|\__,_|_|_| |_| | | |
- -- \_\/_/
- stop=false
- if(init()==false) then
- stop=true
- end
- i = 0
- stopCounter = 1
- while(stop==false)do
- if(turtle.detect())then
- if(count(14) > 1)then
- turtle.select(14)
- for i=0, 5 do
- turtle.place()
- end
- end
- tree()
- else
- turtle.select(13)
- turtle.place()
- end
- videInv()
- testFuel()
- testBoneMeal()
- sleep(0.2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement