Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- if #tArgs < 1 then
- print("Rong usage.")
- print("Syntax: farmoaks <number of oaks to farm>")
- return
- end
- local iterations = tonumber(tArgs[1])
- local Hpos = 0
- local Vpos = 0
- local function plantSapling()
- turtle.select(1)
- if not turtle.place() then
- print("No saplings! Aborting.")
- return
- end
- end
- local function applyBoneMeal()
- turtle.select(1) -- Sapling
- while turtle.compare(1) do
- turtle.select(2) -- Bone Meal
- if not turtle.place() then
- print ("No Bone Meal! Aborting.")
- return
- end
- turtle.select(1) -- Sapling
- end
- end
- local function cutTree()
- if not turtle.dig() then
- print("Something's Rong! No tree to cut. Aborting")
- return
- end
- while not turtle.forward do
- fuel = turtle.getFuelLevel()
- if fuel < 1 then
- while not turtle.refuel() do
- print ("Waiting for fuel...")
- end
- end
- end
- -- Hpos = Hpos + 1
- turtle.select(3) -- wood
- while turtle.compareUp(3) do
- turtle.digUp()
- turtle.up()
- Vpos = Vpos + 1
- end
- while Vpos > 0 do
- if not turtle.down() then
- print("Tried to go down further and couldn't.")
- end
- Vpos = Vpos - 1
- end
- turtle.back()
- end
- local function returnWood()
- turtle.turnLeft()
- turtle.turnLeft()
- for n=4,16 do
- turtle.select(n)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- for i = 1, iterations do
- plantSapling()
- applyBoneMeal()
- cutTree()
- returnWood()
- end
Advertisement
Add Comment
Please, Sign In to add comment