Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function forward(count)
- for i=1,count do
- turtle.forward()
- end
- end
- function left(count)
- for i=1,count do
- turtle.turnLeft()
- end
- end
- function right(count)
- for i=1,count do
- turtle.turnRight()
- end
- end
- function back(count)
- for i=1,count do
- turtle.back()
- end
- end
- function clearTerm()
- term.clear()
- term.setCursorPos(1,1)
- end
- function isGrown()
- local succes, data = turtle.inspectDown()
- if succes then
- if (data.metadata == 0) and (data.name == "Agriculture:crop") then
- return true
- end
- end
- return false
- end
- function turnAround(toLeft)
- if toLeft then
- left(1)
- forward(1)
- left(1)
- else
- right(1)
- forward(1)
- right(1)
- end
- end
- function seed(width, height)
- local firstRun = true
- for i=1,2 do
- turtle.up()
- for x=1,width do
- local noCorner = false
- for y=1,height do
- if noCorner then
- forward(1)
- end
- if firstRun and (i == 2) then
- turtle.select(1)
- turtle.placeDown()
- turtle.select(16)
- turtle.placeDown()
- turtle.select(1)
- firstRun = false
- else
- turtle.placeDown()
- end
- noCorner = true
- end
- turnAround(x%2)
- end
- end
- end
- clearTerm()
- print("Enter the desired height.")
- local height = tonumber(read())
- print("Enter the desired width.")
- local width = tonumber(read())
- clearTerm()
- print("Turtle will now initiate seeding.")
- seed(width, height)
Advertisement
Add Comment
Please, Sign In to add comment