Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rednetWorks = false
- for a,b in pairs(rs.getSides()) do
- if peripheral.getType(b) == "modem" then
- rednet.open(b)
- rednetWorks = true
- end
- end
- local depth = 0
- function isJunk()
- local matched = false
- if turtle.detect(stone) or turtle.detect(dirt) or turtle.detect(grass) or turtle.detect(bedrock) or turtle.detect(air) then
- matched = true
- end
- if matched == false then
- return false
- else
- return true
- end
- end
- function compare()
- for j=1,4 do
- if isJunk() == false then
- turtle.dig()
- rednet.send(3,"Found Ore At "..depth)
- end
- turtle.turnLeft()
- end
- end
- function fuel()
- if turtle.getFuelLevel() <= 20 then
- turtle.select(16)
- turtle.refuel(1)
- end
- end
- function start()
- term.clear()
- term.setCursorPos(1,1)
- print("-------Mining Operation Beta-------")
- term.write("Commence Mining Operation? (y/n):")
- local input = read()
- if input == "n" then
- print("Cancelling Mining Operation")
- if rednetWorks then
- rednet.send(3,"Cancelling Mining Operation")
- rednet.close(b)
- end
- sleep(1)
- exit()
- elseif input == "y" then
- print("Commencing Mining Operation Beta")
- if rednetWorks then
- rednet.send(3, "Commencing Mining Operation")
- end
- sleep(0.5)
- end
- end
- function goDown()
- fuel()
- if turtle.down() then
- return true
- else
- return false
- end
- depth = depth + 1
- end
- function goUp()
- fuel()
- if turtle.up() then
- return true
- else
- return false
- end
- depth = depth - 1
- end
- while true do
- start()
- turtle.digDown()
- goDown()
- turtle.digDown()
- goDown()
- turtle.select(1)
- turtle.placeUp()
- turtle.digDown()
- function down()
- while turtle.detectDown() == false do
- goDown()
- compare()
- turtle.digDown()
- if depth % 10 == 0 then
- if rednetWorks then
- rednet.send(3,"At Depth "..depth)
- end
- end
- end
- goUp()
- turtle.select(15)
- turtle.placeDown()
- end
- down()
- if rednetWorks then
- rednet.send(3, "Positioning For Next Mine")
- for l = 1,5 do
- goUp()
- end
- turtle.dig()
- fuel()
- turtle.forward()
- turtle.dig()
- fuel()
- turtle.forward()
- turtle.turnRight()
- turtle.dig()
- fuel()
- turtle.forward()
- turtle.turnLeft()
- turtle.digDown()
- down()
- if rednetWorks then
- rednet.send(3, "Coming Up")
- end
- while depth > 0 do
- compare()
- fuel()
- if goUp() == false then
- turtle.digUp()
- goUp()
- end
- if depth % 10 == 0 then
- if rednetWorks then
- rednet.send(3, "At depth "..depth)
- end
- end
- end
- turtle.select(1)
- turtle.placeDown()
- fuel()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- fuel()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement