Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local temporisation = 300 --secondes åA0 attendre entre chaque ligne
- local niveauFuelMini = 100 -- niveau de dåA9placements auquel on doit refaire le plein de fuel
- local niveauCharbonMini = 11 -- quantitåA9 de charbons restants åA0 laquelle on doit refaire le plein de charbon
- local niveauSaplingMini = 10
- local saplingSlot = 1
- local premierSlot = 2 -- premier slot oåB9 se trouve le minerai ramassåA9
- local dernierSlot = 15 -- dernier slot åA0 surveiller pour enclencher le vidage de l'inventaire
- local charbonSlot = 16
- local direction = 0
- function verifFuel() -- våA9rifie si on a assez de fuel (dåA9placements) en råA9serve.
- -- 1 charbon = 96 deplacements
- -- On våA9rifie le niveau de fuel
- local niveauFuel = turtle.getFuelLevel()
- if (niveauFuel ~= "unlimited") then
- if (niveauFuel < niveauFuelMini) then
- -- On a besoin de faire le plein
- turtle.select(charbonSlot)
- turtle.refuel(5) -- on recharge
- -- et on våA9rifie si il nous reste assez de charbon
- if turtle.getItemCount(charbonSlot) < niveauCharbonMini then
- return rechargeCharbon() -- on refait le plein de charbon
- end
- end
- end
- end
- function rechargeSapling()
- --on se remet en direction "un", face au coffre
- while direction ~= 1 do
- turtle.turnRight()
- direction=direction+1
- if direction == 4 then direction = 0 end
- end
- turtle.select(saplingSlot)
- turtle.suck(20)
- --on se remet en direction "zåA9ro"
- while direction ~= 0 do
- turtle.turnRight()
- direction=direction+1
- if direction == 4 then direction = 0 end
- end
- if turtle.getItemCount(saplingSlot) < 6 then
- print("Merci de remettre des saplings !")
- print("Appuez sur ENTREE pour reprendre.")
- local a = read()
- end
- end
- function rechargeCharbon()
- --on prend du charbon dans le coffre au-dessus de la tortue
- turtle.select(charbonSlot)
- turtle.suckUp()
- if turtle.getItemCount(charbonSlot) < 6 then
- print("Merci de remettre du charbon !")
- print("Appuez sur ENTREE pour reprendre.")
- local a = read()
- end
- turtle.select(charbonSlot)
- turtle.refuel(5) -- on recharge
- end
- function videInventaire()
- --on se remet en direction "deux", face au coffre
- --while direction ~= 2 do
- -- turtle.turnRight()
- -- direction=direction+1
- -- if direction == 4 then direction = 0 end
- --end
- --on vide l'inventaire
- for slot=premierSlot,dernierSlot do
- turtle.select(slot)
- while turtle.getItemCount(slot) > 0 do
- turtle.drop(turtle.getItemCount(slot))
- if turtle.getItemCount(slot) > 0 then
- sleep(0.5)
- end
- end
- end
- --on se remet en direction "zåA9ro"
- --while direction ~= 0 do
- -- turtle.turnRight()
- -- direction=direction+1
- -- if direction == 4 then direction = 0 end
- --end
- end
- verifFuel()
- turtle.forward()
- while true do
- turtle.select(1)
- turtle.turnRight()
- if turtle.compare() == false then
- for i=1,8 do
- turtle.dig()
- if i ~= 8 then
- turtle.digUp()
- turtle.up()
- end
- end
- for i=1,7 do
- turtle.down()
- end
- turtle.suck()
- turtle.place()
- end
- turtle.turnLeft()
- for i=1, 3 do
- if turtle.forward() == false then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- verifFuel()
- --if turtle.getItemCount(dernierSlot) > 0 then
- videInventaire()
- --end
- if turtle.getItemCount(saplingSlot) < niveauSaplingMini then
- rechargeSapling()
- end
- sleep(temporisation)
- turtle.forward()
- break
- end
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement