1
This commit is contained in:
parent
c8cfc14893
commit
cdebb91c27
@ -28,7 +28,7 @@ void RawTeamMember::InitRobot()
|
||||
msg.set_account_id(a8::Format("6000_2005_%d", {++robot_idx}));
|
||||
{
|
||||
std::set<int> refreshed_robot_set;
|
||||
MetaData::Robot* robot_meta = MetaMgr::Instance()->RandRobot(refreshed_robot_set);
|
||||
robot_meta = MetaMgr::Instance()->RandRobot(refreshed_robot_set);
|
||||
if (robot_meta) {
|
||||
msg.set_hero_id(robot_meta->i->hero_id());
|
||||
msg.set_name(robot_meta->i->name());
|
||||
@ -37,6 +37,8 @@ void RawTeamMember::InitRobot()
|
||||
skin->set_skin_id(robot_meta->skin_id[0]);
|
||||
skin->set_skin_lv(1);
|
||||
}
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ namespace cs
|
||||
class CMReconnect;
|
||||
}
|
||||
|
||||
namespace MetaData
|
||||
{
|
||||
struct Robot;
|
||||
}
|
||||
|
||||
struct RawTeamMember
|
||||
{
|
||||
class MatchTeam* team = nullptr;
|
||||
@ -31,11 +36,11 @@ struct RawTeamMember
|
||||
bool is_robot = false;
|
||||
bool is_leader = false;
|
||||
int state = kMatchReadying;
|
||||
MetaData::Robot* robot_meta = nullptr;
|
||||
void FillMFMatchTeamMember(cs::MFMatchTeamMember* msg);
|
||||
void InitRobot();
|
||||
};
|
||||
|
||||
|
||||
struct timer_list;
|
||||
class MatchTeam
|
||||
{
|
||||
|
@ -3880,7 +3880,38 @@ void Room::AddTeam(class MatchTeam* team)
|
||||
for (auto& member : team->GetCurrMembers()) {
|
||||
cs::CMJoin& msg = member->msg;
|
||||
if (member->is_robot) {
|
||||
|
||||
MetaData::Robot* robot_meta = member->robot_meta;
|
||||
Android* hum = EntityFactory::Instance()->MakeAndroid(AllocUniid());
|
||||
hum->name = robot_meta->i->name();
|
||||
hum->meta = MetaMgr::Instance()->GetPlayer(robot_meta->i->hero_id());
|
||||
hum->robot_meta = robot_meta;
|
||||
hum->born_point = AllocBornPoint(hum);
|
||||
if (!hum->born_point) {
|
||||
hum->SetPos(GetDefaultBornPoint());
|
||||
} else {
|
||||
hum->SetPos(hum->born_point->RandPoint());
|
||||
}
|
||||
a8::Vec2 attack_dir = hum->GetPos();
|
||||
attack_dir.Normalize();
|
||||
attack_dir.Rotate(a8::RandAngle());
|
||||
hum->SetAttackDir(attack_dir);
|
||||
hum->SetMoveDir(attack_dir);
|
||||
hum->room = this;
|
||||
hum->Initialize();
|
||||
AddToEntityHash(hum);
|
||||
AddToHumanHash(hum);
|
||||
MatchTeam(hum);
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
refreshed_robot_set_.insert(robot_meta->i->id());
|
||||
{
|
||||
AddToAliveHumanHash(hum);
|
||||
AddToMoveableHash(hum);
|
||||
grid_service->AddCreature(hum);
|
||||
hum->FindLocation();
|
||||
hum->RefreshView();
|
||||
}
|
||||
} else {
|
||||
Player* hum = NewPlayer();
|
||||
hum->ProcPreSettlementInfo(member->msg.pre_settlement_info());
|
||||
@ -3902,4 +3933,5 @@ void Room::AddTeam(class MatchTeam* team)
|
||||
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||
}
|
||||
}
|
||||
NotifyUiUpdate();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user