Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Version 1.0
- Written by: Tom Nordloh (Notze)
- Create a rectangular field (configured
- for a 9x9 field but you can make your
- own adjustments in the lower section)
- and place a chest on the left side
- infront of it. Place the Turtle upon
- the chest faceing towards the field.
- Place the following things into the
- Turtles inventory:
- Slot 1: cole
- Slot 2: seeds
- ]]
- -- make your adjustments here
- local int x = 9 -- from Turtle's direction right
- local int y = 9 -- in Turtle's looking direction
- -- end of adjustments
- function main()
- -- refuel in dependency to field size
- refuel(1+(x*y+x+y)/96)
- -- harvest and plant
- local boolean nextEndUp = true
- forward(y)
- for j=2, x, 1 do
- if nextEndUp then
- turnRight()
- forward(1)
- turnRight()
- forward(y-1)
- nextEndUp = false
- else
- turnLeft()
- forward(1)
- turnLeft()
- forward(y-1)
- nextEndUp = true
- end
- end
- -- return to chest
- if nextEndUp then
- back(y)
- turnRight()
- back(x-1)
- turnLeft()
- else
- forward(1)
- turnLeft()
- back(x-1)
- turnLeft()
- end
- -- place everything but cole and seeds in the Chest
- for i=3, 16 do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- function refuel(amount)
- if turtle.getFuelLevel() < 96*amount then
- turtle.select(1)
- turtle.refuel(amount)
- end
- end
- function forward(length)
- for i=1, length, 1 do
- turtle.forward()
- turtle.digDown()
- turtle.select(2)
- turtle.placeDown()
- end
- end
- function back(length)
- for i=1, length, 1 do
- turtle.back()
- end
- end
- function turnRight()
- turtle.turnRight()
- end
- function turnLeft()
- turtle.turnLeft()
- end
- function turnAround()
- turnRight()
- turnRight()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment