@@ -59,9 +59,18 @@ function CpAITaskFieldWork:update(dt)
5959
6060end
6161
62- --- Makes sure the cp fieldworker gets started.
63- function CpAITaskFieldWork :start ()
64-
62+ --- This function can be used to trace the triggering of AI events. The timing of these is critical for multiplayer
63+ --- to work properly, these traces help to determine if this timing is correct. Bad timing will result in implements
64+ --- not lowering or not turning on in multiplayer, while there are no symptoms in single player.
65+ ---
66+ --- The game engine needs a separate phase for preparing to make sure that the
67+ --- * onAIFieldWorkerStart,
68+ --- * onAIFieldWorkerPrepareForWork,
69+ --- * onAIImplementStartLine
70+ --- events are generated one by one, one in each update loop so that at the end of the loop,
71+ --- AIFieldWorker:updateAIFieldWorker() triggers a onAIFieldWorkerActive event.
72+ ---
73+ function CpAITaskFieldWork :turnOnAIEventTrace ()
6574 self .vehicle .raiseAIEvent = function (vehicle , event1 , event2 , ...)
6675 if vehicle .cpLastRaiseAIEvent ~= event1 and vehicle .cpLastRaiseAIEvent2 ~= event2 then
6776 CpUtil .infoVehicle (vehicle , " raiseAIEvent %s %s" , event1 , event2 )
@@ -79,7 +88,10 @@ function CpAITaskFieldWork:start()
7988 VehicleActionController .onAIEvent (actionController , sourceVehicle , eventName )
8089 end
8190 end
82-
91+ end
92+
93+ --- Makes sure the cp fieldworker gets started.
94+ function CpAITaskFieldWork :start ()
8395 self :debug (" Field work task started." )
8496 local spec = self .vehicle .spec_aiFieldWorker
8597 spec .isActive = true
0 commit comments