Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Code quarry--
- local long = 0 --Longuer de creuse--
- local larg = 0 --Largeur de creuse--
- local haut = 0 --Hauteur de creuse--
- local way = 0 --Gauche ou droite--
- local sens = 0
- --Mettre des coffres dans le slot n° 1--
- local slot16 = turtle.getItemCount(16) --Nombre d'items dans le slot 16--
- local function forwardM()
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.forward() then
- TF = TF - 1
- end
- if slot16 > 0 then
- turtle.select(2)
- turtle.digUp()
- turtle.placeUp()
- for slot = 5, 16 do
- turtle.select(slot)
- turtle.dropUp()
- sleep(1.5)
- end
- turtle.select(2)
- turtle.digUp()
- end
- until TF == 0
- TS = TS - 1
- end
- local function turn()
- if sens == 0 then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- sens = 1
- else
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- sens = 0
- end
- end
- local function recall()
- if way == 0 and sens == 1 then
- turtle.turnLeft()
- repeat
- turtle.forward()
- TSB = TSB - 1
- until TSB == 0
- turtle.turnRight()
- repeat
- turtle.forward()
- TB = TB - 1
- until TB == 0
- turtle.turnRight
- turtle.turnRight
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.Up()
- else if way == 0 and sens == 0 then
- turtle.turnRight()
- repeat
- turtle.forward()
- TSB = TSB - 1
- until TSB == 0
- turtle.turnLeft()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.Up()
- end
- end
- local function resetF()
- if TS ~= 0 then
- TF = long
- end
- end
- local function start()
- repeat
- repeat
- forwardM()
- turn()
- resetF()
- until TF == 0 and TS == 0
- recall()
- reset()
- until haut == 0 and TF == 0 and TS == 0
- end
- --Start--
- print("Entrez la longueur à creuser (en face de la turtle) :")
- input = io.read()
- long = tonumber(input)
- print("Entrez la largeur à creuser (à gauche/droite de la turtle) :")
- input2 = io.read()
- larg = tonumber(input2)
- print("Entrez la hauteur à creuser :")
- input3 = io.read()
- haut = tonumber(input3)
- print("Creuser vers la gauche ou vers la droite ?")
- print("0 = Gauche // 1 = Droite")
- input4 = io.read()
- way = tonumber(input4)
- TF = long
- TB = long
- TS = larg
- TSB = larg
- sens = way
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement