Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --http/pastebin get c7ZSrQxK Salle
- -- By ML Edwins copyright ML Team
- local TurtlePos = {x=nil,y=nil,z=nil}
- local SalleTaille = {x=nil,y=nil,z=nil, total=nil}
- function dig()
- while turtle.detect() do
- turtle.dig()
- os.sleep(0.5)
- end
- end
- function StartDig()
- for p = 1, Salle.y, 1 do
- for i = 1, SalleTaille.z, 1 do
- for o = 2, SalleTaille.x, 1 do
- dig()
- turtle.forward()
- end
- if i == SalleTaille.z then
- if turtle.detectUp() then turtle.digUp() end
- turtle.up()
- turtle.turnLeft()
- elseif i % 2 == 0 then
- turtle.turnRight()
- dig()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- dig()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- end
- end
- function ClaimCoal(CharbonNeeded)
- --write("Requete au serveur en cours...")
- --print("Error")
- --print("Serveur indisponible, veuillez ajouter le charbon manuellement")
- while turtle.getFuelLevel() < SalleTaille.total do
- local nbCharbon
- for i = 1, 16, 1 do
- nbCharbon = math.ceil((SalleTaille.total - turtle.getFuelLevel()) / 64)
- term.setCursorPos(1,6)
- if nbCharbon <= 0 then
- write("En attente de 0 Charbon...")
- break
- end
- write("En attente de "..nbCharbon.." Charbon...")
- turtle.select(i)
- turtle.refuel(nbCharbon)
- end
- if nbCharbon > 0 then os.sleep(10) end
- end
- print("Ok")
- os.sleep(1)
- end
- function CheckIfPossibleToBuild()
- SalleTaille.total = SalleTaille.x * SalleTaille.y * SalleTaille.z
- print("Vous allez extraire : "..SalleTaille.total.." cube")
- write("Verification des stocks...")
- if SalleTaille.total > turtle.getFuelLevel() then
- print("Error")
- local CharbonNeeded = math.ceil((SalleTaille.total - turtle.getFuelLevel()) / 64)
- ClaimCoal(CharbonNeeded)
- else
- print("Ok")
- end
- end
- function BuildSalleCubiqueTaille()
- term.clear()
- term.setCursorPos(1,1)
- print("Indiquez la longueur (x):")
- SalleTaille.x = read()
- term.clear()
- term.setCursorPos(1,1)
- print("Indiquez la hauteur (y):")
- SalleTaille.y = read()
- term.clear()
- term.setCursorPos(1,1)
- print("Indiquez la largeur (z):")
- SalleTaille.z = read()
- term.clear()
- term.setCursorPos(1,1)
- CheckIfPossibleToBuild()
- StartDig()
- end
- BuildSalleCubiqueTaille()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement