From ceb949542d23622836b3b0ad7334156391a9f1f9 Mon Sep 17 00:00:00 2001 From: Peter Vaiko Date: Wed, 29 Dec 2021 07:37:44 -0500 Subject: [PATCH] Plow rotation typo for course turn fix #19 --- scripts/ai/turns/AITurn.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/ai/turns/AITurn.lua b/scripts/ai/turns/AITurn.lua index 67545ccc8..628931520 100644 --- a/scripts/ai/turns/AITurn.lua +++ b/scripts/ai/turns/AITurn.lua @@ -577,8 +577,10 @@ function CourseTurn:endTurn(dt) end function CourseTurn:updateTurnProgress() - local progress = self.turnCourse:getCurrentWaypointIx() / #self.turnCourse - self.vehicle:raiseAIEvent("onAIFieldWorkerTurnProgress", "onAIImplementTurnProgress", progress, self.turnContext:isLeftTurn()) + if self.turnCourse then + local progress = self.turnCourse:getCurrentWaypointIx() / self.turnCourse:getNumberOfWaypoints() + self.vehicle:raiseAIEvent("onAIFieldWorkerTurnProgress", "onAIImplementTurnProgress", progress, self.turnContext:isLeftTurn()) + end end function CourseTurn:onWaypointChange(ix)