Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- rednet.open("right")
- term.clear()
- term.setCursorPos(1,1)
- write(" Final FarmOS 1.2")
- term.setCursorPos(1,2)
- movedir = "right"
- filledslot = 2
- step = 0
- row = 0
- line = 0
- sidedone = false
- finished = false
- rednet.open("left")
- rednet.open("right")
- local function getfilledslot()
- while turtle.getItemCount(filledslot) == 0 do
- if filledslot + 1 <= 16 then
- filledslot = filledslot + 1
- else
- filledslot = 2
- end
- sleep(0.1)
- end
- end
- local function callSeeds()
- turtle.turnLeft()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.suck()
- turtle.turnRight()
- end
- local function GOHOME()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.select(2)
- turtle.drop()
- turtle.select(3)
- turtle.drop()
- turtle.select(4)
- turtle.drop()
- turtle.select(5)
- turtle.drop()
- turtle.select(6)
- turtle.drop()
- turtle.select(7)
- turtle.drop()
- turtle.select(8)
- turtle.drop()
- turtle.select(9)
- turtle.drop()
- turtle.select(10)
- turtle.drop()
- turtle.select(11)
- turtle.drop()
- turtle.select(12)
- turtle.drop()
- turtle.select(13)
- turtle.drop()
- turtle.select(14)
- turtle.drop()
- turtle.select(15)
- turtle.drop()
- turtle.select(16)
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- local function refuel()
- if turtle.getFuelLevel() <= 20 then
- turtle.select(1)
- turtle.refuel(2)
- turtle.refuel(2)
- turtle.refuel(2)
- turtle.refuel(2)
- end
- rednet.broadcast("FarmTurtleCoal")
- rednet.broadcast(tostring(turtle.getItemCount(1)))
- end
- local function checkFuelLevel()
- rednet.broadcast("FarmTurtleFuel")
- rednet.broadcast(tostring(turtle.getFuelLevel()))
- end
- local function tiltline()
- while finished == false do
- while turtle.detect() == false do
- getfilledslot()
- turtle.select(filledslot)
- turtle.placeDown()
- getfilledslot()
- turtle.forward()
- checkFuelLevel()
- refuel()
- end
- if movedir == "left" then
- turtle.turnLeft()
- if turtle.detect() == true then
- finished= true
- end
- turtle.forward()
- turtle.turnLeft()
- movedir ="right"
- else
- turtle.turnRight()
- turtle.turnRight()
- movedir ="left"
- end
- while turtle.detect() == false do
- if turtle.detectDown() == true then
- turtle.select(filledslot)
- getfilledslot()
- turtle.forward()
- checkFuelLevel()
- refuel()
- else
- getfilledslot()
- turtle.select(filledslot)
- getfilledslot()
- turtle.placeDown()
- turtle.forward()
- checkFuelLevel()
- refuel()
- end
- end
- end
- end
- while redstone.getInput("left") == false do
- local senderId, message, distance = rednet.receive()
- if message == "Farmer.Start()" then
- write("working... ")
- while finished == false do
- filledslot = 2
- callSeeds()
- turtle.select(filledslot)
- tiltline()
- end
- finished = false
- movedir = "right"
- step = 0
- row = 0
- line = 0
- sidedone = false
- filledslot = 2
- GOHOME()
- elseif message=="Farmer.Exit()" then
- return
- end
- sleep(0.01)
- end
- return
Advertisement
Add Comment
Please, Sign In to add comment