Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Variables ---
- x = 0 -- Variable définitive longueur
- z = 0 -- Variable définitive largeur
- DirHori = -1 -- Orientation de la turtle horizontalement
- DirVert = -1 -- Orientation de la turtle verticalement
- x2 = 0 -- Variable dynamique sur la longueur
- z2 = 0 -- Variable dynamique sur la largeur
- enderchest = 1 -- Slot de l'enderchest
- slot = 16 -- Slots de la turtle
- --- Récupération des variables
- print("Quelle sera la longueur de votre trou ?")
- x = read()
- x = tonumber(x)
- x2 = x - 1
- print("Quelle sera la largeur de votre trou ?")
- z = read()
- z = tonumber(z)
- z2 = z - 1
- --- Refuel ---
- turtle.refuel(5)
- --- Fonctions ---
- function inventaire() -- Pose de l'enderchest quand l'inventaire est plein
- if turtle.getItemSpace(16)>0 then
- turtle.select(enderchest)
- turtle.place()
- while slot ~= 0 do
- turtle.drop()
- slot = slot - 1
- end
- turtle.dig()
- slot = 16
- end
- end
- function ligne() -- Forage d'une ligne (longueur en fonction de x)
- x2 = x
- while x2 ~= 0 do
- while turtle.detect() do
- turtle.dig()
- sleep(0.2)
- end
- turtle.forward()
- x2 = x2 - 1
- end
- end
- function fDirVert() -- Définition de l'orientation à prendre après le forage d'une couche
- if DirVert>0 then
- turtle.turnRight()
- turtle.digDown()
- turtle.down()
- elseif DirVert<0 then
- turtle.turnLeft()
- turtle.digDown()
- turtle.down()
- end
- end
- function fDirHori() -- Définition de l'orientation à choisir après le forage d'une ligne en fonction de la variable ori
- if DirHori>0 then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- elseif DirHori<0 then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- function fInvertDirHori() -- Choix de l'orientation horizontale. Inversion de la bascule.
- DirHori = DirHori * -1
- end
- function fInvertDirVert()
- DirVert = DirVert * -1
- end
- --- Programme ---
- while true do
- while z2 ~= 0 do
- ligne()
- fDirHori()
- fInvertDirHori()
- z2 = z2 - 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment