From b1ccdb7238bfaeece193190e86672210dd61b642 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 16 May 2022 23:31:51 +1000 Subject: [PATCH] Fix playglobalsound volume (#8208) --- .../Commands/PlayGlobalSound.cs | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Content.Server/Administration/Commands/PlayGlobalSound.cs b/Content.Server/Administration/Commands/PlayGlobalSound.cs index b42abbee61..7813d8c906 100644 --- a/Content.Server/Administration/Commands/PlayGlobalSound.cs +++ b/Content.Server/Administration/Commands/PlayGlobalSound.cs @@ -52,21 +52,30 @@ public sealed class PlayGlobalSound : IConsoleCommand return; } - filter = Filter.Empty(); - - // Skip the first argument, which is the sound path. - for (var i = 1 + volumeOffset; i < args.Length; i++) + // No users specified so play for them all. + if (args.Length == 2) { - var username = args[i]; - - if (!_playerManager.TryGetSessionByUsername(username, out var session)) - { - shell.WriteError(Loc.GetString("play-global-sound-command-player-not-found", ("username", username))); - continue; - } - - filter.AddPlayer(session); + filter = Filter.Empty().AddAllPlayers(_playerManager); } + else + { + filter = Filter.Empty(); + + // Skip the first argument, which is the sound path. + for (var i = 1 + volumeOffset; i < args.Length; i++) + { + var username = args[i]; + + if (!_playerManager.TryGetSessionByUsername(username, out var session)) + { + shell.WriteError(Loc.GetString("play-global-sound-command-player-not-found", ("username", username))); + continue; + } + + filter.AddPlayer(session); + } + } + break; }