Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --@Author: Zach Combs aka TehNoiseBomb
- --@Version: 1.1
- local inputs = {...}
- local crop, seed, fullyGrown = ... --variables passed in (inputs)
- local getSeed = assert(loadfile("getSeed")) --Load the getSeed code as a variable that can be called as a function
- local bool, block = turtle.inspectDown() --turtle.inspectDown() returns a boolean value success and a table containing details of the block below the turtle
- local item --A table containing the name, damage and count of an item later selected by the turtle, will be returned to moveLine
- --Create the table for the seed (see getSeed for more details)
- item = getSeed(seed)
- --If the turtle fails to see a crop (or block) below it:
- -- If the item table is not blank:
- -- If the amount of the item is more than one:
- -- Select the slot the item is in
- -- Attempt to plant the item
- if not bool then
- if item then
- if item.count > 1 then
- print("Selecting seed... ", turtle.select(seedSlot))
- print("Attempting to plant... ", turtle.placeDown(), "...")
- end
- end
- end
- --If the unlocalized name of the block below the turtle is equal to the passed in crop's:
- -- If the crop is fully grown:
- -- Harvest
- -- If the turtle contains more than one of the crop's seed:
- -- Select the seed
- -- Plant the seed
- if block.name == crop then
- if block.metadata == fullyGrown then
- print("Harvesting... ", turtle.digDown())
- item = getSeed(seed)
- if item.count > 1 then
- print("Selecting seed... ", turtle.select(item.slot))
- print("Planting... ", turtle.placeDown())
- end
- end
- end
- --Return the table item containing the slot, name, count and damage value of the seed
- return item
Add Comment
Please, Sign In to add comment