MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / OnStep

Method OnStep

tests/test_unit_command.cc:476–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474 }
475
476 void OnStep() override {
477 const ObservationInterface* obs = agent_->Observation();
478 ActionInterface* act = agent_->Actions();
479
480 if (obs->GetGameLoop() < order_on_game_loop_) {
481 return;
482 }
483
484 const Units& units = obs->GetUnits(Unit::Alliance::Self);
485 for (const Unit& unit : units) {
486 if (unit.unit_type == test_unit_type_) {
487 test_unit_ = unit;
488 }
489 }
490
491 if (!marine_trained_) {
492 act->UnitCommand(test_unit_, ABILITY_ID::TRAIN_MARINE);
493 marine_trained_ = true;
494 }
495
496 if (obs->GetGameLoop() < order_on_game_loop_ + 10) {
497 return;
498 }
499
500 if (!orders_verified_ && marine_trained_) {
501 VerifyUnitOrders(test_unit_, ABILITY_ID::TRAIN_MARINE);
502 }
503
504 IssueUnitCommand(act);
505 }
506
507 void OnTestFinish() override {
508 VerifyUnitIdleAfterOrder(test_unit_type_);

Callers

nothing calls this directly

Calls 5

ObservationMethod · 0.80
ActionsMethod · 0.80
GetGameLoopMethod · 0.80
GetUnitsMethod · 0.80
UnitCommandMethod · 0.80

Tested by

no test coverage detected