Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("getTill")
- print("1.3")
- local i = 1
- local x = 1
- local y = 1
- local z = 0
- local function plant(i)
- local c = 0
- turtle.select(x)
- if turtle.getItemCount(x) == 0 then
- repeat turtle.select(i+1)
- i = i + 1
- if i == 15 then
- i = 1
- c = c+1
- end
- if c == 2 then
- goHome(y)
- end
- until turtle.getItemCount(i) > 0
- end
- turtle.dig()
- turtle.place()
- if turtle.back() == false then
- repeat turtle.back()
- until turtle.back()
- end
- end
- local function refill()
- for z = 1,15 do
- turtle.select(z)
- turtle.suckDown()
- end
- end
- local function empty()
- for x=1,15 do
- turtle.select(x)
- turtle.dropDown()
- end
- end
- local function turnAround(y)
- if y%2 == 1 then
- turtle.turnRight()
- if turtle.back() == false then
- repeat turtle.back()
- until turtle.back()
- end
- turtle.turnRight()
- end
- if y%2 == 0 then
- turtle.turnLeft()
- if turtle.back() == false then
- repeat turtle.back()
- until turtle.back()
- end
- turtle.turnLeft()
- end
- end
- local function goHome(y)
- if y%2 == 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- repeat turtle.back()
- until turtle.back() == false
- turtle.turnRight()
- repeat turtle.back()
- y = y - 1
- until y == 1
- turtle.down()
- turtle.turnRight()
- end
- local function till()
- repeat
- plant(i)
- turtle.select(16)
- until turtle.compareDown()
- turtle.select(x)
- if turtle.getItemCount(x) == 0 then
- repeat turtle.select(i+1)
- i = i + 1
- if i == 15 then
- goHome(y)
- i = 1
- end
- until turtle.getItemCount(i) > 0
- end
- turtle.dig()
- turtle.place()
- turnAround(y)
- end
- local function endOfPlotCheck()
- turtle.select(16)
- if turtle.compareDown() == true then
- turtle.back()
- if turtle.compareDown() == true then
- return true
- end
- end
- end
- while true do
- turtle.select(1)
- rednet.open("right")
- local senderId, msg = rednet.receive()
- if msg == "farm" then
- refill()
- repeat
- till()
- y = y + 1
- until endOfPlotCheck()
- goHome(y)
- empty()
- os.reboot()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement