Make playglobalsound much quiter (#7910)
* Make playglobalsound default much quieter Also adds volume override. * tweak * reviews by the cutest gradient girl
This commit is contained in:
@@ -21,6 +21,7 @@ public sealed class PlayGlobalSound : IConsoleCommand
|
|||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
Filter filter;
|
Filter filter;
|
||||||
|
var audio = AudioParams.Default.WithVolume(-8);
|
||||||
|
|
||||||
switch (args.Length)
|
switch (args.Length)
|
||||||
{
|
{
|
||||||
@@ -37,10 +38,24 @@ public sealed class PlayGlobalSound : IConsoleCommand
|
|||||||
|
|
||||||
// One or more users specified.
|
// One or more users specified.
|
||||||
default:
|
default:
|
||||||
|
var volumeOffset = 0;
|
||||||
|
|
||||||
|
// Try to specify a new volume to play it at.
|
||||||
|
if (int.TryParse(args[1], out var volume))
|
||||||
|
{
|
||||||
|
audio = audio.WithVolume(volume);
|
||||||
|
volumeOffset = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shell.WriteError(Loc.GetString("play-global-sound-command-volume-parse", ("volume", args[1])));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
filter = Filter.Empty();
|
filter = Filter.Empty();
|
||||||
|
|
||||||
// Skip the first argument, which is the sound path.
|
// Skip the first argument, which is the sound path.
|
||||||
for (var i = 1; i < args.Length; i++)
|
for (var i = 1 + volumeOffset; i < args.Length; i++)
|
||||||
{
|
{
|
||||||
var username = args[i];
|
var username = args[i];
|
||||||
|
|
||||||
@@ -55,6 +70,6 @@ public sealed class PlayGlobalSound : IConsoleCommand
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundSystem.Play(filter, args[0], AudioParams.Default);
|
SoundSystem.Play(filter, args[0], audio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
play-global-sound-command-description = Plays a global sound for a specific player or for every connected player if no players are specified.
|
play-global-sound-command-description = Plays a global sound for a specific player or for every connected player if no players are specified.
|
||||||
play-global-sound-command-help = playglobalsound <path> [user 1] ... [user n]
|
play-global-sound-command-help = playglobalsound <path> [volume] [user 1] ... [user n]
|
||||||
play-global-sound-command-player-not-found = Player "{$username}" not found.
|
play-global-sound-command-player-not-found = Player "{$username}" not found.
|
||||||
|
play-global-sound-command-volume-parse = Invalid volume of {$volume} specified.
|
||||||
|
|||||||
Reference in New Issue
Block a user