This commit is contained in:
aozhiwei 2024-03-20 19:21:50 +08:00
parent b4b4af5985
commit 8196130498
3 changed files with 16 additions and 4 deletions

View File

@ -432,7 +432,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
}
}
GetTrigger()->HpChg();
room->OnHumanHpChg(this);
room->OnTeamPartChg(this);
}
void Human::AddToNewObjects(Entity* entity)

View File

@ -2639,9 +2639,21 @@ void Room::SendSMTeamFull(Human* hum)
}
void Room::OnHumanHpChg(Human* hum)
void Room::OnTeamPartChg(Human* hum)
{
if (hpchg_human_hash_.empty()) {
hpchg_human_hash_[hum->GetUniId()] = hum;
xtimer.SetTimeoutWpEx
(SERVER_FRAME_RATE * 0.5,
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
hpchg_human_hash_.clear();
}
},
&xtimer_attacher_);
hpchg_human_hash_[hum->GetUniId()] = hum;
}
}
int Room::InitWithCustomBattle(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,

View File

@ -286,7 +286,7 @@ public:
int GetFullLevelIdx() { return ++curr_full_level_idx_;}
std::shared_ptr<RoomOb> GetRoomOb();
void SendSMTeamFull(Human* hum);
void OnHumanHpChg(Human* hum);
void OnTeamPartChg(Human* hum);
private:
void ShuaAndroid();