Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local out = false
- wd = false
- sd = false
- function dump()
- turtle.back()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(3)
- turtle.drop()
- turtle.select(4)
- turtle.drop()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- end
- function forward()
- while not turtle.forward() do
- turtle.attack()
- end
- end
- function checkInv()
- if turtle.getItemCount(1) <= 7 then
- out = true
- else
- out = false
- end
- if turtle.getItemCount(2) <= 7 then
- out = true
- else
- out = false
- end
- end
- function wood()
- turtle.select(4)
- turtle.digDown()
- if turtle.getItemCount(2) == 0 then
- if turtle.getItemCount(1) == 0 then
- wd = false
- else
- turtle.select(1)
- turtle.placeDown()
- end
- else
- turtle.select(2)
- turtle.placeDown()
- wd = true
- end
- end
- function stone()
- turtle.select(3)
- turtle.digDown()
- if turtle.getItemCount(1) == 0 then
- if turtle.getItemCount(2) == 0 then
- sd = false
- else
- turtle.select(2)
- turtle.placeDown()
- end
- else
- turtle.select(1)
- turtle.placeDown()
- sd = true
- end
- end
- function refuel()
- checkInv()
- if out == true then
- turtle.back()
- turtle.select(1)
- local xa = 64 - turtle.getItemCount(1)
- local xb = 64 - turtle.getItemCount(2)
- turtle.suckDown(xa)
- turtle.suckUp(xb)
- turtle.forward()
- out = false
- end
- checkInv()
- end
- function replace()
- success, t = turtle.inspectDown()
- if t.name == "Botania:livingwood" then
- wood()
- elseif t.name == "Botania:livingrock" then
- stone()
- end
- end
- function supply()
- term.setCursorPos(1,9)
- if wd == true and sd == true then
- print("Turtle is out of wood and stone")
- elseif wd == true then
- print("turtle is out of wood")
- elseif wd == true then
- print("turtle is out of stone")
- end
- end
- while true do
- fl = turtle.getFuelLevel()
- success, t = turtle.inspectDown()
- if t.name == "Botania:livingwood" or t.name == "Botania:livingrock" then
- term.clear()
- term.setCursorPos(10,6)
- print("STATUS: WORKING")
- term.setCursorPos(12,7)
- print("FUEL: "..fl)
- supply()
- refuel()
- replace()
- for i=1,5 do
- forward()
- replace()
- end
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- replace()
- forward()
- forward()
- replace()
- forward()
- replace()
- forward()
- forward()
- replace()
- turtle.turnRight()
- forward()
- turtle.turnRight()
- replace()
- for i = 1,5 do
- forward()
- replace()
- end
- for i=1,5 do
- turtle.back()
- end
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- dump()
- else
- term.clear()
- term.setCursorPos(10,6)
- print("STATUS: Waiting")
- term.setCursorPos(12,7)
- print("FUEL: "..fl)
- supply()
- sleep(10)
- end
- end
Add Comment
Please, Sign In to add comment