@@ -71,7 +71,6 @@ function CpAITaskFieldWork:start()
7171
7272 spec .aiTrafficCollision = clone (AIFieldWorker .TRAFFIC_COLLISION , true , false , true )
7373 end
74- self .vehicle :raiseAIEvent (" onAIFieldWorkerStart" , " onAIImplementStart" )
7574 local cpSpec = self .vehicle .spec_cpAIFieldWorker
7675 --- Remembers the last lane offset setting value that was used.
7776 cpSpec .cpJobStartAtLastWp :getCpJobParameters ().laneOffset :setValue (self .job :getCpJobParameters ().laneOffset :getValue ())
@@ -84,23 +83,23 @@ function CpAITaskFieldWork:start()
8483 spec .driveStrategies = {}
8584 end
8685 local cpDriveStrategy
87- if self .startPosition and g_vineScanner :hasVineNodesCloseBy (self .startPosition .x , self .startPosition .z ) then
86+ if self .startPosition and g_vineScanner :hasVineNodesCloseBy (self .startPosition .x , self .startPosition .z ) then
8887 --- Checks if there are any vine nodes close to the starting point.
8988 self :debug (' Found a vine course, install CP vine fieldwork drive strategy for it' )
9089 cpDriveStrategy = AIDriveStrategyVineFieldWorkCourse (self , self .job )
9190 elseif AIUtil .hasChildVehicleWithSpecialization (self .vehicle , Plow ) then
9291 self :debug (' Found a plow, install CP plow drive strategy for it' )
9392 cpDriveStrategy = AIDriveStrategyPlowCourse (self , self .job )
9493 else
95- local combine = AIUtil .getImplementOrVehicleWithSpecialization (self .vehicle , Combine )
94+ local combine = AIUtil .getImplementOrVehicleWithSpecialization (self .vehicle , Combine )
9695 local pipe = combine and SpecializationUtil .hasSpecialization (Pipe , combine .specializations )
97- if combine and pipe then
96+ if combine and pipe then
9897 -- Default harvesters with a pipe.
9998 self :debug (' Found a combine with pipe, install CP combine drive strategy for it' )
10099 cpDriveStrategy = AIDriveStrategyCombineCourse (self , self .job )
101100 cpSpec .combineDriveStrategy = cpDriveStrategy
102101 end
103- if not cpDriveStrategy then
102+ if not cpDriveStrategy then
104103 self :debug (' Installing default CP fieldwork drive strategy' )
105104 cpDriveStrategy = AIDriveStrategyFieldWorkCourse (self , self .job )
106105 end
@@ -110,19 +109,20 @@ function CpAITaskFieldWork:start()
110109 --- Only the last driving strategy can stop the helper, while it is running.
111110 table.insert (spec .driveStrategies , cpDriveStrategy )
112111 end
112+ self .vehicle :raiseAIEvent (" onAIFieldWorkerStart" , " onAIImplementStart" )
113113 CpAITask .start (self )
114114end
115115
116116function CpAITaskFieldWork :stop (wasJobStopped )
117- if self .waitingForRefillingActive then
117+ if self .waitingForRefillingActive then
118118 local cpSpec = self .vehicle .spec_cpAIFieldWorker
119119 cpSpec .driveStrategy :raiseControllerEvent (
120120 AIDriveStrategyCourse .onStopRefillingEvent )
121121 end
122- if self .isServer then
122+ if self .isServer then
123123 self :debug (" Field work task stopped." )
124124 self .vehicle :stopFieldWorker ()
125125 self .vehicle :cpBrakeToStop ()
126126 end
127127 CpAITask .stop (self , wasJobStopped )
128- end
128+ end
0 commit comments