This commit is contained in:
aozhiwei 2019-04-11 13:22:34 +08:00
parent 2b5fbdb306
commit 7e61dc58eb
4 changed files with 15 additions and 12 deletions

View File

@ -88,7 +88,11 @@ void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
stats_pb->set_player_id(entity_uniid);
stats_pb->set_player_avatar_url(avatar_url);
if (!dead) {
stats_pb->set_time_alive(room->frame_no * 1000.0f / SERVER_FRAME_RATE);
} else {
stats_pb->set_time_alive(dead_frameno * 1000.0f / SERVER_FRAME_RATE);
}
stats_pb->set_kills(stats.kills);
stats_pb->set_damage_amount(stats.damage_amount);
stats_pb->set_heal_amount(stats.heal_amount);
@ -355,8 +359,8 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
msg.set_team_id(0);
msg.set_team_rank(rank);
msg.set_team_allcnt(1);
msg.set_game_over(true);
msg.set_victory(false);
msg.set_game_over(room->game_over);
msg.set_victory(!dead);
cs::MFPlayerStats* p = msg.add_player_stats();
FillMFPlayerStats(p);
@ -364,7 +368,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
void Human::BeKill(int killer_id, const std::string& killer_name)
{
if (!dead) {
if (!dead && !room->game_over) {
Entity* hum = room->GetEntityByUniId(killer_id);
if (hum && hum->entity_type == ET_Player) {
((Human*)hum)->stats.kills++;

View File

@ -47,7 +47,6 @@ class Human : public Entity
bool poisoning = false;
long long poisoning_time = 0;
long long dead_frameno = 0;
bool game_over = false;
Weapon default_weapon;
std::vector<Weapon> weapons;

View File

@ -280,13 +280,6 @@ void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg)
void Room::ResetFrameData()
{
frame_data.deleted_objects.clear();
#if 0
{
frame_data.explosions_hash.clear();
frame_data.smokes_hash.clear();
frame_data.emotes_hash.Clear();
}
#endif
frame_data.bullets.Clear();
frame_data.shots.Clear();
}
@ -674,10 +667,16 @@ void Room::UpdateGas()
break;
}
if (gas_data.gas_mode != GasInactive) {
if (alive_count_ <= 1) {
game_over = true;
}
for (auto& pair : human_hash_) {
if (pair.second->dead) {
continue;
}
if (game_over) {
pair.second->send_gameover = true;
}
bool b1 = CircleContainCircle(gas_data.pos_old,
gas_data.gas_progress,
pair.second->pos,

View File

@ -22,6 +22,7 @@ public:
RoomFrameData frame_data;
long long frame_no = 0;
GasData gas_data;
bool game_over = false;
void Initialize();
void Update(int delta_time);