Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local moves = 0
- tArgs = { ... }
- function move( dig )
- if dig == true then
- turtle.dig()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- end
- function upAndDown()
- turtle.digUp()
- turtle.digDown()
- end
- function row()
- move( true )
- upAndDown()
- end
- function checkForFuel()
- for i = 1, 16 do
- result = turtle.getItemDetail()
- if result then
- if result.name == "minecraft:coal" then
- turtle.select( i )
- if result.count / 4 == math.floor( result.count / 4 ) then
- turtle.refuel( result.count / 4)
- else
- turtle.refuel( math.floor( result.count / 4 ) )
- end
- end
- end
- end
- end
- function work( t )
- for i = 1, t[ 1 ] do
- if turtle.getFuelLevel() < 100 then
- checkForFuel()
- end
- row()
- turtle.turnLeft()
- row()
- while not turtle.back() do
- turtle.dig()
- end
- turtle.turnRight()
- turtle.turnRight()
- row()
- while not turtle.back() do
- turtle.dig()
- end
- turtle.turnLeft()
- moves = moves + 1
- end
- end
- if #tArgs ~= 1 then
- print( "Usage: " .. shell.getRunningProgram() .. " <length>" )
- else
- work( tArgs )
- for i = 1, moves do
- turtle.back()
- end
- end
- =
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement