Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fullyGrown = 7
- local harvestedFile = "harvested"
- local harvested = {}
- while true do
- local success,data = turtle.inspect()
- if success then
- term.clear()
- term.setCursorPos(1,1)
- print("Block Metadata: "..data.metadata)
- if data.metadata == fullyGrown then
- turtle.dig()
- os.sleep(5)
- for i=1,16,1 do
- turtle.select(i)
- turtle.place()
- end
- turtle.select(1)
- end
- else
- os.sleep(5)
- for i=1,16,1 do
- turtle.select(i)
- turtle.place()
- end
- harvested = {}
- local file = fs.open(harvestedFile,"a")
- file.close()
- local file = fs.open(harvestedFile,"r")
- local line = file.readLine()
- repeat
- table.insert(harvested,line)
- until line == nil
- file.close()
- x = harvested[1] + 1
- local file = fs.open(harvestedFile,"w")
- file.writeLine(x)
- file.close()
- print(x)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement