Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://pastebin.com/LkvtrNdR
- --pastebin run LkvtrNdR SuperMineur
- local nbFrontBloc=0
- local posFrontBloc=0
- local nbUpBloc=0
- local posUpBloc=0
- local toGround=false
- local countGoGround=""
- local nbRightBloc=0
- local posRightBloc=0
- local pairRight=0
- local side=1 --1 = turn to right 2= turn to left
- local consommable=""
- local input
- --Saisi du Nombre
- function saisieNombre()
- term.setCursorPos(1,9)
- input=read()
- input=tonumber(input)
- while type(input)==nil and input>=0 and input<=128 do
- term.setCursorPos(1,8)
- print("Nombre incorrect, recommencez.")
- term.setCursorPos(1,9)
- input=read()
- input=tonumber(input)
- end
- return input
- end
- --Fonction de minage
- function mining()
- while turtle.detectDown() do
- turtle.digDown()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- end
- function sortItems()
- local itemName=""
- for i=1,16 do
- turtle.select(i)
- if turtle.getItemDetail()~=nil then
- itemName=turtle.getItemDetail().name
- if itemName~="minecraft:coal" and itemName~="minecraft:iron_ore" and itemName~="minecraft:redstone" and itemName~="minecraft:lapis_lazuli" and itemName~="minecraft:diamond" and itemName~="minecraft:emerald" then
- turtle.dropDown()
- end
- end
- end
- turtle.select(1)
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Assurez vous que la turtle est placée au bloc le plus bas, le plus à gauche de votre session de minage.")
- term.setCursorPos(1,6)
- print("Combien voulez vous de blocs en face de la turtle? ")
- nbFrontBloc=saisieNombre()-1
- term.setCursorPos(1,8)
- print(" ")
- term.setCursorPos(1,6)
- print("Combien voulez vous de blocs à droite de la turtle? ")
- print("")
- nbRightBloc=saisieNombre()
- term.setCursorPos(1,8)
- print(" ")
- if nbRightBloc%2==0 then
- pairRight=1
- else
- pairRight=0
- end
- term.setCursorPos(1,6)
- print("Combien voulez vous de blocs au dessus de la turtle? (x3), (0= jusqu'au sol)")
- nbUpBloc=saisieNombre()
- term.setCursorPos(1,8)
- print(" ")
- if nbUpBloc==0 then
- nbUpBloc=85
- toGround=true
- countGoGround=0
- end
- consommable = (nbRightBloc * nbFrontBloc*(nbUpBloc*3))
- while consommable - turtle.getFuelLevel()>0 do
- local remain = consommable - turtle.getFuelLevel()
- print("Veuillez placer",(math.ceil(remain/80)),"Coal OU",(math.ceil(remain/1000)),"sceau de lave")
- detect=read()
- if turtle.getItemCount(1)>0 then
- turtle.refuel(turtle.getItemCount(1))
- end
- if toGround==true then
- consommable=-999999
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- print("In mining... ")
- turtle.digUp()
- turtle.up()
- turtle.digUp()
- --Y
- while posUpBloc<nbUpBloc do
- --Z
- while posRightBloc<nbRightBloc do
- --X
- while posFrontBloc<nbFrontBloc do
- mining()
- posFrontBloc=posFrontBloc+1
- end
- posRightBloc=posRightBloc+1
- posFrontBloc=0
- if side==1 then
- side=2
- turtle.turnRight()
- mining()
- turtle.turnRight()
- elseif side==2 then
- side=1
- turtle.turnLeft()
- mining()
- turtle.turnLeft()
- end
- sortItems()
- -----------------------------
- end
- posUpBloc=posUpBloc+1
- posRightBloc=0
- posFrontBloc=0
- if pairRight==1 then
- turtle.turnLeft()
- for i=1,nbRightBloc do
- turtle.forward()
- end
- turtle.turnRight()
- else
- turtle.turnRight()
- for i=1,nbRightBloc do
- turtle.forward()
- end
- turtle.turnLeft()
- for i=1,nbFrontBloc do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- side=1
- if posUpBloc<nbUpBloc then
- turtle.up()
- turtle.digUp()
- turtle.up()
- turtle.digUp()
- turtle.up()
- turtle.digUp()
- end
- end
- for i=1,nbUpBloc*3 do
- turtle.down()
- end
- term.setCursorPos(1,1)
- print("Mining finished. ")
Advertisement
Add Comment
Please, Sign In to add comment