Still allow lock/unlock/practice while sv_chat_initial_delay is set

Not sure if we should just allow them whenever someone is muted

Fixes #3929
This commit is contained in:
def 2021-06-23 08:51:11 +02:00
parent d3e7306457
commit 29c95bc0a2
3 changed files with 6 additions and 6 deletions

View file

@ -600,7 +600,7 @@ void CGameContext::ConPractice(IConsole::IResult *pResult, void *pUserData)
if(!pPlayer)
return;
if(pSelf->ProcessSpamProtection(pResult->m_ClientID))
if(pSelf->ProcessSpamProtection(pResult->m_ClientID, false))
return;
if(!g_Config.m_SvPractice)
@ -866,7 +866,7 @@ void CGameContext::ConLockTeam(IConsole::IResult *pResult, void *pUserData)
return;
}
if(pSelf->ProcessSpamProtection(pResult->m_ClientID))
if(pSelf->ProcessSpamProtection(pResult->m_ClientID, false))
return;
char aBuf[512];
@ -904,7 +904,7 @@ void CGameContext::ConUnlockTeam(IConsole::IResult *pResult, void *pUserData)
if(Team <= TEAM_FLOCK || Team >= TEAM_SUPER)
return;
if(pSelf->ProcessSpamProtection(pResult->m_ClientID))
if(pSelf->ProcessSpamProtection(pResult->m_ClientID, false))
return;
pSelf->UnlockTeam(pResult->m_ClientID, Team);

View file

@ -3733,7 +3733,7 @@ void CGameContext::SendRecord(int ClientID)
}
}
int CGameContext::ProcessSpamProtection(int ClientID)
int CGameContext::ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay)
{
if(!m_apPlayers[ClientID])
return 0;
@ -3751,7 +3751,7 @@ int CGameContext::ProcessSpamProtection(int ClientID)
Server()->GetClientAddr(ClientID, &Addr);
int Muted = 0;
if(m_apPlayers[ClientID]->m_JoinTick > m_NonEmptySince + 10 * Server()->TickSpeed())
if(m_apPlayers[ClientID]->m_JoinTick > m_NonEmptySince + 10 * Server()->TickSpeed() && RespectChatInitialDelay)
Muted = (m_apPlayers[ClientID]->m_JoinTick + Server()->TickSpeed() * g_Config.m_SvChatInitialDelay - Server()->Tick()) / Server()->TickSpeed();
if(Muted <= 0)
{

View file

@ -274,7 +274,7 @@ public:
// DDRace
bool OnClientDDNetVersionKnown(int ClientID);
virtual void FillAntibot(CAntibotRoundData *pData);
int ProcessSpamProtection(int ClientID);
int ProcessSpamProtection(int ClientID, bool RespectChatInitialDelay = true);
int GetDDRaceTeam(int ClientID);
// Describes the time when the first player joined the server.
int64 m_NonEmptySince;