Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- config_finished = 'All done master.'
- config_refuel = 'I am refueling!'
- config_turn_around = 'I am turning 180!'
- config_finished_mining = 'I am all done, getting back!'
- config_success = 'Starting mining!'
- config_block_length = 30
- function checkFuel(steps)
- if turtle.getFuelLevel() <= steps - 1 then
- turtle.select(1)
- coalToConsume = turtle.getItemCount(1) - 1
- print(config_refuel)
- turtle.refuel(coalToConsume)
- end --if
- end --checkFuel()
- function turnAround()
- print(config_turn_around)
- turtle.turnRight()
- turtle.turnRight()
- end --turnAround()
- function stopMining(steps)
- turnAround()
- print(config_finished_mining)
- for index = 1, steps do
- turtle.forward()
- end --for
- print(config_finished)
- end --stopMining()
- function mineForward(blockLength)
- for i = 1, blockLength do
- turtle.dig()
- turtle.forward()
- end --for
- end
- function mineToSide()
- turtle.turnLeft()
- mineForward(15)
- stopMining(15)
- turtle.turnLeft()
- end
- function miningAlgo(blockLength)
- stepsTaken = 0
- for index = 1, blockLength do
- stepsTaken = stepsTaken + 1
- checkFuel(stepsTaken)
- turtle.forward()
- turtle.dig()
- if stepsTaken >= turtle.getFuelLevel() or stepsTaken + 1 == blockLength then
- stopMining(stepsTaken)
- return true
- end --if
- if index % 3 == 1 and turtle.getFuelLevel() >= 30 then
- mineToSide()
- end --if
- end --for
- end
- function main()
- miningAlgo(config_block_length)
- print(config_success)
- print('I will mine forward for: ' + config_block_length + ' Blocks!')
- end --main
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement