Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---@diagnostic disable: lowercase-global
- -- Getting fuel level
- local fuelLevel = turtle.getFuelLevel()
- local direction = false
- local directionNew = direction
- -- Getting fuel needed
- local fuelNeeded = (13*13) + 1 + (1/2*13) + (1/2*13)
- -- Making function to get the slot index of the seed
- local function getSeedIndex()
- for slot = 1, 16, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- if (string.match(item.name, "seed")) then
- return slot
- end
- end
- end
- end
- -- Making function to take crops
- local function getCrop()
- local isBlock, data = turtle.inspectDown()
- if(isBlock)then
- if (string.match(data.name, "croptopia:") and data['state']['age'] == 7) then
- turtle.digDown()
- for i = 6, 1, -1
- do
- turtle.suckDown()
- seedIndex = getSeedIndex()
- if(seedIndex ~= nil) then
- turtle.select(seedIndex)
- turtle.placeDown()
- end
- end
- end
- else
- seedIndex = getSeedIndex()
- if(seedIndex ~= nil) then
- turtle.select(seedIndex)
- turtle.placeDown()
- end
- end
- end
- if(fuelLevel > fuelNeeded) then
- for a = 13, 1, -1
- do
- direction = not(direction)
- turtle.forward()
- getCrop()
- if(direction) then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- for b = 13-1, 1, -1
- do
- turtle.forward()
- getCrop()
- end
- if(direction) then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for c = 13, 1, -1
- do
- turtle.forward()
- end
- if (directionNew == false) then
- turtle.turnLeft()
- for d = 13-1, 1, -1
- do
- turtle.forward()
- end
- turtle.turnLeft()
- else
- turtle.turnRight()
- for d = 13-1, 1, -1
- do
- turtle.forward()
- end
- turtle.turnRight()
- end
- -- Drops ALL the items gained from farming ( seeds and crops ) into chest below starting point
- for slot = 1, 16, 1
- do
- turtle.select(slot)
- turtle.dropDown(64)
- end
- local time = os.startTimer(600)
- if(time == 0)then
- reboot()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement