Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Programme de Minage en tunnel sur le nombre de blocks voulu par RLP_Ghost
- -- http://pastebin.com/ZzEtVH3R
- local charbonSlot = 16
- local touchSlot = 15
- local idChannel = 123
- local niveauFuelMini = 5 -- niveau de déplacements auquel on doit refaire le plein de fuel
- local niveauCharbonMini = 5
- -- fonction refuel par cedmeu
- function verifFuel() -- vérifie si on a assez de fuel (déplacements) en réserve.
- -- 1 charbon = 96 deplacements
- -- On vérifie 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(1) -- on recharge pour 96 deplacements
- end
- end
- end
- function mineDevant()
- if turtle.detect() then turtle.dig() end
- end
- function mineHautBas()
- if turtle.detectUp() then turtle.digUp() end
- if turtle.detectDown() then turtle.digDown() end
- end
- --********************************************--
- --********** Programme principal *************--
- --********************************************--
- print("Entrez la dimensions du Tunnel à miner.")
- print("")
- print("Longueur : ")
- longueur = tonumber(read())
- modem = peripheral.wrap("left")
- modem.transmit(idChannel,idChannel,"etat:attente")
- print("Appuyez sur [ENTREE] pour commencer !")
- read()
- modem.transmit(idChannel,idChannel,"etat:encours")
- local l=1
- while l<=longueur do
- print("Profondeur Tunnel: "..l)
- modem.transmit(idChannel,idChannel,"prTunnel:"..l)
- mineDevant()
- verifFuel()
- turtle.forward()
- mineHautBas()
- l = l+1
- end
- -- Fin du tunnel , debut de retour
- modem.transmit(idChannel,idChannel,"etat:retour")
- turtle.turnRight()
- turtle.turnRight()
- -- demi-tour fait et revient
- turtle.select(touchSlot)
- turtle.placeDown()
- l=1
- local t=1
- while l<=longueur do
- verifFuel()
- mineDevant()
- turtle.forward()
- mineHautBas()
- l = l+1
- t = t+1
- if ( t > 8 ) then
- turtle.select(touchSlot)
- turtle.placeDown()
- t=0
- end
- end
- modem.transmit(idChannel,idChannel,"etat:fin")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement