Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --@Author: Zach Combs aka TehNoiseBomb
- --@Version: 1.4
- local inputs = {...}
- local crop, seed, fullyGrown, sleepTime = ... --variables passed in (inputs)
- local moveLine = assert(loadfile("moveLine")) --Load the moveLine code as a variable that can be called as a function
- local nextRow = assert(loadfile("nextRow")) --Load the nextRow code as a variable that can be called as a function
- local moveHome = assert(loadfile("moveHome")) --Load the moveHome code as a variable that can be called as a function
- local getSeed = assert(loadfile("getSeed")) --Load the getSeed code as a variable that can be called as a function
- local itemDump = assert(loadfile("itemDump")) --Load the itemDump code as a variable that can be called as a function
- local refuel = assert(loadfile("refuel")) --Load the refuel code as a variable that can be called as a function
- local east = true --boolean flag determining if the turtle is facing east(true) or west(false) -> You can check in F3 mode, when placed the turtle is facing the same way as the player
- local seedData = getSeed(seed) --Get the data about the seed in the turtle's inventory
- local fuelLevel = turtle.getFuelLevel() --Get the amount of fuel the turtle has
- print("Working on crop: ", crop)
- print("Working with seed: ", seed)
- --While the turtle has fuel, repeat the following steps:
- -- Print the amount of fuel the turtle has
- -- Reset the turning flag to true
- -- Get how much fuel the turtle has
- -- If the turtle has seeds in it's inventory:
- -- Move through the first row and get how many seeds the turtle has in it's inventory
- -- Starting in the first row, repeat eight times:
- -- Move to the next row on the right and get set the new orientation to the east slag
- -- Move through the row and get how many seeds the turtle has in it's inventory
- -- Move to the home position
- -- Move to the chest, dump excess inventory and transfer the seeds to the first slot in the turtle's inventory
- -- Move to the fuel chest and refuel
- -- Get how much fuel the turtle has
- -- Sleep for the passed in amount of time
- while fuelLevel > 0 do
- print("Fuel left... ", fuelLevel)
- east = true
- fuelLevel = turtle.getFuelLevel()
- if seedData.count > 0 then
- seedData = moveLine(crop, seed, fullyGrown)
- for i = 0, 7 do
- east = nextRow(east)
- seedData = moveLine(crop, seed, fullyGrown)
- end
- moveHome()
- seedData = itemDump(seedData)
- fuelLevel = refuel(fuelLevel)
- end
- os.sleep(sleepTime)
- end
Add Comment
Please, Sign In to add comment