Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local escolha = nil
- local passos = 0
- local parou = false
- local asshat = require("libraries.asshat")
- function detectarChao()
- local isBlock, block = turtle.inspectDown()
- if (isBlock) then
- parou = true
- end
- end
- function detectarColisao()
- local isBlock, block = turtle.inspect()
- if (isBlock) then
- parou = true
- colocarBaixo()
- end
- end
- function andarFrente()
- if not turtle.forward() then
- turtle.select(1)
- turtle.refuel(1)
- turtle.forward()
- end
- passos = passos+1
- end
- function andarCima()
- if not turtle.up() then
- turtle.select(1)
- turtle.refuel(1)
- turtle.up()
- end
- passos = passos+1
- end
- function andarBaixo()
- if not turtle.down() then
- turtle.select(1)
- turtle.refuel(1)
- turtle.down()
- end
- passos = passos+1
- end
- function constroiCima()
- while not parou do
- colocarBaixo()
- andarCima()
- detectarColisao()
- andarFrente()
- detectarChao()
- detectarColisao()
- end
- end
- function constroiBaixo()
- while not parou do
- colocarBaixo()
- detectarColisao()
- andarFrente()
- andarBaixo()
- detectarChao()
- detectarColisao()
- end
- end
- function cavaBaixo()
- print ("Please input the number of steps.")
- local numDegraus = lerNumero()
- for i=0, numDegraus do
- turtle.dig()
- andarFrente()
- turtle.digUp()
- turtle.digDown()
- andarBaixo()
- turtle.digDown()
- end
- end
- function constroiQuarry()
- while(not(turtle.inspectDown())) do
- while(not(turtle.inspect())) do
- colocarBaixo()
- andarFrente()
- andarBaixo()
- end
- turtle.turnRight()
- end
- end
- function construirEscada()
- local funcoes =
- {
- [1] = constroiCima,
- [2] = constroiBaixo,
- [3] = constroiQuarry,
- [4] = cavaBaixo
- }
- local funcao = funcoes[escolha]
- funcao()
- end
- -- Main
- informacaoTitulo("S T A I R B U I L D E R")
- print("Put lots of coal in my 1st inventory slot and lots of blocks in my 2nd one.\n")
- print("Choose mode:")
- imprimirTabela({"Build up", "Build down", "Build spiral up", "Dig down"})
- escolha = pedeEscolha(4)
- construirEscada()
- agradece(passos)
Add Comment
Please, Sign In to add comment