Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- colonnemax = 18
- colonne = 0
- ligne = 0
- recup = false
- DistParc = 0
- function placement()
- turtle.dig()
- turtle.digUp()
- turtle.select(1)
- turtle.placeUp()
- while turtle.suckUp() do
- lancement()
- end
- turtle.digUp()
- end
- function lancement()
- sleep(1)
- data = turtle.getItemDetail()
- if data then
- if data.name == "ComputerCraft:CC-Turtle" or data.name == "ComputerCraft:CC-TurtleExpanded" then
- turtle.place()
- peripheral.wrap("front").turnOn()
- while turtle.detect() do
- rednet.broadcast({ligne, colonne}, "position")
- end
- colonne = colonne + 1
- if colonne >= colonnemax then
- colonne = 0
- ligne = ligne + 1
- end
- end
- end
- end
- function mouvement(distance)
- turtle.digUp()
- while DistParc < distance do
- local success, data = turtle.inspect()
- if turtle.forward() then
- DistParc = DistParc + 1
- elseif data.name ~= "ComputerCraft:CC-Turtle" and data.name ~= "ComputerCraft:CC-TurtleExpanded" then
- turtle.dig()
- else
- turtle.attack()
- end
- sleep(0.5)
- end
- DistParc = 0
- end
- function loot()
- recup = false
- turtle.select(2)
- turtle.place()
- lootv = true
- while lootv do
- lootloop()
- end
- turtle.dig()
- end
- function lootloop()
- shell.run("clear")
- print("Recuperation (r)")
- print("Stop loot (any other key)")
- myTimer = os.startTimer(4)
- while true do
- event, par1 = os.pullEvent()
- if event == "timer" and par1 == myTimer then
- shell.run("clear")
- print("Loot continue attendez !")
- for i = 1, 10 do
- if not recup then
- rednet.broadcast("l")
- sleep(0.5)
- else
- while turtle.inspectUp() do
- if redstone.getInput("top") then
- turtle.digUp()
- end
- rednet.broadcast("l", "r")
- recupf()
- end
- turtle.select(1)
- turtle.dig()
- turtle.up()
- turtle.forward()
- turtle.forward()
- shell.run("clear")
- print("Vous pouvez retirer le master")
- sleep(240)
- end
- end
- break
- elseif event == "key" then
- print("You pressed "..keys.getName(par1).."!")
- if par1 == 19 then
- turtle.dig()
- turtle.forward()
- turtle.digDown()
- turtle.down()
- turtle.dig()
- turtle.forward()
- for i=3, 16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(1)
- turtle.place()
- recup = true
- else
- lootv = false
- end
- break
- end
- end
- end
- function recupf()
- turtle.select(1)
- turtle.suckUp()
- turtle.drop()
- turtle.suckUp()
- turtle.drop()
- turtle.suckUp()
- turtle.drop()
- end
- function config()
- print("Entrez la longueur max de chaque ligne")
- colonnemax = tonumber(io.read())
- end
- function menu()
- shell.run("clear")
- print("Menu")
- print("Placement (p)")
- print("Miner (m)")
- print("Loot (l)")
- print("Config (c)")
- input = io.read()
- if input == "p" then
- placement()
- elseif input == "m" then
- print("Distance")
- distance = tonumber(io.read())
- if type(distance) == "number" then
- while turtle.getFuelLevel() <= distance do
- print("You must add more fuel")
- sleep(5)
- turtle.select(3)
- turtle.refuel()
- end
- rednet.broadcast(distance, "m")
- mouvement(distance)
- end
- elseif input == "l" then
- loot()
- elseif input == "c" then
- config()
- else
- menu()
- end
- end
- while true do
- menu()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement