Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Local
- local distance = 0 -- How Far Did User Pick
- local depth = 0
- local depthInput = 0
- local returnDepth = 0
- local ItemFuel = turtle.getItemCount(1) -- How many items are in slot 3 (Fuel)
- local Fuel = 0 -- if 2 then it is unlimited no fuel needed
- local NeedFuel = 0 -- If Fuel Need Then 1 if not Then 0
- local Error = 0 -- 0 = No Error and 1 = Error
- local MD = 3 -- How Many Blocks Apart From Each Mine
- local MineTimes = 0 -- If Multi Mines Are ON then This will keep Count
- local Way = 0 -- 0 = Left and 1 = Right
- --Checking
- local function Check()
- if ItemFuel == 0 then
- print("No Fuel Items")
- error = 1
- else
- print("there is fuel")
- end
- repeat
- if turtle.getFuelLevel() == "unlimited" then
- print("NO NEED FOR FUEL")
- Needfuel = 0
- elseif turtle.getFuelLevel() < 100 then
- turtle.select(1)
- turtle.refuel(1)
- Needfuel = 1
- ItemFuel = ItemFuel - 1
- elseif NeedFuel == 1 then
- Needfuel = 0
- end
- until NeedFuel == 0
- end
- -- Recheck if user forget something turtle will check after 15 sec
- local function Recheck()
- ItemFuel = turtle.getItemCount(1)
- Error = 0
- end
- --Mining
- local function ForwardM()
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.forward() then -- sometimes sand and gravel and block and mix-up distance
- TF = TF - 1
- end
- if turtle.detectUp() then
- turtle.digUp()
- end
- repeat
- if turtle.getFuelLevel() == "unlimited" then
- print("NO NEED FOR FUEL")
- Needfuel = 0
- elseif turtle.getFuelLevel() < 100 then
- turtle.select(1)
- turtle.refuel(1)
- Needfuel = 1
- ItemFuel = ItemFuel - 1
- elseif ItemFuel == 0 then
- print("turtle run out of fuel")
- os.shutdown()
- elseif NeedFuel == 1 then
- Needfuel = 0
- end
- until NeedFuel == 0
- until TF == 0
- end
- -- Mine backwards
- local function Backwards() -- To make turn around so it can go back
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.digDown()
- turtle.down()
- turtle.digDown()
- turtle.down()
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.forward() then -- sometimes sand and gravel and block and mix-up distance
- TB = TB - 1
- end
- if turtle.detectUp() then
- turtle.digUp()
- end
- repeat
- if turtle.getFuelLevel() == "unlimited" then
- print("NO NEED FOR FUEL")
- Needfuel = 0
- elseif turtle.getFuelLevel() < 100 then
- turtle.select(1)
- turtle.refuel(1)
- Needfuel = 1
- ItemFuel = ItemFuel - 1
- elseif ItemFuel == 0 then
- print("turtle run out of fuel")
- os.shutdown()
- elseif NeedFuel == 1 then
- Needfuel = 0
- end
- until NeedFuel == 0
- until TB == 0
- turtle.turnRight()
- turtle.turnRight()
- turtle.digDown()
- turtle.down()
- turtle.digDown()
- turtle.down()
- end
- -- Multimines Program
- local function MultiMines()
- if Way == 0 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- repeat
- if turtle.detect() then
- turtle.dig()
- end
- if turtle.forward() then
- MD = MD - 1
- end
- if turtle.detectUp() then
- turtle.digUp()
- end
- until MD == 0
- if Way == 0 then
- turtle.turnLeft()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- else
- turtle.turnRight()
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- if MineTimes == 0 then
- print("Turtle is done")
- else
- MineTimes = MineTimes - 1
- end
- end
- -- Restart
- local function Restart()
- TF = distance
- TB = distance - 1
- MD = 3
- end
- -- Starting
- function Start()
- repeat
- repeat
- depth = depth - 2
- ForwardM()
- Backwards()
- Restart()
- until depth <= 0
- repeat
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- returnDepth = returnDepth - 1
- until returnDepth == 0
- depth = depthInput
- returnDepth = depthInput + 2
- MultiMines()
- until MineTimes == 0
- end
- -- Start
- print("Hi There Welcome to Mining Turtle Program")
- print("How Far Will Turtle Go")
- input = io.read()
- distance = tonumber(input)
- TF = distance
- TB = distance - 1
- print("How Deep?")
- input1 = io.read()
- depthInput = tonumber(input1)
- depth = depthInput
- returnDepth = depthInput + 2
- print("Left or Right")
- print("0 = Left and 1 = Right")
- input2 = io.read()
- Way = tonumber(input2)
- print("How Many Times")
- input3 = io.read()
- MineTimes = tonumber(input3)
- Check()
- if Error == 1 then
- repeat
- sleep(10)
- Recheck()
- Check()
- until Error == 0
- end
- Start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement