static void ReportPlayerDeath(Player player, int num, int num2) { Player killer, assister = null; var killer_id = default(NetworkInstanceId); var assister_id = default(NetworkInstanceId); PlayerLobbyData playerLobbyData; if (num2 != -1 && NetworkMatch.m_players.TryGetValue(num2, out playerLobbyData)) { killer = Server.FindPlayerByConnectionId(playerLobbyData.m_id); if (killer != null) { killer_id = killer.netId; } } if (num != -1 && NetworkMatch.m_players.TryGetValue(num, out playerLobbyData)) { assister = Server.FindPlayerByConnectionId(playerLobbyData.m_id); if (assister != null) { assister_id = assister.netId; } } // Send stats to client and clear out if (MPTweaks.ClientHasTweak(player.connectionToClient.connectionId, "deathreview")) { NetworkServer.SendToClient(player.connectionToClient.connectionId, MessageTypes.MsgDeathReview, new DeathReviewMessage { m_killer_id = killer_id, m_assister_id = assister_id, players = ServerDamageLog.GetSummaryForDeadPlayer(player) }); } ServerDamageLog.Clear(player.netId); }
static void AddDamageEvent(PlayerShip playerShip, DamageInfo di, float damage_scaled) { if (!Overload.NetworkManager.IsHeadless() || di.damage == 0f || playerShip.m_death_stats_recorded || playerShip.m_cannot_die || playerShip.c_player.m_invulnerable) { return; } float hitpoints = playerShip.c_player.m_hitpoints; var weapon = di.weapon; switch (weapon) { case ProjPrefab.missile_devastator_mini: weapon = ProjPrefab.missile_devastator; break; case ProjPrefab.missile_smart_mini: weapon = ProjPrefab.missile_smart; break; } var de = new DamageEvent { attacker = di.owner?.GetComponent <Player>(), weapon = weapon, damage = (hitpoints - damage_scaled <= 0f) ? hitpoints : damage_scaled }; ServerDamageLog.AddDamage(playerShip.c_player.netId, de); }