Admin New Player Notification Sound (#24327)

play a sound to active admins when a new player joins
This commit is contained in:
DEATHB4DEFEAT
2024-03-23 19:46:45 -07:00
committed by GitHub
parent 5ba5815a96
commit b9db06ebb1
4 changed files with 20 additions and 0 deletions

View 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;

View 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>

View File

@@ -216,3 +216,8 @@
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

Binary file not shown.