diff --git a/server/gameserver/new_hero_agent.cc b/server/gameserver/new_hero_agent.cc index 126823a3..02cf155b 100644 --- a/server/gameserver/new_hero_agent.cc +++ b/server/gameserver/new_hero_agent.cc @@ -179,7 +179,18 @@ void HeroAgent::SetAttackDir(const glm::vec3& dir) void HeroAgent::ShotNormal(const glm::vec3& dir) { - abort(); + if (owner_->dead) { + return; + } + if (owner_->CanShot(true)) { + bool shot_ok = false; + glm::vec3 shot_dir = owner_->GetAttackDir(); + if (bullet_trace_mode_) { + owner_->Shot(shot_dir, shot_ok, 0, 0); + } else { + owner_->Shot(shot_dir, shot_ok, 0, 0); + } + } } void HeroAgent::ShotTrace() @@ -595,10 +606,24 @@ behaviac::EBTStatus HeroAgent::StartCoroutine(std::shared_ptr corou behaviac::EBTStatus HeroAgent::RegisterEvents(behaviac::vector events) { - + return behaviac::BT_SUCCESS; } behaviac::EBTStatus HeroAgent::CoMoveForward(int min_val, int max_val) { - + float distance = a8::RandEx(min_val, max_val); + auto context = MAKE_BTCONTEXT + ( + ); + auto co = std::make_shared(context, "CoMoveForward"); + co->runing_cb = + [this, context] () + { + if (owner_->GetMovement()->GetPathSize() <= 0) { + return behaviac::BT_SUCCESS; + } else { + return behaviac::BT_RUNNING; + } + }; + return StartCoroutine(co); }