Team Say refactory/enhancement (#1042)

Disable say_team when FFA mode is enabled
Only for CT and T, Spectators can still use say_team
This commit is contained in:
Francisco Muñoz 2025-03-27 19:09:24 -03:00 committed by GitHub
parent 756deb1ea9
commit 6adb795fee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -841,6 +841,12 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
char *pszConsoleFormat = nullptr; char *pszConsoleFormat = nullptr;
bool consoleUsesPlaceName = false; bool consoleUsesPlaceName = false;
#ifdef REGAMEDLL_ADD
// there's no team on FFA mode
if (teamonly && CSGameRules()->IsFreeForAll() && (pPlayer->m_iTeam == CT || pPlayer->m_iTeam == TERRORIST))
teamonly = FALSE;
#endif
// team only // team only
if (teamonly) if (teamonly)
{ {
@ -995,7 +1001,13 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
if (gpGlobals->deathmatch != 0.0f && CSGameRules()->m_VoiceGameMgr.PlayerHasBlockedPlayer(pReceiver, pPlayer)) if (gpGlobals->deathmatch != 0.0f && CSGameRules()->m_VoiceGameMgr.PlayerHasBlockedPlayer(pReceiver, pPlayer))
continue; continue;
if (teamonly && pReceiver->m_iTeam != pPlayer->m_iTeam) if (teamonly
#ifdef REGAMEDLL_FIXES
&& CSGameRules()->PlayerRelationship(pPlayer, pReceiver) != GR_TEAMMATE
#else
&& pReceiver->m_iTeam != pPlayer->m_iTeam
#endif
)
continue; continue;
if ( if (
@ -1008,7 +1020,13 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
continue; continue;
} }
if ((pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_ENEMY && pReceiver->m_iTeam == pPlayer->m_iTeam) if ((pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_ENEMY
#ifdef REGAMEDLL_FIXES
&& CSGameRules()->PlayerRelationship(pPlayer, pReceiver) == GR_TEAMMATE
#else
&& pReceiver->m_iTeam == pPlayer->m_iTeam
#endif
)
|| pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_NONE) || pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_NONE)
{ {
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, nullptr, pReceiver->pev); MESSAGE_BEGIN(MSG_ONE, gmsgSayText, nullptr, pReceiver->pev);