Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Simple Mining Program
- -- Set the number of blocks to mine
- local distanceforward = 0
- local forward = 1 --Forward Facing
- local distanceBackward = 0
- local distanceLeft = 0
- local distanceRight = 0
- local distanceLimit = 10
- local FuelAmount = 0
- -- Check Fuel Level
- --local function fuelcheck()
- -- FuelAmount = turtle.getFuelLevel()
- -- print("Fuel Level " .. FuelAmount)
- --end
- -- Fuel Up
- local function Fuel()
- turtle.select(1)
- turtle.refuel(64)
- turtle.select(2)
- turtle.refuel(64)
- turtle.select(1)
- end
- local function Left()
- turtle.turnLeft()
- end
- local function Right()
- turtle.turnRight()
- end
- local function Up()
- turtle.up()
- end
- local function Down()
- turtle.down()
- end
- local function ClearAbove()
- if turtle.detectUp() then
- turtle.digUp()
- end
- end
- local function Clearforward()
- if turtle.detect() then
- turtle.dig()
- end
- end
- -- Function to ensure the path is clear
- local function DigAll()
- while turtle.getFuelLevel()>50 do
- while distanceRight<10 do
- while distanceforward < distanceLimit do
- Left()
- Clearforward()
- Right()
- Clearforward()
- Right()
- Clearforward()
- Up()
- Clearforward()
- Left()
- Left()
- Clearforward()
- Right()
- Clearforward()
- Down()
- if forward == 1 then
- Clearforward()
- turtle.forward()
- distanceforward = distanceforward+1
- else
- Clearforward()
- turtle.forward()
- distanceforward = distanceforward-1
- end
- end
- if forward > 0 then
- forward = 0 --Backwards
- Right()
- Clearforward()
- ClearAbove()
- distanceRight = distanceRight+1
- turtle.forward()
- Clearforward()
- ClearAbove()
- distanceRight = distanceRight+1
- turtle.forward()
- Clearforward()
- ClearAbove()
- distanceRight = distanceRight+1
- turtle.forward()
- Right()
- Clearforward()
- ClearAbove()
- turtle.forward()
- ClearAbove()
- distanceforward = distanceforward-1
- else
- forward = 1 --Forward
- Left()
- Clearforward()
- ClearAbove()
- distanceRight = distanceRight+1
- turtle.forward()
- Clearforward()
- ClearAbove()
- distanceRight = distanceRight+1
- turtle.forward()
- Clearforward()
- distanceRight = distanceRight+1
- turtle.forward()
- ClearAbove()
- Left()
- Clearforward()
- ClearAbove()
- turtle.forward()
- distanceforward = distanceforward+1
- end
- end
- if forward == 1 then
- Left()
- while distanceRight>0 do
- turtle.forward()
- distanceRight=distanceRight-1
- end
- else
- Right()
- while distanceRight>0 do
- turtle.forward()
- distanceRight=distanceRight-1
- end
- Left()
- while distanceforward > 0 do
- turtle.forward()
- distanceforward = distanceforward-1
- end
- end
- end
- end
- Fuel()
- DigAll()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement