diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 201fff405..cd2d87d5a 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -847,14 +847,31 @@ void CCharacter::TickDefered() GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf); } - int Events = m_Core.m_TriggeredEvents; - //int Mask = CmaskAllExceptOne(m_pPlayer->GetCID()); + { + int Events = m_Core.m_TriggeredEvents; + int CID = m_pPlayer->GetCID(); - if(Events&COREEVENT_GROUND_JUMP) GameServer()->CreateSound(m_Pos, SOUND_PLAYER_JUMP, Teams()->TeamMask(Team(), m_pPlayer->GetCID())); + int64 TeamMask = Teams()->TeamMask(Team(), -1, CID); + // Some sounds are triggered client-side for the acting player + // so we need to avoid duplicating them + int64 TeamMaskExceptSelf = Teams()->TeamMask(Team(), CID, CID); + // Some are triggered client-side but only on Sixup + int64 TeamMaskExceptSelfIfSixup = Server()->IsSixup(CID) + ? TeamMaskExceptSelf + : TeamMask; - if(Events&COREEVENT_HOOK_ATTACH_PLAYER && !Server()->IsSixup(m_pPlayer->GetCID())) GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_PLAYER, Teams()->TeamMask(Team(), -1, m_pPlayer->GetCID())); - if(Events&COREEVENT_HOOK_ATTACH_GROUND) GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_GROUND, Teams()->TeamMask(Team(), m_pPlayer->GetCID(), m_pPlayer->GetCID())); - if(Events&COREEVENT_HOOK_HIT_NOHOOK) GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, Teams()->TeamMask(Team(), m_pPlayer->GetCID(), m_pPlayer->GetCID())); + if(Events&COREEVENT_GROUND_JUMP) + GameServer()->CreateSound(m_Pos, SOUND_PLAYER_JUMP, TeamMaskExceptSelf); + + if(Events&COREEVENT_HOOK_ATTACH_PLAYER) + GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_PLAYER, TeamMaskExceptSelfIfSixup); + + if(Events&COREEVENT_HOOK_ATTACH_GROUND) + GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_GROUND, TeamMaskExceptSelf); + + if(Events&COREEVENT_HOOK_HIT_NOHOOK) + GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, TeamMaskExceptSelf); + } if(m_pPlayer->GetTeam() == TEAM_SPECTATORS)