Fix playglobalsound volume (#8208)

This commit is contained in:
metalgearsloth
2022-05-16 23:31:51 +10:00
committed by GitHub
parent 644277bf6f
commit b1ccdb7238

View File

@@ -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;
}