mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Make spectators hear the same thing as the player they spectate
This commit is contained in:
parent
af8fac1bac
commit
c85d7bcc0f
|
@ -42,14 +42,14 @@ void CEventHandler::Clear()
|
|||
|
||||
void CEventHandler::Snap(int SnappingClient)
|
||||
{
|
||||
bool IsSpectator = false;
|
||||
if (SnappingClient != -1 && GameServer()->m_apPlayers[SnappingClient]->m_Paused)
|
||||
SnappingClient = GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID;
|
||||
for(int i = 0; i < m_NumEvents; i++)
|
||||
{
|
||||
IsSpectator = (SnappingClient == -1 || GameServer()->m_apPlayers[SnappingClient]->m_Paused >= CPlayer::PAUSED_PAUSED);
|
||||
if(IsSpectator || CmaskIsSet(m_aClientMasks[i], SnappingClient))
|
||||
if(SnappingClient == -1 || CmaskIsSet(m_aClientMasks[i], SnappingClient))
|
||||
{
|
||||
CNetEvent_Common *ev = (CNetEvent_Common *)&m_aData[m_aOffsets[i]];
|
||||
if(IsSpectator || distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, vec2(ev->m_X, ev->m_Y)) < 1500.0f)
|
||||
if(SnappingClient == -1 || distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, vec2(ev->m_X, ev->m_Y)) < 1500.0f)
|
||||
{
|
||||
void *d = GameServer()->Server()->SnapNewItem(m_aTypes[i], i, m_aSizes[i]);
|
||||
if(d)
|
||||
|
|
Loading…
Reference in a new issue