Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- AMQMYd2E
- -- slots: seeds, fuel
- -- maybe use glass slabs and an ender chest
- local plotLength = 8
- local plotWidth = 8
- local harvestTime = 20
- local growTime = 1500
- local useChest = false
- local function wait(secs)
- for sec = secs, 0, -5 do
- term.clear()
- term.setCursorPos(1,1)
- print(sec)
- if turtle.getItemCount(1) == 0 then
- break
- end
- sleep(5)
- end
- term.clear()
- end
- local function resetPosition()
- repeat until not turtle.up()
- repeat until not turtle.forward()
- while turtle.detect() do turtle.turnRight() end
- while not rs.getInput("left") do
- if not turtle.forward() then
- turtle.turnRight()
- end
- sleep(0.5)
- end
- end
- local function dropExcess()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) ~= 0 then
- turtle.select(slot)
- if slot == 1 then
- turtle.drop(turtle.getItemCount(slot) - 1)
- elseif slot ~= 2 then
- turtle.drop()
- end
- end
- sleep(0)
- end
- turtle.select(1)
- end
- local function harvest()
- rs.setOutput("top", true)
- wait(harvestTime)
- rs.setOutput("top", false)
- if useChest then
- repeat until turtle.forward()
- turtle.turnLeft()
- dropExcess()
- turtle.turnRight()
- end
- repeat until not turtle.forward()
- sleep(1)
- turtle.down()
- repeat until not turtle.suckDown()
- turtle.up()
- turtle.back()
- turtle.turnRight()
- end
- local function plant()
- turtle.select(1)
- local curX
- local curY
- curY = 1
- while curY <= plotLength do
- curX = 1
- while curX <= plotWidth do
- if turtle.getItemCount(1) > 1 then
- turtle.placeDown()
- end
- if curX == plotWidth then
- if curY < plotLength then
- if curY % 2 == 1 then
- turtle.turnRight()
- repeat until turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- repeat until turtle.forward()
- turtle.turnLeft()
- end
- end
- else
- repeat until turtle.forward()
- end
- curX = curX + 1
- end
- curY = curY + 1
- end
- end
- rs.setOutput("top", false)
- while turtle.getItemCount(1) ~= 0 do
- turtle.select(1)
- while turtle.getFuelLevel() < 128 do
- while turtle.getItemCount(2) < 2 do
- print("Out of Fuel")
- sleep(1)
- end
- turtle.select(2)
- turtle.refuel(1)
- turtle.select(1)
- end
- resetPosition()
- harvest()
- plant()
- wait(growTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement