Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function camina(bloques, direccionCamina)
- if direccionCamina == "adelante" then
- for i = 1, bloques do
- hayBloque = turtle.detect()
- while hayBloque do
- turtle.dig()
- sleep(0.5)
- hayBloque = turtle.detect()
- end
- turtle.forward()
- end
- elseif direccionCamina == "arriba" then
- for i = 1, bloques do
- hayBloque = turtle.detectUp()
- while hayBloque do
- turtle.digUp()
- sleep(0.5)
- hayBloque = turtle.detectUp()
- end
- turtle.up()
- end
- elseif direccionCamina == "atras" then
- for i = 1, bloques do
- if not turtle.back() then
- mediaVuelta("izquierda")
- hayBloque = turtle.detect()
- while hayBloque do
- turtle.dig()
- sleep(0.5)
- hayBloque = turtle.detect()
- end
- mediaVuelta("derecha")
- end
- turtle.back()
- end
- elseif direccionCamina == "abajo" then
- for i = 1, bloques do
- hayBloque = turtle.detectDown()
- while hayBloque do
- turtle.digDown()
- sleep(0.5)
- hayBloque = turtle.detectDown()
- end
- turtle.down()
- end
- end
- end
- function escarba(direccionEscarba)
- if direccionEscarba == "adelante" then
- hayBloque = turtle.detect()
- while hayBloque do
- turtle.dig()
- sleep(0.5)
- hayBloque = turtle.detect()
- end
- elseif direccionEscarba == "arriba" then
- hayBloque = turtle.detectUp()
- while hayBloque do
- turtle.digUp()
- sleep(0.5)
- hayBloque = turtle.detectUp()
- end
- elseif direccionEscarba == "abajo" then
- hayBloque = turtle.detectDown()
- while hayBloque do
- turtle.digDown()
- sleep(0.5)
- hayBloque = turtle.detectDown()
- end
- end
- end
- function mediaVuelta (direccionMV)
- if direccionMV == "derecha" then
- for i = 1, 2 do
- turtle.turnRight()
- end
- elseif direccionMV == "izquierda" then
- for i = 1, 2 do
- turtle.turnLeft()
- end
- end
- end
- function giro (direccionGiro)
- if direccionGiro == "derecha" then
- turtle.turnRight()
- elseif direccionGiro == "izquierda" then
- turtle.turnLeft()
- end
- end
- function coloca(direccionColoca, slot)
- turtle.select(slot)
- if direccionColoca == "adelante" then
- b = turtle.detect()
- while b do
- turtle.dig()
- b = turtle.detect()
- end
- turtle.place()
- end
- if direccionColoca == "arriba" then
- b = turtle.detectUp()
- while b do
- turtle.digUp()
- b = turtle.detectUp()
- end
- turtle.placeUp()
- end
- if direccionColoca == "abajo" then
- b = turtle.detectDown()
- while b do
- turtle.digDown()
- b = turtle.detectDown()
- end
- turtle.placeDown()
- end
- turtle.select(1)
- end
- function depocita(Slot)
- turtle.select(Slot)
- mediaVuelta("izquierda")
- coloca("adelante", Slot)
- for i = 1, 12 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.select(Slot)
- escarba("adelante")
- giro("izquierda")
- turtle.select(1)
- end
- function puerta(tipo, SlotBasura)
- if tipo == "2x1" then
- camina(1, "adelante")
- escarba("arriba")
- escarba("abajo")
- camina(1, "adelante")
- escarba("arriba")
- camina(1, "abajo")
- giro("izquierda")
- camina(1, "adelante")
- camina(3, "arriba")
- mediaVuelta("izquierda")
- camina(2, "adelante")
- camina(3, "abajo")
- mediaVuelta("derecha")
- camina(1, "adelante")
- depocita(SlotBasura)
- elseif tipo == "3x3" then
- camina(1, "adelante")
- escarba("arriba")
- camina(1, "abajo")
- giro("izquierda")
- camina(1, "adelante")
- camina(3, "arriba")
- mediaVuelta("izquierda")
- camina(2, "adelante")
- camina(3, "abajo")
- mediaVuelta("derecha")
- camina(1, "adelante")
- depocita(SlotBasura)
- camina(1, "adelante")
- escarba("arriba")
- giro("izquierda")
- camina(1, "adelante")
- escarba("adelante")
- for i = 1, 4 do
- camina(1, "arriba")
- escarba("adelante")
- end
- mediaVuelta("izquierda")
- camina(1, "abajo")
- for i = 1, 3 do
- camina(1, "adelante")
- escarba("arriba")
- escarba("abajo")
- end
- camina(3, "abajo")
- mediaVuelta("izquierda")
- camina(1, "adelante")
- escarba("arriba")
- camina(1, "adelante")
- depocita(SlotBasura)
- end
- end
- function salon(profundidad, ancho, alto, slotBasura)
- local hacia
- for i = 1, profundidad do
- camina(1, "adelante")
- giro("izquierda")
- camina(tonumber(ancho/2), "adelante")
- mediaVuelta("derecha")
- hacia = "arriba"
- for i = 1, ancho-1 do
- camina(alto-1, hacia)
- camina(1, "adelante")
- if hacia == "arriba" then
- hacia = "abajo"
- elseif hacia == "abajo" then
- hacia = "arriba"
- end
- end
- if hacia == "arriba" then
- camina(alto-2, "arriba")
- escarba("arriba")
- camina(alto-2, "abajo")
- mediaVuelta("derecha")
- camina(tonumber(ancho/2), "adelante")
- depocita(slotBasura)
- elseif hacia == "abajo" then
- camina(alto-1, "abajo")
- mediaVuelta("derecha")
- camina(tonumber(ancho/2), "adelante")
- depocita(slotBasura)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment