mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2024-12-27 07:05:38 +03:00
Refactor CanPlayerHearPlayer (#192)
This commit is contained in:
parent
d7170431ce
commit
fe1b130728
@ -103,31 +103,20 @@ bool CCStrikeGameMgrHelper::CanPlayerHearPlayer(CBasePlayer *pListener, CBasePla
|
|||||||
#ifndef REGAMEDLL_FIXES
|
#ifndef REGAMEDLL_FIXES
|
||||||
!pSender->IsPlayer() ||
|
!pSender->IsPlayer() ||
|
||||||
#endif
|
#endif
|
||||||
pListener->m_iTeam != pSender->m_iTeam)
|
pListener->m_iTeam != pSender->m_iTeam) // Different teams can't hear each other
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pListener->IsObserver()) // 2 spectators don't need isAlive() checks.
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL bListenerAlive = pListener->IsAlive();
|
BOOL bListenerAlive = pListener->IsAlive();
|
||||||
BOOL bSenderAlive = pSender->IsAlive();
|
BOOL bSenderAlive = pSender->IsAlive();
|
||||||
|
|
||||||
if (pListener->IsObserver())
|
return (bListenerAlive == bSenderAlive || bSenderAlive); // Dead/alive voice chats are separated, but dead can hear alive.
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bListenerAlive)
|
|
||||||
{
|
|
||||||
if (!bSenderAlive)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bSenderAlive)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (bListenerAlive == bSenderAlive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Broadcast(const char *sentence)
|
void Broadcast(const char *sentence)
|
||||||
|
Loading…
Reference in New Issue
Block a user