Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Susceptible d'être modifié à tout moment pour amélioration et/ou réparation.
- -- Dernière édition : 13/02/2013
- -- GESTION DES SLOTS :
- -- 1=sappling
- -- 5=fuel
- -- 2, 3, 4, 6, 7, 8, 13, 14, 15=cobblestone
- -- 9=cobblestone => stock sappling
- -- 10=stone => stock fuel
- -- 11=sand => pose sappling
- -- 12=grave => angle
- -- 16=yellow flower
- function detecteMarqueSol()
- marque = -1
- for i = 9, 12 do
- turtle.select(i)
- if(turtle.compareDown()) then
- marque = i
- end
- end
- return marque
- end
- function arret()
- j = 10
- for i = 1,j do
- k = j - i
- shell.run('clear')
- print("pause :"..k)
- sleep (1)
- shell.run('clear')
- end
- end
- -- Démarrage...
- -- GESTION DES SLOTS :
- -- 1=sappling
- -- 5=fuel
- -- 2, 3, 4, 6, 7, 8, 13, 14, 15=cobblestone
- -- 9=cobblestone => stock sappling
- -- 10=stone => stock fuel
- -- 11=sand => pose sappling
- -- 12=grave => angle
- -- 16=yellow flower
- i = 1
- turtle.select(16)
- while i <= 4 do
- if turtle.compare() then
- turtle.turnLeft()
- i = 5
- else
- turtle.turnRight()
- i = i + 1
- end
- end
- while true do
- marque = detecteMarqueSol()
- if(marque > 0) then
- if marque == 12 then -- grave >> angle
- if turtle.detect() then
- turtle.turnRight()
- end
- elseif marque == 11 then -- sand >> pose sappling
- turtle.turnLeft()
- if not turtle.detect() then
- turtle.select(1)
- turtle.place()
- end
- turtle.turnRight()
- elseif marque == 10 then -- stone >> stock coal
- if turtle.getFuelLevel() < 80 then
- turtle.turnLeft()
- turtle.select(5)
- fuel_avant = turtle.getItemCount(5)
- turtle.suck()
- fuel_apres = turtle.getItemCount(5)
- if fuel_avant == fuel_apres then
- print("Le coffre du charcoal est vide, remplisez le et valider avec ENTER")
- read()
- turtle.select(5)
- turtle.suck()
- end
- arret()
- if turtle.getItemCount(5) > 2 then
- turtle.drop(turtle.getItemCount(5) - 2)
- end
- turtle.refuel(1)
- turtle.turnRight()
- end
- elseif marque == 9 then -- cobblestone >> stock sappling
- if turtle.getItemCount(1) < 13 then
- turtle.turnLeft()
- turtle.select(1)
- sappling_avant = turtle.getItemCount(1)
- turtle.suck()
- sappling_apres = turtle.getItemCount(1)
- if sappling_avant == sappling_apres then
- print("Le coffre des sappling est vide, remplisez le et valider avec ENTER")
- read()
- turtle.suck()
- end
- arret()
- if turtle.getItemCount(1) > 13 then
- turtle.drop(turtle.getItemCount(1) - 13)
- end
- turtle.turnRight()
- end
- end
- end
- turtle.forward()
- end
- ----------------------------------------------------------------
- -- DEPLACEMENTS
- ----------------------------------------------------------------
- function g()
- turtle.turnLeft()
- end
- function d()
- turtle.turnRight()
- end
- function a()
- while turtle.detect() do
- turtle.dig()
- end
- moved = false
- while not(moved) do
- moved = turtle.forward()
- end
- end
- function h()
- turtle.digUp()
- moved = false
- while not(moved) do
- moved = turtle.up()
- end
- end
- function b()
- turtle.digDown()
- moved = false
- while not(moved) do
- moved = turtle.down()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment