Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Getting fuel level
- local fuelLevel = turtle.getFuelLevel()
- -- Asking user for length and width
- print("How far do you want the turtle to go in front")
- local length = io.read()
- print("How far do you want the turtle to go to the side")
- local width = io.read()
- -- Getting fuel needed
- local fuelNeeded = (length*width) + 1 + (1/2*length) + (1/2*width)
- local timesChanged = 0
- -- Making function to take crops
- local function getCrop()
- local isBlock, data = turtle.inspectDown()
- if (string.match(data.name, "croptopia:") and data['stage']['age'] == 7) then
- turtle.digDown()
- for i = 6, 1, -1
- do
- turtle.suckDown()
- end
- end
- end
- if(fuelLevel > fuelNeeded) then
- for a = length, 1, -1
- do
- timesChanged = timesChanged + 1
- turtle.forward()
- getCrop()
- if(timesChanged % 2 == 1) then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- for b = width, 1, -1
- do
- turtle.forward()
- getCrop()
- end
- turtle.turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement