Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function waitForEmpty()
- local f = false
- if turtle.getItemCount(16) > 0 then
- f = true
- print("Inventory full, remove items manually")
- os.sleep(10)
- end
- while turtle.getItemCount(16) > 0 do
- os.sleep(10)
- end
- if f then print("Space freed, resuming") end
- end
- function waitForTorches()
- local f = false
- if turtle.getItemCount(1) < 2 then
- f = true
- print("No torches, put them in the slot number 1")
- os.sleep(10)
- end
- while turtle.getItemCount(1) < 2 do
- os.sleep(10)
- end
- if f then print("Torches found, resuming") end
- end
- function waitForFuel()
- turtle.select(2)
- local f = false
- if not turtle.refuel(0) then
- f = true
- print("No fuel, put fuel in the slot number 2")
- os.sleep(10)
- end
- if f then print("Fuel found, resuming") end
- while not turtle.refuel(0) do
- os.sleep(10)
- end
- while turtle.getFuelLevel() < 80 do
- turtle.refuel(1)
- end
- turtle.select(1)
- end
- function waitForChests()
- local f = false
- if turtle.getItemCount(3) == 0 then
- f = true
- print("No chests, put chests in the slot number 3")
- os.sleep(10)
- end
- while turtle.getItemCount(3) == 0 do
- os.sleep(10)
- end
- if f then print("Chests found, resuming") end
- end
- function forward()
- while not turtle.forward() do
- turtle.dig()
- waitForEmpty()
- end
- end
- function dig()
- turtle.dig()
- waitForEmpty()
- turtle.digUp()
- waitForEmpty()
- turtle.digDown()
- waitForEmpty()
- forward()
- end
- n = 0
- while true do
- n = math.fmod(n + 1, 2)
- waitForFuel()
- waitForTorches()
- waitForChests()
- dig()
- turtle.turnLeft()
- for i = 1,12 do
- dig()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,7 do forward() end
- turtle.placeDown()
- waitForTorches()
- for i = 1,5 do forward() end
- for i = 1,12 do
- dig()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1,7 do forward() end
- turtle.placeDown()
- waitForTorches()
- for i = 1,5 do forward() end
- turtle.turnRight()
- if n == 0 then
- turtle.select(3)
- turtle.placeDown()
- for i = 4,16 do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- waitForChests()
- end
- forward()
- dig()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement