]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Admin New Player Notification Sound (#24327)
authorDEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>
Sun, 24 Mar 2024 02:46:45 +0000 (19:46 -0700)
committerGitHub <noreply@github.com>
Sun, 24 Mar 2024 02:46:45 +0000 (13:46 +1100)
play a sound to active admins when a new player joins

Content.Server/GameTicking/GameTicker.Player.cs
Content.Shared/CCVar/CCVars.cs
Resources/Audio/Effects/attributions.yml
Resources/Audio/Effects/newplayerping.ogg [new file with mode: 0644]

index 6deda4958358eb337f31a0c0f5a9438208cfd63a..7cafc06b3dc1411c8fd43d3b353cb41e457d6ee6 100644 (file)
@@ -1,10 +1,13 @@
 using Content.Server.Database;
+using Content.Shared.CCVar;
 using Content.Shared.GameTicking;
 using Content.Shared.GameWindow;
 using Content.Shared.Players;
 using Content.Shared.Preferences;
 using JetBrains.Annotations;
 using Robust.Server.Player;
+using Robust.Shared.Audio;
+using Robust.Shared.Audio.Systems;
 using Robust.Shared.Enums;
 using Robust.Shared.Player;
 using Robust.Shared.Timing;
@@ -17,6 +20,7 @@ namespace Content.Server.GameTicking
     {
         [Dependency] private readonly IPlayerManager _playerManager = default!;
         [Dependency] private readonly IServerDbManager _dbManager = default!;
+        [Dependency] private readonly SharedAudioSystem _audioSystem = default!;
 
         private void InitializePlayer()
         {
@@ -68,6 +72,11 @@ namespace Content.Server.GameTicking
 
                     RaiseNetworkEvent(GetConnectionStatusMsg(), session.Channel);
 
+                    if (firstConnection && _configurationManager.GetCVar(CCVars.AdminNewPlayerJoinSound))
+                        _audioSystem.PlayGlobal(new SoundPathSpecifier("/Audio/Effects/newplayerping.ogg"),
+                            Filter.Empty().AddPlayers(_adminManager.ActiveAdmins), false,
+                            audioParams: new AudioParams { Volume = -5f });
+
                     if (LobbyEnabled && _roundStartCountdownHasNotStartedYetDueToNoPlayers)
                     {
                         _roundStartCountdownHasNotStartedYetDueToNoPlayers = false;
index 8a592d4b3073230960be18ca7a5ec60625ee94dd..51f782991e971b71dec4cc016b20cb7d3715ef41 100644 (file)
@@ -779,6 +779,12 @@ namespace Content.Shared.CCVar
         public static readonly CVarDef<bool> SeeOwnNotes =
             CVarDef.Create("admin.see_own_notes", false, CVar.ARCHIVE | CVar.REPLICATED | CVar.SERVER);
 
+        /// <summary>
+        /// Should the server play a quick sound to the active admins whenever a new player joins?
+        /// </summary>
+        public static readonly CVarDef<bool> AdminNewPlayerJoinSound =
+            CVarDef.Create("admin.new_player_join_sound", false, CVar.SERVERONLY);
+
         /// <summary>
         /// The amount of days before the note starts fading. It will slowly lose opacity until it reaches stale. Set to 0 to disable.
         /// </summary>
index f8568718461661dfa131179913d76216dfaef7f9..a5f91ef10c68fececcbb40b721756bf953419a9a 100644 (file)
   copyright: Bhijn and Myr (github username deathride58)
   license: CC0-1.0
   source: https://github.com/space-wizards/space-station-14/pull/23212
+
+- files: ["newplayerping.ogg"]
+  copyright: TGStation at 3df5d3b42bfb6b3b5adba1067ab41f83816255bb
+  license: CC-BY-SA-3.0
+  source: https://github.com/tgstation/tgstation/blob/3df5d3b42bfb6b3b5adba1067ab41f83816255bb/sound/misc/server-ready.ogg
diff --git a/Resources/Audio/Effects/newplayerping.ogg b/Resources/Audio/Effects/newplayerping.ogg
new file mode 100644 (file)
index 0000000..216533b
Binary files /dev/null and b/Resources/Audio/Effects/newplayerping.ogg differ