-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,081 changed files
with
10,802 additions
and
4,677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
{ | ||
"omnisharp.analyzeOpenDocumentsOnly": true, | ||
"dotnet.defaultSolution": "SpaceStation14.sln" | ||
"dotnet.defaultSolution": "SpaceStation14.sln", | ||
"json.schemas": [ | ||
{ | ||
"fileMatch": [ "**/meta.json" ], | ||
"url": "https://raw.githubusercontent.com/Simple-Station/Einstein-Engines/master/.github/rsi-schema.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using Content.Client.Audio; | ||
using Content.Shared.Announcements.Events; | ||
using Content.Shared.Announcements.Systems; | ||
using Content.Shared.CCVar; | ||
using Robust.Client.Audio; | ||
using Robust.Client.Player; | ||
using Robust.Client.ResourceManagement; | ||
using Robust.Shared.Audio.Sources; | ||
using Robust.Shared.Audio.Systems; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Client.Announcements.Systems; | ||
|
||
public sealed class AnnouncerSystem : SharedAnnouncerSystem | ||
{ | ||
[Dependency] private readonly IPlayerManager _player = default!; | ||
[Dependency] private readonly IConfigurationManager _config = default!; | ||
[Dependency] private readonly IResourceCache _cache = default!; | ||
[Dependency] private readonly IAudioManager _audioManager = default!; | ||
|
||
private IAudioSource? AnnouncerSource { get; set; } | ||
private float AnnouncerVolume { get; set; } | ||
|
||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
AnnouncerVolume = _config.GetCVar(CCVars.AnnouncerVolume) * 100f / ContentAudioSystem.AnnouncerMultiplier; | ||
|
||
SubscribeNetworkEvent<AnnouncementSendEvent>(OnAnnouncementReceived); | ||
_config.OnValueChanged(CCVars.AnnouncerVolume, OnAnnouncerVolumeChanged); | ||
} | ||
|
||
public override void Shutdown() | ||
{ | ||
base.Shutdown(); | ||
|
||
_config.UnsubValueChanged(CCVars.AnnouncerVolume, OnAnnouncerVolumeChanged); | ||
} | ||
|
||
|
||
private void OnAnnouncerVolumeChanged(float value) | ||
{ | ||
AnnouncerVolume = value; | ||
|
||
if (AnnouncerSource != null) | ||
AnnouncerSource.Gain = AnnouncerVolume; | ||
} | ||
|
||
private void OnAnnouncementReceived(AnnouncementSendEvent ev) | ||
{ | ||
if (!ev.Recipients.Contains(_player.LocalSession!.UserId) | ||
|| !_cache.TryGetResource<AudioResource>(GetAnnouncementPath(ev.AnnouncementId, ev.AnnouncerId), | ||
out var resource)) | ||
return; | ||
|
||
var source = _audioManager.CreateAudioSource(resource); | ||
if (source != null) | ||
{ | ||
source.Gain = AnnouncerVolume * SharedAudioSystem.VolumeToGain(ev.AudioParams.Volume); | ||
source.Global = true; | ||
} | ||
|
||
AnnouncerSource?.Dispose(); | ||
AnnouncerSource = source; | ||
AnnouncerSource?.StartPlaying(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.