From 624073bade4e5289de40bdb3466cd7a99c07b1a3 Mon Sep 17 00:00:00 2001 From: manuel Date: Fri, 13 Jan 2023 18:59:47 +0000 Subject: [PATCH] Update 'Turtle/Wheat.lua' --- Turtle/Wheat.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Turtle/Wheat.lua b/Turtle/Wheat.lua index 8ea40a1..e314782 100644 --- a/Turtle/Wheat.lua +++ b/Turtle/Wheat.lua @@ -268,6 +268,8 @@ function Wheat:plantAll(goBack) end function Wheat:harvestAll(goBack) + local startTime = os.clock() + local yield = 0 if (goBack == nil) then goBack = true end if(goBack == true) then goBack = {self.x, self.y, self.z, self.dir} @@ -286,6 +288,7 @@ function Wheat:harvestAll(goBack) line[j] = self:getStatusDown() end if(line[j] == 7) then + yield = yield + 1 turtle.digDown() turtle.placeDown() line[j] = 0 @@ -318,6 +321,8 @@ function Wheat:harvestAll(goBack) self:log("moving to goBack") self:moveTo(goBack) end + self.lastHarvestDuration = os.clock() - startTime + self.lastYield = yield end @@ -340,4 +345,4 @@ function Wheat:arrayToString(a) end s = s .. "}" return s -end \ No newline at end of file +end