Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- distance = args[1]
- function mine (direction)
- --default harvest actionset
- if direction = "up" then
- turtle.digUp()
- turtle.up()
- scan()
- turtle.down()
- elseif direction = "down" then
- turtle.digDown()
- turtle.down()
- scan()
- turtle.up()
- else
- turtle.dig()
- turtle.forward()
- turtle.scan()
- end
- end
- function scan ()
- --seach surrounding for desired block, and call mine() if found
- turtle.select(1)
- if turtle.compare() then
- mine()
- end
- if turtle.compareUp() then
- mine("up")
- end
- if turtle.compareDown() then
- mine("down")
- end
- turtle.turnLeft()
- if turtle.compare() then
- mine()
- end
- turtle.turnRight()
- turtle.turnRight()
- if turtle.compare() then
- mine()
- end
- turtle.turnLeft()
- end
- function movement (length)
- --default moveset
- for i=1, length,1 do
- turtle.dig()
- turtle.forward()
- scan()
- end
- backtrack(length)
- end
- function backtrack (distance)
- --return to start
- turtle.turnRight()
- turtle.turnRight()
- for i=1, length,1 do
- turtle.forward()
- end
- end
- function mayne (length)
- --main function
- --check for block, and refuel
- turtle.select(1)
- if turtle.getItemCount(1) = 0 then
- turtle.print("No supplied block")
- os.sleep(10)
- os.exit()
- elseif turtle.getItemCount(2) > 0 then
- turtle.select(2)
- if turtle.refuel(0) then
- turtle.refuel()
- else
- print("no new fuel provided")
- end
- end
- if turtle.getFuelLevel < (distance * 2) then
- print("fuel level too low to complete desired distance")
- os.sleep(10)
- os.exit()
- end
- --begin search
- movement(length)
- end
- if distance = "help" or "" then
- print("usage: nether [desired mine length]")
- print("halts if it hits an unloaded chunk, so keep within reason")
- print("block to seach for in first slot, fuel in second")
- end
- if not distance then
- distance = 30
- end
- mayne(distance)
- --check for precence of block
- --refuel
- --mine
- --move forward
- --check surrounding blocks, and mine if debris
- --continue until length limit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement