Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local encontrados = 0
- local counter = 0
- local passos = 0
- local estado = "Esperando"
- local tamanhoTronco = 6
- local tamanhoGalho = 5
- local tamanhoSegmento = tamanhoTronco+(tamanhoGalho*4)
- local asshat = require("libraries.asshat")
- local minerios = {"minecraft:gold_ore", "minecraft:diamond_ore", "minecraft:iron_ore"}
- if (procuraModem()) then
- protocolo = "teste"
- rednet.open("right")
- end
- function imprimirInformacao()
- printSync("Ores found: "..encontrados)
- printSync("Steps until dumping: "..20-counter)
- printSync("Blocks travelled: "..passos.."/"..tamanhoTotal)
- printSync("")
- printCor(estado, colors.lightBlue)
- imprimirCombustivel()
- end
- function andar()
- atualizarMonitor(imprimirInformacao)
- turtle.dig()
- if(turtle.forward()) then -- Proteรงรฃo contra gravel
- passos = passos+1
- else
- andar()
- end
- end
- function checarMinerio()
- if (block ~= nil) then
- if (existeEm(block["name"], minerios)) then
- encontrados = encontrados+1
- turtle.select(2)
- turtle.placeDown()
- end
- end
- end
- function minerar()
- local isBlock, block = turtle.inspect()
- checarMinerio()
- andar()
- local isBlock, block = turtle.inspectUp()
- checarMinerio()
- turtle.digUp()
- local isBlock, block = turtle.inspect()
- turtle.digDown()
- checarMinerio()
- if(counter >= 20) then
- counter = 0
- jogaLixoFora()
- else
- counter = counter+1
- end
- atualizarMonitor(imprimirInformacao)
- end
- -- MAIN
- informacaoTitulo("B R A N C H M I N E")
- writeSync("I will mine segments ")
- writeCor("6", colors.orange)
- writeSync(" blocks long with branches ")
- writeCor("10", colors.orange)
- writeSync(" blocks long.")
- writeCor(" How many segments should I mine?", colors.lightBlue)
- numSegmentos = lerNumero()
- tamanhoIda = tamanhoSegmento*numSegmentos
- tamanhoVolta = tamanhoTronco*numSegmentos
- tamanhoTotal = tamanhoIda+tamanhoVolta
- informacaoCombustivelNecessario(tamanhoTotal)
- turtle.select(1)
- turtle.refuel()
- for i=1, numSegmentos do
- -- Principal
- estado = "Digging - Main"
- for j=1, tamanhoTronco do
- minerar()
- end
- -- Esquerda
- turtle.turnLeft()
- estado = "Digging - Left"
- for j=1, tamanhoGalho do
- minerar()
- end
- turtle.turnRight()
- turtle.turnRight()
- estado = "Returning - Left"
- for j=1, tamanhoGalho do
- andar()
- end
- -- Direita
- estado = "Digging - Right"
- for j=1, tamanhoGalho do
- minerar()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- estado = "Returning - Right"
- for j=1, tamanhoGalho do
- andar()
- end
- -- Endireitando
- turtle.turnRight()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1, tamanhoVolta do
- estado = "Returning - Main"
- andar()
- atualizarMonitor(imprimirInformacao)
- end
- agradece(passos)
Add Comment
Please, Sign In to add comment