Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Slot16: vitre
- -- Slot15: terre
- -- Slot14: planche
- -- Slot13: coffre
- -- Slot12: sappling
- -- Slot11: 1 bois
- -- Slot1: bois
- function repositionnement(lieu)
- if lieu == 3 then
- local coffre = false
- turtle.select(13)
- while coffre == false do
- turtle.turnRight()
- if turtle.compare() == true then
- coffre = true
- end
- end
- turtle.turnLeft()
- turtle.select(16)
- while turtle.compareDown() == true do
- turtle.forward()
- end
- elseif lieu == 1 then
- turtle.select(16)
- turtle.forward()
- if turtle.detect() == false then
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- elseif turtle.compareDown() == true then
- while turtle.compareDown() == true do
- turtle.forward()
- end
- end
- turtle.select(14)
- if turtle.compareDown() == true then
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(16)
- turtle.forward()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- end
- else
- turtle.select(16)
- turtle.forward()
- turtle.turnLeft()
- while turtle.compareDown() == false do
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- end
- function reperage()
- local lieu = 0
- turtle.select(16)
- if turtle.detectDown() == false then
- while turtle.detectUp() == true do
- turtle.digUp()
- turtle.up()
- end
- while turtle.down() == true do
- sleep(0)
- end
- end
- if turtle.compareDown() == false then
- turtle.select(15)
- if turtle.compareDown() == false then
- turtle.select(14)
- if turtle.compareDown() == false then
- print("Erreur position!!!")
- turtle.shutdown()
- else
- lieu = 3
- end
- else
- turtle.select(15)
- turtle.forward()
- if turtle.compareDown() == true then
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.up()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- lieu = 2
- end
- else
- lieu = 1
- end
- repositionnement(lieu)
- end
- function checkFuel()
- if turtle.getFuelLevel() < 10 then
- turtle.select(1)
- turtle.refuel()
- end
- if turtle.getFuelLevel() > 10 then
- sleep(0)
- else
- print("Manque de combustible!!!")
- turtle.shutdown()
- end
- end
- function echange()
- if turtle.getItemCount(12) == 0 then
- turtle.turnRight()
- turtle.select(12)
- turtle.suck()
- turtle.turnLeft()
- end
- if turtle.getItemCount(2) > 0 then
- turtle.turnLeft()
- turtle.select(2)
- turtle.drop()
- turtle.turnRight()
- end
- end
- function mouv()
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(16)
- turtle.forward()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- echange()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- end
- function coupe()
- turtle.select(12)
- turtle.place()
- turtle.select(11)
- while turtle.compare() == false do
- sleep(15)
- end
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- turtle.select(11)
- while turtle.compareUp() == true do
- turtle.select(1)
- turtle.digUp()
- turtle.up()
- checkFuel()
- end
- while turtle.down() == true do
- sleep(0)
- end
- mouv()
- end
- function fonctionnement()
- checkFuel()
- while true do
- coupe()
- end
- end
- reperage()
- fonctionnement()-- Slot16: vitre
- -- Slot15: terre
- -- Slot14: planche
- -- Slot13: coffre
- -- Slot12: sappling
- -- Slot11: 1 bois
- -- Slot1: bois
- function repositionnement(lieu)
- if lieu == 3 then
- local coffre = false
- turtle.select(13)
- while coffre == false do
- turtle.turnRight()
- if turtle.compare() == true then
- coffre = true
- end
- end
- turtle.turnLeft()
- turtle.select(16)
- while turtle.compareDown() == true do
- turtle.forward()
- end
- elseif lieu == 1 then
- turtle.select(16)
- turtle.forward()
- if turtle.detect() == false then
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- elseif turtle.compareDown() == true then
- while turtle.compareDown() == true do
- turtle.forward()
- end
- end
- turtle.select(14)
- if turtle.compareDown() == true then
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(16)
- turtle.forward()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- end
- else
- turtle.select(16)
- turtle.forward()
- turtle.turnLeft()
- while turtle.compareDown() == false do
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- end
- function reperage()
- local lieu = 0
- turtle.select(16)
- if turtle.detectDown() == false then
- while turtle.detectUp() == true do
- turtle.digUp()
- turtle.up()
- end
- while turtle.down() == true do
- sleep(0)
- end
- end
- if turtle.compareDown() == false then
- turtle.select(15)
- if turtle.compareDown() == false then
- turtle.select(14)
- if turtle.compareDown() == false then
- print("Erreur position!!!")
- turtle.shutdown()
- else
- lieu = 3
- end
- else
- turtle.select(15)
- turtle.forward()
- if turtle.compareDown() == true then
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.up()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- lieu = 2
- end
- else
- lieu = 1
- end
- repositionnement(lieu)
- end
- function checkFuel()
- if turtle.getFuelLevel() < 10 then
- turtle.select(1)
- turtle.refuel()
- end
- if turtle.getFuelLevel() > 10 then
- sleep(0)
- else
- print("Manque de combustible!!!")
- turtle.shutdown()
- end
- end
- function echange()
- if turtle.getItemCount(12) == 0 then
- turtle.turnRight()
- turtle.select(12)
- turtle.suck()
- turtle.turnLeft()
- end
- if turtle.getItemCount(2) > 0 then
- turtle.turnLeft()
- turtle.select(2)
- turtle.drop()
- turtle.turnRight()
- end
- end
- function mouv()
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(16)
- turtle.forward()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- echange()
- while turtle.compareDown() == true do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- end
- function coupe()
- turtle.select(12)
- turtle.place()
- turtle.select(11)
- while turtle.compare() == false do
- sleep(15)
- end
- turtle.select(1)
- turtle.dig()
- turtle.forward()
- turtle.select(11)
- while turtle.compareUp() == true do
- turtle.select(1)
- turtle.digUp()
- turtle.up()
- checkFuel()
- end
- while turtle.down() == true do
- sleep(0)
- end
- mouv()
- end
- function fonctionnement()
- checkFuel()
- while true do
- coupe()
- end
- end
- reperage()
- fonctionnement()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement