1
0

Fixed some death messages showing up even when they are disabled. (#5153)

This commit is contained in:
NiLSPACE 2021-03-11 22:26:35 +01:00 committed by GitHub
parent 01a4e696b3
commit c729d7abde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -186,6 +186,11 @@ void cWorld::BroadcastBossBarUpdateHealth(const cEntity & a_Entity, UInt32 a_Uni
void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude, eMessageType a_ChatPrefix)
{
if ((a_ChatPrefix == mtDeath) && !ShouldBroadcastDeathMessages())
{
return;
}
ForClientsInWorld(*this, a_Exclude, [&](cClientHandle & a_Client)
{
a_Client.SendChat(a_Message, a_ChatPrefix);

View File

@ -809,7 +809,7 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
SaveToDisk(); // Save it, yeah the world is a tough place !
cPluginManager * PluginManager = cRoot::Get()->GetPluginManager();
if ((a_TDI.Attacker == nullptr) && m_World->ShouldBroadcastDeathMessages())
if (a_TDI.Attacker == nullptr)
{
const AString DamageText = [&]
{
@ -845,10 +845,6 @@ void cPlayer::KilledBy(TakeDamageInfo & a_TDI)
GetWorld()->BroadcastChatDeath(DeathMessage);
}
}
else if (a_TDI.Attacker == nullptr) // && !m_World->ShouldBroadcastDeathMessages() by fallthrough
{
// no-op
}
else if (a_TDI.Attacker->IsPlayer())
{
cPlayer * Killer = static_cast<cPlayer *>(a_TDI.Attacker);