@@ -109,6 +109,8 @@ void GrpcClientPlayer::getActions()
109109{
110110 auto agent = M_agent;
111111 bool pre_process = checkPreprocess (agent);
112+ bool do_forceKick = checkdoForceKick (agent);
113+ bool do_heardPassReceive = checkdoHeardPassReceive (agent);
112114 State state = generateState ();
113115 state.set_need_preprocess (pre_process);
114116 protos::RegisterResponse* response = new protos::RegisterResponse (*M_register_response);
@@ -134,6 +136,26 @@ void GrpcClientPlayer::getActions()
134136 }
135137 }
136138
139+ if (do_forceKick && !actions.ignore_doforcekick ())
140+ {
141+ if (doForceKick (agent))
142+ {
143+ rcsc::dlog.addText ( rcsc::Logger::TEAM,
144+ __FILE__" : doForceKick done" );
145+ return ;
146+ }
147+ }
148+
149+ if (do_heardPassReceive && !actions.ignore_doheardpassrecieve ())
150+ {
151+ if (doHeardPassReceive (agent))
152+ {
153+ rcsc::dlog.addText ( rcsc::Logger::TEAM,
154+ __FILE__" : doHeardPassReceive done" );
155+ return ;
156+ }
157+ }
158+
137159 for (int i = 0 ; i < actions.actions_size (); i++)
138160 {
139161 auto action = actions.actions (i);
@@ -376,6 +398,10 @@ void GrpcClientPlayer::getActions()
376398 .execute (agent);
377399 agent->debugClient ().addMessage (" Neck_TurnToBallAndPlayer" );
378400 }
401+ else
402+ {
403+ agent->debugClient ().addMessage (" Neck_TurnToBallAndPlayer null player" );
404+ }
379405 }
380406 else if (action.action_case () == PlayerAction::kNeckTurnToBallOrScan ) {
381407 const auto &neckTurnToBallOrScan = action.neck_turn_to_ball_or_scan ();
@@ -416,6 +442,10 @@ void GrpcClientPlayer::getActions()
416442 .execute (agent);
417443 agent->debugClient ().addMessage (" Neck_TurnToPlayerOrScan" );
418444 }
445+ else
446+ {
447+ agent->debugClient ().addMessage (" Neck_TurnToPlayerOrScan null player" );
448+ }
419449 }
420450 else if (action.action_case () == PlayerAction::kNeckTurnToPoint ) {
421451 const auto &neckTurnToPoint = action.neck_turn_to_point ();
@@ -490,6 +520,28 @@ void GrpcClientPlayer::getActions()
490520 sample_communication->execute (agent);
491521 agent->debugClient ().addMessage (" sample_communication - execute" );
492522 }
523+ else if (action.action_case () == PlayerAction::kBhvDoForceKick )
524+ {
525+ if (doForceKick (agent))
526+ {
527+ agent->debugClient ().addMessage (" doForceKick" );
528+ }
529+ else
530+ {
531+ agent->debugClient ().addMessage (" doForceKick - false" );
532+ }
533+ }
534+ else if (action.action_case () == PlayerAction::kBhvDoHeardPassRecieve )
535+ {
536+ if (doHeardPassReceive (agent))
537+ {
538+ agent->debugClient ().addMessage (" doHeardPassReceive" );
539+ }
540+ else
541+ {
542+ agent->debugClient ().addMessage (" doHeardPassReceive - false" );
543+ }
544+ }
493545 else if (action.action_case () == PlayerAction::kHeliosOffensivePlanner ) {
494546 FieldEvaluator::ConstPtr field_evaluator = FieldEvaluator::ConstPtr (new SampleFieldEvaluator);
495547 CompositeActionGenerator *g = new CompositeActionGenerator ();
@@ -785,14 +837,20 @@ void GrpcClientPlayer::addSayMessage(protos::Say sayMessage) const
785837 }
786838}
787839
788- State GrpcClientPlayer::generateState () const
840+ protos:: State GrpcClientPlayer::generateState ()
789841{
790842 const rcsc::WorldModel &wm = M_agent->world ();
843+ if (M_state_update_time == wm.time ())
844+ {
845+ return M_state;
846+ }
847+ M_state_update_time = wm.time ();
791848 WorldModel *worldModel = StateGenerator::convertWorldModel (wm);
792849 addHomePosition (worldModel);
793- State state;
850+ protos:: State state;
794851 state.set_allocated_world_model (worldModel);
795- return state;
852+ M_state = state;
853+ return M_state;
796854}
797855
798856void GrpcClientPlayer::addHomePosition (protos::WorldModel *res) const
0 commit comments