Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- left = function()
- return turtle.turnLeft()
- end
- right = function()
- return turtle.turnRight()
- end
- up = function()
- return turtle.up()
- end
- down = function()
- return turtle.down()
- end
- back = function()
- return turtle.back()
- end
- go = function()
- return turtle.forward()
- end
- fuel = function()
- return turtle.getFuelLevel()
- end
- select = function(id)
- return turtle.select(id)
- end
- count = function(id)
- return turtle.getItemCount(id)
- end
- move = function(id, nb)
- return turtle.transferTo(id, nb)
- end
- --coucou coucou- -------------------------------------------
- function testFuel()
- if(fuel() < 100)then
- print('Plus de coco, test de refuel')
- j = 1
- if (count(j)>0) then
- select(j)
- end
- flagstop = false
- while(flagstop == false)do
- if(count(j)>0 and turtle.refuel(3)==true)then
- print('refuel 3, slot '..j)
- return true
- end
- if(j==16)then
- print('imposible de refuel, exit')
- return false
- end
- j=j+1
- if(count(j)>0) then
- select(j)
- end
- end
- end
- end
- function init()
- if(count(1)==0) then
- print('Besoin du block a couper en slot 1')
- return false
- end
- if(turtle.detectDown()==false)then
- print('Pas de coffre ?')
- return false
- end
- if(count(16)==0 and turtle.suck()==false) then
- print('Pas de slaping ?')
- return false
- end
- if(count(16)==0) then
- select(2)
- move(16, count(1))
- end
- if(count(16)<64) then
- print('Ya pas beaucoup de slapping :/')
- end
- if(testFuel()==false)then
- return false
- end
- return true
- end
- function testSlaping()
- if(count(16)==0)then
- print('plus de slaping')
- return false
- end
- if(turtle.detect()==false)then
- select(16)
- print('place un slaping')
- turtle.place()
- return true
- end
- end
- function videInv()
- for i=2,15 do
- select(i)
- turtle.dropDown()
- end
- end
- function coupeArbre(i)
- if(testFuel()==false)then
- print('coupeArbre false:testFuel')
- return false
- end
- flag=turtle.detectUp()
- if(flag==true) then
- --print('detectUp = true')
- turtle.digUp()
- up()
- sleep(1)
- i=i+1
- end
- if (flag==false) then
- --print('detectUp = false')
- while(i>0)do
- down()
- i=i-1
- end
- while(back() == false)do
- sleep(2)
- end
- select(16)
- turtle.place(1)
- --print('coupeArbre true')
- videInv()
- return true
- end
- return coupeArbre(i)
- end
- -- ---------------------------------------------------------
- stop=false
- if(init()==false) then
- stop=true
- end
- while(stop==false)do
- if(testSlaping() == false)then
- stop=true
- end
- select(1)
- if(turtle.compare()==true)then
- turtle.dig()
- go()
- if(coupeArbre(0)==false)then
- stop=true
- end
- end
- sleep(1)
- end
- print('End')
- if(fuel() == 0) then
- print('Ya plus de coco mon coco !')
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement