Player's voiceFixed

Hi, are you hearing player voices properly after the update? I'm hearing a robotic voice that's repeating itself multiple times, overlapping each other.

It continues until I exit and enter Vanish again.

I have this... But I didn't think it was associated with the plugin. Hmmmm.

Merged post

Server restarted. This problem isn't happening anymore. Not sure if it was the plugin or not.

Merged post

Other server restarted and this issue is back.

I wouldn't connect this if the problem didn't disappear after exiting/entering Vanish

Hello,
I have same problem:

robotic voice that's repeating itself multiple times, overlapping each other.

 

can we confirm its related to the update?

Same problem, seems that when vanish removes you from networking to limit voice while in vanish, when you unvanish it's not connecting you back into the network properly. 

@Whispers88

when you enter spectate while Vanish is enabled, incoming voice gets duplicated (a “robot voice” effect — the same voice plays on top of itself multiple times, sometimes with different speed/pitch).

The cause seems to be the Harmony patch:

[HarmonyPatch(typeof(BaseNetworkable), "GetConnectionsWithin"...)]

It adds vanished players’ connections to __result as recipients for “voices/sounds”.
But in spectate, Rust already routes voice to the spectator via its own mechanism (through the spectate target / secondary connections). Because of that, Vanish ends up making the spectator receive a second copy of the same voice packets → resulting in layered/duplicated audio.

Fix: in the GetConnectionsWithin patch, don’t add the vanished connection if that player is currently spectating:

 
if (vanishPlayer.IsSpectating() || vanishPlayer.HasPlayerFlag(BasePlayer.PlayerFlags.Spectating)) return;

(or equivalently, skip adding to __result for spectators to avoid the “second channel”).

I think we're talking two different things? Are you talking about when you F1 into spectate to see first person view of a player?

I'm not in spectate mode, I'm just next to the players talking in game, visible, with normal gameplay. Then at some point, I start to get feedback from their audio and it's like round-robin singing. It also catches a phrase and repeats it until they say something new. If I revert to 2.0.3, or whatever the version is before the fix for Deep Sea mechanics, it doesn't happen. It's not happening to players where Vanish permissions are not assigned. It's only to those with vanish.allow permissions.

After changing it like this, it worked. I had an AI put it together, so I’m not sure why it works, though.
 
            [HarmonyPostfix]
            private static void Postfix(BaseNetworkable __instance, ref List<Connection> __result, Vector3 position, float distance, bool addSecondaryConnections, bool useRcEntityPosition, bool includeInvisPlayers)
            {
                if (__result == null)
                    return;

                // Deduplicate recipients aggressively. Duplicate connections here can produce
                // robot-like overlapping voice packets for a single listener.
                HashSet<ulong> seenUserIds = new HashSet<ulong>();
                for (int i = __result.Count - 1; i >= 0; i--)
                {
                    Connection connection = __result[i];
                    if (connection == null || !connection.connected || connection.player == null || !seenUserIds.Add(connection.userid))
                        __result.RemoveAt(i);
                }

                if (_hiddenPlayers.Count == 0)
                    return;

                float maxDistanceSqr = distance * distance;
                foreach (var vanishPlayer in _hiddenPlayers)
                {
                    if (vanishPlayer == null || !vanishPlayer.IsConnected || !vanishPlayer._limitedNetworking)
                        continue;

                    // Spectate connection routing is already handled by Rust.
                    // Adding vanished spectators here can duplicate voice packets.
                    if (vanishPlayer.IsSpectating() || vanishPlayer.HasPlayerFlag(BasePlayer.PlayerFlags.Spectating))
                        continue;

                    Connection connection = vanishPlayer.Connection;
                    if (connection == null || !connection.connected || connection.player == null)
                        continue;

                    if ((position - vanishPlayer.transform.position).sqrMagnitude > maxDistanceSqr)
                        continue;

                    if (!seenUserIds.Add(connection.userid))
                        continue;

                    __result.Add(connection);
                }
            }
        }

This fix seemed to work for a whole day for me - its back to being bugged now:(

tokochan
After changing it like this, it worked. I had an AI put it together, so I’m not sure why it works, though.
 
            [HarmonyPostfix]
            private static void Postfix(BaseNetworkable __instance, ref List<Connection> __result, Vector3 position, float distance, bool addSecondaryConnections, bool useRcEntityPosition, bool includeInvisPlayers)
            {
                if (__result == null)
                    return;

                // Deduplicate recipients aggressively. Duplicate connections here can produce
                // robot-like overlapping voice packets for a single listener.
                HashSet<ulong> seenUserIds = new HashSet<ulong>();
                for (int i = __result.Count - 1; i >= 0; i--)
                {
                    Connection connection = __result[i];
                    if (connection == null || !connection.connected || connection.player == null || !seenUserIds.Add(connection.userid))
                        __result.RemoveAt(i);
                }

                if (_hiddenPlayers.Count == 0)
                    return;

                float maxDistanceSqr = distance * distance;
                foreach (var vanishPlayer in _hiddenPlayers)
                {
                    if (vanishPlayer == null || !vanishPlayer.IsConnected || !vanishPlayer._limitedNetworking)
                        continue;

                    // Spectate connection routing is already handled by Rust.
                    // Adding vanished spectators here can duplicate voice packets.
                    if (vanishPlayer.IsSpectating() || vanishPlayer.HasPlayerFlag(BasePlayer.PlayerFlags.Spectating))
                        continue;

                    Connection connection = vanishPlayer.Connection;
                    if (connection == null || !connection.connected || connection.player == null)
                        continue;

                    if ((position - vanishPlayer.transform.position).sqrMagnitude > maxDistanceSqr)
                        continue;

                    if (!seenUserIds.Add(connection.userid))
                        continue;

                    __result.Add(connection);
                }
            }
        }

Yes! It works!

Same problem with Oxide. Can you fix it?

Still having this problem. Also running oxide