Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local taille = 64
- local check = false
- local x = 0
- local y = 0
- local z = 0
- local slot = 0
- function checkpos()
- turtle.select(16)
- check = false
- if turtle.compareDown() == true then
- while check == false do
- if turtle.compare() == true then
- check = true
- print("Demarrage en cours...")
- return true
- else
- turtle.turnRight()
- end
- end
- else
- print("Erreur de placement!!!")
- return false
- end
- end
- function checkreserve(niveau)
- if niveau <= 5 then
- turtle.refuel(1)
- end
- end
- function checkitem()
- if turtle.getItemCount(15) >= 1 then
- return false
- else
- return true
- end
- end
- function coffre()
- slot = 1
- while slot <= 15 do
- turtle.select(slot)
- if turtle.getItemCount(slot) > 0 then
- if turtle.drop() == true then
- turtle.drop()
- else
- print("Depot plein")
- turtle.shutdown()
- end
- end
- slot = slot + 1
- end
- turtle.select(1)
- turtle.suckDown()
- if turtle.getItemCount(1) >= 20 then
- print("Depot effectue.")
- else
- print("Manque de combustible!!!")
- turtle.shutdown()
- end
- end
- function positionnement()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- end
- function retour(i, j, k)
- while k > 0 do
- turtle.up()
- k = k - 1
- checkreserve(turtle.getFuelLevel())
- end
- turtle.turnRight()
- while i > 0 do
- turtle.forward()
- i = i - 1
- checkreserve(turtle.getFuelLevel())
- end
- turtle.turnLeft()
- while j >= 0 do
- turtle.forward()
- j = j - 1
- checkreserve(turtle.getFuelLevel())
- end
- end
- function fonctionnement(i, j, k, x, y)
- k = 0
- while j > 0 do
- turtle.dig()
- turtle.forward()
- j = j - 1
- checkreserve(turtle.getFuelLevel())
- if checkitem() == false then
- retour(x, y, k)
- return false
- end
- end
- turtle.turnRight()
- while i > 0 do
- turtle.dig()
- turtle.forward()
- i = i - 1
- checkreserve(turtle.getFuelLevel())
- if checkitem() == false then
- retour(x, y, k)
- return false
- end
- end
- turtle.turnRight()
- turtle.digDown()
- while turtle.down() == true do
- turtle.digDown()
- k = k + 1
- checkreserve(turtle.getFuelLevel())
- if checkitem() == false then
- retour(x, y, k)
- return false
- end
- end
- retour(x, y, k)
- return true
- end
- turtle.refuel(1)
- while x < taille do
- while y < taille do
- if checkpos() == true then
- coffre()
- positionnement()
- if fonctionnement(x, y, z, x, y) == true then
- y = y + 1
- end
- else
- print("Arrêt imprevu de la quarry")
- turtle.shutdown()
- end
- end
- y = 0
- x = x + 1
- end
- print("Fin normale du travail de la quarry")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement