Skip to content

Commit

Permalink
Mirror: Admin New Player Notification Sound (#318)
Browse files Browse the repository at this point in the history
## Mirror of PR #24327: [Admin New Player Notification
Sound](space-wizards/space-station-14#24327)
from <img src="https://avatars.githubusercontent.com/u/10567778?v=4"
alt="space-wizards" width="22"/>
[space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14)

###### `b9db06ebb1af41f2809f6c31dc4990b6a729d041`

PR opened by <img
src="https://avatars.githubusercontent.com/u/77995199?v=4"
width="16"/><a href="https://github.com/DEATHB4DEFEAT">
DEATHB4DEFEAT</a> at 2024-01-20 06:59:20 UTC

---

PR changed 4 files with 20 additions and 0 deletions.

The PR had the following labels:
- Status: Needs Review


---

<details open="true"><summary><h1>Original Body</h1></summary>

> # Description
> 
> Ported from Parkstation.
> Adds a brief sound that plays whenever a player joins for the first
time.
> 
> # Media
> 
>
https://github.com/space-wizards/space-station-14/assets/77995199/278da9f3-98c9-4fd3-ab06-624ff024022b
> 


</details>

Co-authored-by: SimpleStation14 <Unknown>
  • Loading branch information
SimpleStation14 authored May 5, 2024
1 parent 2ccbdd3 commit afe9415
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Content.Server/GameTicking/GameTicker.Player.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,6 +20,7 @@ public sealed partial class GameTicker
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IServerDbManager _dbManager = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;

private void InitializePlayer()
{
Expand Down Expand Up @@ -69,6 +73,11 @@ private async void PlayerStatusChanged(object? sender, SessionStatusEventArgs ar

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;
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,12 @@ public static readonly CVarDef<bool>
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>
Expand Down
5 changes: 5 additions & 0 deletions Resources/Audio/Effects/attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 added Resources/Audio/Effects/newplayerping.ogg
Binary file not shown.

0 comments on commit afe9415

Please sign in to comment.