Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ########################
- -- cultivate <n>
- -- version 0.2
- -- ########################
- -- #############
- -- config
- ARGS = {...}
- MAX = ARGS[1]
- SEED_SLOT = 1
- MEAL_SLOT = 2
- -- ##################
- -- define functions
- function plantSeed()
- turtle.select(SEED_SLOT)
- if turtle.place() then
- return true
- else
- print('failed: plantSeed')
- return false
- end
- end
- function useMeals()
- if turtle.getItemCount(MEAL_SLOT) < 4 then
- print('failed: useMeals (meal < 4)')
- return false
- else
- turtle.select(MEAL_SLOT)
- turtle.place()
- turtle.place()
- turtle.place()
- return true
- end
- end
- function harvest()
- turtle.select(SEED_SLOT)
- turtle.dig()
- end
- -- ##################
- -- Main
- turtle.dig()
- for i=1,MAX do
- print(i,'/',MAX)
- if plantSeed() == false then break end
- if useMeals() == false then break end
- harvest()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement