Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Program made by Warfar
- --http://pastebin.com/u/warfar
- local emptySpace
- local slotFound
- local empty
- amount = {}
- local function findEmptySlots()
- for i = 3,16 do
- if turtle.getItemCount(i) == 0 then
- return i
- end
- end
- return 0
- end
- local function checkRestarted()
- if turtle.getItemCount(1) == 0 then
- turtle.select(1)
- turtle.digUp()
- elseif turtle.getItemCount(2) == 0 then
- turtle.select(2)
- turtle.digUp()
- end
- end
- local function dropItems()
- while findEmptySlots() == 0 do
- turtle.select(1)
- turtle.digUp()
- if not turtle.placeUp() then
- if turtle.attack() then
- while turtle.attack() do end
- end
- if turtle.digUp() then
- while turtle.digUp() do end
- end
- end
- for i = 3,16 do
- turtle.select(i)
- turtle.dropUp()
- end
- while findEmptySlots() == 0 do
- sleep(.1)
- for i = 3,16 do
- turtle.select(i)
- turtle.dropUp()
- end
- end
- sleep(1)
- end
- turtle.select(1)
- turtle.digUp()
- end
- local function dig()
- if turtle.detect() and not turtle.dig() then
- if turtle.attack() then
- while turtle.attack() do end
- end
- end
- if turtle.detectUp() and not turtle.digUp() then
- if turtle.attackUp() then
- while turtle.attackUp() do end
- end
- end
- if turtle.detectDown() and not turtle.digDown() then
- if turtle.attackDown() then
- while turtle.attackDown() do end
- end
- end
- turtle.forward()
- end
- local function refuel()
- while true do
- if turtle.getFuelLevel() < 10 then
- turtle.select(2)
- if not turtle.placeUp() then
- if turtle.attack() then
- while turtle.attack() do end
- end
- if turtle.digUp() then
- while turtle.digUp() do end
- end
- end
- if findEmptySlots() ~= 0 then
- e = findEmptySlots()
- turtle.select(e)
- turtle.suckUp()
- while turtle.getItemCount(e) == 0 do
- sleep(1)
- turtle.suckUp()
- end
- while turtle.getItemCount(e) ~= 0 do
- turtle.refuel(1)
- end
- turtle.select(2)
- turtle.digUp()
- break
- end
- if e == 0 then
- turtle.select(2)
- turtle.digUp()
- dropItems()
- end
- else
- break
- end
- end
- end
- local function checkSlots()
- if findEmptySlots() == 0 then
- dropItems()
- end
- end
- checkRestarted()
- while true do
- checkSlots()
- refuel()
- dig()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement