Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 3 then
- print( "Uso: minedown <largo> <ancho> <prof.>" )
- return
- end
- local largo = tonumber( tArgs[1] ) - 2
- local ancho = tonumber( tArgs[2] ) - 1
- local profundidad = tonumber( tArgs[3] ) - 1
- local pos = 1
- local count = 0
- local slots = 0
- function checkFuel()
- print("Combustible actual:" .. turtle.getFuelLevel() .. " ")
- if turtle.getFuelLevel() < 20 then
- turtle.select(1)
- turtle.refuel(1)
- print("Repostando...")
- else
- print("tuturu")
- end
- end
- function start()
- checkFuel()
- turtle.digDown()
- turtle.down()
- end
- function forward()
- checkFuel()
- while turtle.forward() == false do
- turtle.dig()
- turtle.attack()
- sleep(0.25)
- end
- end
- function back()
- while turtle.back() == false do
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- sleep(0.25)
- end
- end
- function up()
- while turtle.up() == false do
- turtle.digUp()
- turtle.attack()
- sleep(0.25)
- end
- end
- function down()
- while turtle.down() == false do
- turtle.digDown()
- turtle.attack()
- sleep(0.25)
- end
- end
- function avanzar()
- for i=0,largo do
- turtle.dig()
- forward()
- end
- end
- function torcer()
- if count == ancho + 1 then
- count = 0
- else
- if pos == 1 then
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- pos = 0
- else
- turtle.turnRight()
- forward()
- turtle.turnRight()
- pos = 1
- end
- end
- end
- function vuelta()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function comprobarSlots()
- slots = 0
- for i=1,16 do
- if turtle.getItemCount(i) ~= 0 then
- slots = slots + 1
- end
- end
- end
- function tirarItems()
- comprobarSlots()
- if slots == 16 then
- for i=1,16 do
- for k, v in pairs(turtle.getItemDetail(i)) do
- if k == "name" and v == "minecraft:cobblestone" or v == "minecraft:dirt" or v == "BigReactors:YelloriteOre" or v == "ThermalFoundation:Ore" or v == "minecraft:redstone" or v == "minecraft:dye" or v == "Forestry:apatite" or v == "minecraft:gravel" or v == "chisel:limestone" or v == "chisel:diorite" or v == "chisel:granite" then
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- end
- end
- ---------------------
- start()
- for i=0,profundidad do
- for i=0,ancho do
- tirarItems()
- avanzar()
- count = count + 1
- torcer()
- end
- if pos == 1 then
- turtle.turnRight()
- for i=0,ancho - 1 do
- forward()
- end
- turtle.turnRight()
- for i=0,largo do
- forward()
- end
- vuelta()
- down()
- pos = 1
- else
- turtle.turnLeft()
- for i=0,ancho - 1 do
- forward()
- end
- turtle.turnLeft()
- down()
- pos = 1
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement