diff --git a/Content.Server/AlertLevel/AlertLevelSystem.cs b/Content.Server/AlertLevel/AlertLevelSystem.cs index bc02808e7d0..b3ca3ced589 100644 --- a/Content.Server/AlertLevel/AlertLevelSystem.cs +++ b/Content.Server/AlertLevel/AlertLevelSystem.cs @@ -6,6 +6,7 @@ using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Prototypes; +using Robust.Shared.Player; // DeltaV namespace Content.Server.AlertLevel; @@ -191,7 +192,8 @@ public sealed class AlertLevelSystem : EntitySystem { if (detail.Sound != null) { - var filter = _stationSystem.GetInOwningStation(station); + //var filter = _stationSystem.GetInOwningStation(station); // DeltaV - Global Annoucements + var filter = Filter.Empty().AddAllPlayers(); // DeltaV - Global Annoucements _audio.PlayGlobal(detail.Sound, filter, true, detail.Sound.Params); } else @@ -202,7 +204,7 @@ public sealed class AlertLevelSystem : EntitySystem if (announce) { - _chatSystem.DispatchStationAnnouncement(station, announcementFull, playDefaultSound: playDefault, + _chatSystem.DispatchGlobalAnnouncement(announcementFull, playSound: playDefault, // DeltaV - Global Annoucements colorOverride: detail.Color, sender: stationName); } diff --git a/Content.Server/Audio/ServerGlobalSoundSystem.cs b/Content.Server/Audio/ServerGlobalSoundSystem.cs index c54cafc8c53..d272da5c4f2 100644 --- a/Content.Server/Audio/ServerGlobalSoundSystem.cs +++ b/Content.Server/Audio/ServerGlobalSoundSystem.cs @@ -7,7 +7,7 @@ using Robust.Shared.Player; namespace Content.Server.Audio; -public sealed class ServerGlobalSoundSystem : SharedGlobalSoundSystem +public sealed partial class ServerGlobalSoundSystem : SharedGlobalSoundSystem // DeltaV - Made Partial { [Dependency] private readonly IConsoleHost _conHost = default!; [Dependency] private readonly StationSystem _stationSystem = default!; diff --git a/Content.Server/Nuke/NukeSystem.cs b/Content.Server/Nuke/NukeSystem.cs index 130cc196562..186b50072fa 100644 --- a/Content.Server/Nuke/NukeSystem.cs +++ b/Content.Server/Nuke/NukeSystem.cs @@ -327,15 +327,15 @@ public sealed class NukeSystem : EntitySystem // should play if (nuke.RemainingTime <= _nukeSongLength + nuke.AlertSoundTime + NukeSongBuffer && !nuke.PlayedNukeSong && !ResolvedSoundSpecifier.IsNullOrEmpty(_selectedNukeSong)) { - _sound.DispatchStationEventMusic(uid, _selectedNukeSong, StationEventMusicType.Nuke); + _sound.DispatchGlobalEventMusic(_selectedNukeSong, StationEventMusicType.Nuke); // DeltaV - Global Nuke Music nuke.PlayedNukeSong = true; } // play alert sound if time is running out if (nuke.RemainingTime <= nuke.AlertSoundTime && !nuke.PlayedAlertSound) { - _sound.PlayGlobalOnStation(uid, _audio.ResolveSound(nuke.AlertSound), new AudioParams{Volume = -5f}); - _sound.StopStationEventMusic(uid, StationEventMusicType.Nuke); + _sound.PlayGlobal(_audio.ResolveSound(nuke.AlertSound), new AudioParams { Volume = -5f }); // DeltaV - Global Nuke SFX + _sound.StopGlobalEventMusic(StationEventMusicType.Nuke); // DeltaV - Global Nuke Music nuke.PlayedAlertSound = true; UpdateAppearance(uid, nuke); } @@ -504,9 +504,9 @@ public sealed class NukeSystem : EntitySystem ("time", (int) component.RemainingTime), ("location", FormattedMessage.RemoveMarkupOrThrow(_navMap.GetNearestBeaconString((uid, nukeXform))))); var sender = Loc.GetString("nuke-component-announcement-sender"); - _chatSystem.DispatchStationAnnouncement(stationUid ?? uid, announcement, sender, false, null, Color.Red); + _chatSystem.DispatchGlobalAnnouncement(announcement, sender, false, null, Color.Red); // DeltaV - Global Nuke Annoucement - _sound.PlayGlobalOnStation(uid, _audio.ResolveSound(component.ArmSound)); + _sound.PlayGlobal(_audio.ResolveSound(component.ArmSound)); // DeltaV - Global Nuke Music _nukeSongLength = (float) _audio.GetAudioLength(_selectedNukeSong).TotalSeconds; // turn on the spinny light @@ -544,11 +544,11 @@ public sealed class NukeSystem : EntitySystem // warn a crew var announcement = Loc.GetString("nuke-component-announcement-unarmed"); var sender = Loc.GetString("nuke-component-announcement-sender"); - _chatSystem.DispatchStationAnnouncement(uid, announcement, sender, false); + _chatSystem.DispatchGlobalAnnouncement(announcement, sender, false); // DeltaV - Global Nuke Announcement component.PlayedNukeSong = false; - _sound.PlayGlobalOnStation(uid, _audio.ResolveSound(component.DisarmSound)); - _sound.StopStationEventMusic(uid, StationEventMusicType.Nuke); + _sound.PlayGlobal(_audio.ResolveSound(component.DisarmSound)); // DeltaV - Global Nuke SFX + _sound.StopGlobalEventMusic(StationEventMusicType.Nuke); // DeltaV - Global Nuke Music // reset nuke remaining time to either itself or the minimum time, whichever is higher component.RemainingTime = Math.Max(component.RemainingTime, component.MinimumTime); @@ -610,7 +610,7 @@ public sealed class NukeSystem : EntitySystem OwningStation = transform.GridUid, }); - _sound.StopStationEventMusic(uid, StationEventMusicType.Nuke); + _sound.StopGlobalEventMusic(StationEventMusicType.Nuke); // DeltaV - Global Nuke Music Del(uid); } diff --git a/Content.Server/_DV/Audio/ServerGlobalSoundSystem.cs b/Content.Server/_DV/Audio/ServerGlobalSoundSystem.cs new file mode 100644 index 00000000000..94ae78d403e --- /dev/null +++ b/Content.Server/_DV/Audio/ServerGlobalSoundSystem.cs @@ -0,0 +1,73 @@ +using Content.Shared.Audio; +using Robust.Shared.Audio; +using Robust.Shared.Player; +using Robust.Shared.Map; + +namespace Content.Server.Audio; + +/// +/// Extends upstream's Content.Server/Audio/ServerGlobalSoundSystem.cs. +/// +public sealed partial class ServerGlobalSoundSystem +{ + /// + /// DeltaV - Plays a sound globally for all players, no matter where they are. + /// + /// + /// + public void PlayGlobal(ResolvedSoundSpecifier specifier, AudioParams? audioParams = null) + { + var msg = new GameGlobalSoundEvent(specifier, audioParams); + RaiseNetworkEvent(msg); + } + + public void StopGlobalEventMusic(StationEventMusicType type) + { + var msg = new StopStationEventMusic(type); + RaiseNetworkEvent(msg); + } + + public void DispatchGlobalEventMusic(SoundSpecifier sound, StationEventMusicType type) + { + DispatchGlobalEventMusic(_audio.ResolveSound(sound), type); + } + + public void DispatchGlobalEventMusic(ResolvedSoundSpecifier specifier, StationEventMusicType type) + { + var audio = AudioParams.Default.WithVolume(-8); + var msg = new StationEventMusicEvent(specifier, type, audio); + RaiseNetworkEvent(msg); + } + + /// + /// DeltaV - Plays a sound globally for all players on a specified Map. + /// + /// + /// + public void PlayGlobalOnMap(MapId map, ResolvedSoundSpecifier specifier, AudioParams? audioParams = null) + { + var msg = new GameGlobalSoundEvent(specifier, audioParams); + var filter = Filter.Empty().AddInMap(map); + RaiseNetworkEvent(msg, filter); + } + + public void StopMapEventMusic(MapId map, StationEventMusicType type) + { + var msg = new StopStationEventMusic(type); + var filter = Filter.Empty().AddInMap(map); + RaiseNetworkEvent(msg, filter); + } + + public void DispatchMapEventMusic(MapId map, SoundSpecifier sound, StationEventMusicType type) + { + DispatchMapEventMusic(map, _audio.ResolveSound(sound), type); + } + + public void DispatchMapEventMusic(MapId map, ResolvedSoundSpecifier specifier, StationEventMusicType type) + { + var audio = AudioParams.Default.WithVolume(-8); + var msg = new StationEventMusicEvent(specifier, type, audio); + var filter = Filter.Empty().AddInMap(map); + RaiseNetworkEvent(msg, filter); + } +} diff --git a/Content.Server/_DV/CosmicCult/CosmicCultRuleSystem.cs b/Content.Server/_DV/CosmicCult/CosmicCultRuleSystem.cs index 48ba99831ff..2e59999c911 100644 --- a/Content.Server/_DV/CosmicCult/CosmicCultRuleSystem.cs +++ b/Content.Server/_DV/CosmicCult/CosmicCultRuleSystem.cs @@ -521,7 +521,7 @@ public sealed class CosmicCultRuleSystem : GameRuleSystem(uid, out var corruptingComp)) diff --git a/Content.Server/_DV/CosmicCult/EntitySystems/CosmicChantrySystem.cs b/Content.Server/_DV/CosmicCult/EntitySystems/CosmicChantrySystem.cs index e0ed23c8b00..266efc0c21e 100644 --- a/Content.Server/_DV/CosmicCult/EntitySystems/CosmicChantrySystem.cs +++ b/Content.Server/_DV/CosmicCult/EntitySystems/CosmicChantrySystem.cs @@ -8,6 +8,7 @@ using Content.Shared.Mind; using Content.Shared.Roles; using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; +using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Timing; using Robust.Shared.Utility; @@ -25,6 +26,7 @@ public sealed class CosmicChantrySystem : EntitySystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedMindSystem _mind = default!; [Dependency] private readonly SharedRoleSystem _role = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly NavMapSystem _navMap = default!; /// @@ -79,11 +81,11 @@ public sealed class CosmicChantrySystem : EntitySystem comp.SpawnTimer = _timing.CurTime + comp.SpawningTime; comp.CountdownTimer = _timing.CurTime + comp.EventTime; - _sound.PlayGlobalOnStation(ent, _audio.ResolveSound(comp.ChantryAlarm)); - _chatSystem.DispatchStationAnnouncement(ent, - Loc.GetString("cosmiccult-chantry-location", ("location", indicatedLocation)), - null, false, null, - Color.FromHex("#cae8e8")); + var targetMap = _transform.GetMapId(ent.Owner); + _sound.PlayGlobalOnMap(targetMap, _audio.ResolveSound(comp.ChantryAlarm)); + + _chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cosmiccult-chantry-location", + ("location", indicatedLocation)), null, false, null, Color.FromHex("#cae8e8")); if (_mind.TryGetMind(comp.InternalVictim, out _, out var mind)) mind.PreventGhosting = true; diff --git a/Content.Server/_DV/CosmicCult/MonumentSystem.cs b/Content.Server/_DV/CosmicCult/MonumentSystem.cs index f2b7245335d..f918a213de1 100644 --- a/Content.Server/_DV/CosmicCult/MonumentSystem.cs +++ b/Content.Server/_DV/CosmicCult/MonumentSystem.cs @@ -79,13 +79,13 @@ public sealed class MonumentSystem : SharedMonumentSystem { comp.SongTimer = null; if (comp.SelectedSong is { } song) - _sound.DispatchStationEventMusic(uid, song, StationEventMusicType.CosmicCult); + _sound.DispatchGlobalEventMusic(song, StationEventMusicType.CosmicCult); } if (comp.CurrentState == FinaleState.ActiveFinale && comp.FinaleAnnounceCheck && comp.FinaleTimer - _timing.CurTime < comp.VisualsThreshold) { _appearance.SetData(uid, MonumentVisuals.FinaleReached, 3); - _chatSystem.DispatchStationAnnouncement(uid, Loc.GetString("cosmiccult-announce-finale-warning"), null, false, null, Color.FromHex("#cae8e8")); + _chatSystem.DispatchGlobalAnnouncement(Loc.GetString("cosmiccult-announce-finale-warning"), null, false, null, Color.FromHex("#cae8e8")); comp.FinaleAnnounceCheck = false; } diff --git a/Content.Server/_DV/StationEvents/Components/EpsilonEventRuleComponent.cs b/Content.Server/_DV/StationEvents/Components/EpsilonEventRuleComponent.cs index 1749b96cafa..b9287d99225 100644 --- a/Content.Server/_DV/StationEvents/Components/EpsilonEventRuleComponent.cs +++ b/Content.Server/_DV/StationEvents/Components/EpsilonEventRuleComponent.cs @@ -1,9 +1,9 @@ using Content.Server.Power.Components; -using Content.Server.StationEvents.Events; +using Content.Server._DV.StationEvents.Events; using Robust.Shared.Audio; using Robust.Shared.Prototypes; -namespace Content.Server.StationEvents.Components; +namespace Content.Server._DV.StationEvents.Components; /// /// When fired, turns off power on the station for a few seconds, playing diff --git a/Content.Server/_DV/StationEvents/GameRules/EpsilonEventRule.cs b/Content.Server/_DV/StationEvents/GameRules/EpsilonEventRule.cs index 89c3e12d3b6..4168955a6de 100644 --- a/Content.Server/_DV/StationEvents/GameRules/EpsilonEventRule.cs +++ b/Content.Server/_DV/StationEvents/GameRules/EpsilonEventRule.cs @@ -1,14 +1,15 @@ using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; -using Content.Server.StationEvents.Components; +using Content.Server.StationEvents.Events; using Content.Shared.GameTicking.Components; using Content.Shared.Station.Components; using Content.Server.AlertLevel; using Content.Server.Audio; +using Content.Server._DV.StationEvents.Components; using Robust.Shared.Audio.Systems; -namespace Content.Server.StationEvents.Events -{ +namespace Content.Server._DV.StationEvents.Events; + public sealed class EpsilonEventRule : StationEventSystem { [Dependency] private readonly ApcSystem _apcSystem = default!; @@ -25,7 +26,7 @@ public sealed class EpsilonEventRule : StationEventSystem(); @@ -70,4 +71,3 @@ public sealed class EpsilonEventRule : StationEventSystem