Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dx = 10
- local dz = 10
- local a = 0
- local distbx = 11
- local distfx = 0
- local distfz = 0
- local cz = 0
- local cy = 0
- local czy = 0
- local ait1 = 0
- local ait2 = 0
- local ait3 = 0
- -- Funcion Fuel
- function fuel()
- -- miramos inventario para chequear fuel
- turtle.select(1)
- a = 0
- for a = 2,16 do
- if turtle.compareTo(a) then
- -- compruebo items primer slot, muevo y recargo fuel.
- turtle.select(1)
- if turtle.getItemCount(1) < 10 then
- -- Transfers 32 items from the selected slot to slot 6.
- -- turtle.transferTo(6, 32)
- -- turtle.transferTo(slot destino,cantidad)
- -- Cogemos un carbon del slot selecionado turtle.select(a) y lo ponemos en slot (1)
- turtle.select(a)
- turtle.transferTo(1, 1)
- end
- end
- end
- if turtle.getFuelLevel() < 1 then
- turtle.refuel(1)
- end
- end
- -- Funcion cavax
- function cavax()
- repeat
- fuel()
- if turtle.forward() then
- distfx = distfx +1
- end
- turtle.dig()
- until distfx == dx
- if distfx == dx then
- distfz = distfz + 1
- repeat
- fuel()
- if turtle.back() then
- distbx = distbx - 1
- end
- until distbx == 1
- distbx = 11
- distfx = 0
- dx = 10
- cavaz()
- end
- end
- -- Funcion cavaz
- function cavaz()
- if distfz == dz then
- distfz = 1
- turtle.turnLeft()
- repeat
- fuel()
- if turtle.forward() then
- distfz = distfz +1
- end
- until distfz == dz
- turtle.turnRight()
- distfz = 0
- cz = 0
- dz = 10
- cavay()
- end
- if czy ~= 1 then
- cz = 0
- turtle.turnRight()
- turtle.dig()
- repeat
- if turtle.forward() then
- cz = cz +1
- end
- until cz == 1
- turtle.turnLeft()
- end
- czy = 0
- end
- function cavay()
- fuel()
- turtle.digDown()
- cy = 0
- repeat
- if turtle.down() then
- cy = cy +1
- if cy == 256 then
- os.shutdown()
- end
- end
- until cy == 1
- -- reset de variables.
- dx = 10
- dz = 10
- distbx = 11
- distfx = 0
- distfz = 0
- cz = 0
- cy = 0
- czy = 1
- -- tiramos tierra, piedra y grava
- turtle.select(2)
- ait1 = 0
- for ait1 = 5,16 do
- if turtle.compareTo(ait1) then
- turtle.getItemCount(ait1)
- turtle.select(ait1)
- turtle.drop()
- end
- turtle.select(2)
- end
- turtle.select(3)
- ait2 = 0
- for ait2 = 5,16 do
- if turtle.compareTo(ait2) then
- turtle.getItemCount(ait2)
- turtle.select(ait2)
- turtle.drop()
- end
- turtle.select(3)
- end
- turtle.select(4)
- ait3 = 0
- for ait3 = 5,16 do
- if turtle.compareTo(ait3) then
- turtle.getItemCount(ait3)
- turtle.select(ait3)
- turtle.drop()
- end
- turtle.select(4)
- end
- end
- -- Empezamos el programa
- fuel()
- while true do
- cavax()
- end
Advertisement
Add Comment
Please, Sign In to add comment