Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Flower farm
- -- 5x5 grass plot.
- -- G: Grass, T: Turtle, U: Unloading inventory, B: Bonemeal refilling inventory, F: Fuel refilling inventory
- -- G G G G G
- -- G G G G G
- -- G G G G G
- -- G G G G G
- -- G G G G G
- -- U T F
- -- B
- -- Place turtle one block above the grass. Ceiling height of 2 blocks over the entire grass plot except for the 5 grass blocks in direct line in front of the turtle starting position position which should be 3 blocks tall. Ceiling directly above the turtle starting position should be 4 blocks tall. This is vital to ensure the turtle can find its starting location after server/PC restarts.
- local function move()
- turtle.digDown()
- while not turtle.forward() do
- sleep(1)
- end
- end
- local function move2()
- while not turtle.forward() do
- sleep(1)
- end
- end
- local function harvest()
- --move to middle
- for i = 1,3 do
- move2()
- end
- turtle.turnRight()
- for i = 1,2 do
- move2()
- end
- --clear middle and bonemeal
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- --harvest spiralling out
- turtle.turnRight()
- move()
- turtle.turnLeft()
- move()
- turtle.turnLeft()
- move()
- move()
- turtle.turnLeft()
- move()
- move()
- turtle.turnLeft()
- move()
- move()
- move()
- turtle.turnLeft()
- move()
- move()
- move()
- turtle.turnLeft()
- move()
- move()
- move()
- move()
- turtle.turnLeft()
- move()
- move()
- move()
- move()
- turtle.turnLeft()
- move()
- move()
- move()
- move()
- move()
- turtle.turnRight()
- end
- local iRepeat = 0
- local iSec = 60
- local spacer = ""
- --find starting location
- turtle.up()
- turtle.up()
- for i = 1,5 do
- for i = 1,5 do
- turtle.forward()
- end
- turtle.up()
- turtle.turnLeft()
- end
- turtle.down()
- turtle.down()
- while turtle.detect() == true do
- turtle.turnLeft()
- sleep(0.5)
- end
- while true do
- term.clear()
- term.setCursorPos(1,4)
- print("Fuel Remaning : "..tostring(turtle.getFuelLevel()))
- term.setCursorPos(1,1)
- iRepeat = iRepeat+1
- print("Harvesting :"..iRepeat)
- --Refuel
- local fuelLevel = turtle.getFuelLevel()
- if (fuelLevel < 100) then
- turtle.select(16)
- turtle.refuel(2)
- end
- --Harvest
- harvest()
- for slot=1,14 do
- turtle.select(slot)
- sleep(0.1)
- turtle.drop()
- end
- turtle.turnLeft()
- --refuel bonemeal from chest
- turtle.select(15)
- turtle.suck()
- for slot=1,14 do
- turtle.select(slot)
- sleep(0.1)
- turtle.drop()
- end
- turtle.turnLeft()
- --Refill fuel from chest
- turtle.select(16)
- turtle.suck()
- for slot=1,14 do
- turtle.select(slot)
- sleep(0.1)
- turtle.drop()
- end
- turtle.turnLeft()
- term.setCursorPos(1,4)
- print("Fuel Remaning : "..tostring(turtle.getFuelLevel()))
- term.setCursorPos(1,2)
- term.clearLine()
- print("sleeping "..iSec.." seconds")
- for i = iSec,0,-1 do
- sleep(1)
- term.setCursorPos(1,3)
- term.clearLine()
- if i < 10 then
- spacer = "0"
- else
- spacer = ""
- end
- write("To go "..spacer..i)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement