Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Slot 1: Ender Chest to dumps items into.
- --Slot 2: Ender Chest to pull Torches From.
- --Slot 3: Fuel
- --Slot 4: Torches
- --Variables:
- A = 0
- B = 0
- C = 0
- --Functions
- --refuel
- local function refuel()
- if turtle.getFuelLevel() < 40 then
- turtle.select(3)
- turtle.refuel(10)
- end
- end
- --Put Items in Ender Chest
- local function dumptochest()
- if turtle.getItemCount(16) ~= 0 then
- turtle.digDown()
- turtle.select(1)
- turtle.placeDown()
- for i = 5,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- turtle.digDown()
- end
- end
- -- Gets Torches
- local function gettorches()
- if turtle.getItemCount(4) == 0 then
- turtle.select(2)
- turtle.digDown()
- turtle.placeDown()
- turtle.select(4)
- turtle.suckDown()
- turtle.select(2)
- turtle.digDown()
- end
- end
- -- Places Torches
- local function torch()
- B = B + 1
- if B == 5 then
- turtle.select(4)
- --turtle.turnRight()
- --turtle.turnRight()
- turtle.placeDown()
- --turtle.turnRight()
- --turtle.turnRight()
- B = 0
- end
- end
- -- Mines
- local function mining()
- refuel()
- turtle.dig()
- local f = turtle.forward()
- if f then
- A = A + 1
- end
- turtle.digUp()
- turtle.digDown()
- sleep(0.2)
- end
- --Returns Home
- local function gohome()
- refuel()
- turtle.dig()
- local f = turtle.forward()
- if f then
- A = A + 1
- sleep(0.3)
- end
- end
- -- Code
- if C == 0 then
- write("How Long do you want your tunnels?")
- distance = io.read()
- distance = tonumber(distance)
- end
- while A < distance do
- dumptochest()
- torch()
- gettorches()
- mining()
- end
- turtle.turnLeft()
- mining()
- turtle.turnLeft()
- A = 0
- while A < distance do
- dumptochest()
- mining()
- end
- turtle.turnRight()
- mining()
- turtle.turnRight()
- A = 0
- while A < distance do
- dumptochest()
- mining()
- end
- turtle.turnLeft()
- mining()
- turtle.turnLeft()
- A = 0
- while A < distance do
- dumptochest()
- --torch()
- --gettorches()
- mining()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement