From 9f180e4f622768d1845477198ac86dde3fe94e03 Mon Sep 17 00:00:00 2001 From: Mervill Date: Sun, 11 Aug 2024 19:13:28 -0700 Subject: [PATCH] Don't show the Meteor Swarm announcement to players in the lobby. (#30922) --- Content.Server/StationEvents/Events/MeteorSwarmSystem.cs | 8 ++++++-- Content.Server/StationEvents/Events/StationEventSystem.cs | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs b/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs index 3f51834e3a..948fedf6fc 100644 --- a/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs +++ b/Content.Server/StationEvents/Events/MeteorSwarmSystem.cs @@ -28,9 +28,13 @@ public sealed class MeteorSwarmSystem : GameRuleSystem component.WaveCounter = component.Waves.Next(RobustRandom); + // we don't want to send to players who aren't in game (i.e. in the lobby) + Filter allPlayersInGame = Filter.Empty().AddWhere(GameTicker.UserHasJoinedGame); + if (component.Announcement is { } locId) - _chat.DispatchGlobalAnnouncement(Loc.GetString(locId), playSound: false, colorOverride: Color.Gold); - _audio.PlayGlobal(component.AnnouncementSound, Filter.Broadcast(), true); + _chat.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(locId), playSound: false, colorOverride: Color.Gold); + + _audio.PlayGlobal(component.AnnouncementSound, allPlayersInGame, true); } protected override void ActiveTick(EntityUid uid, MeteorSwarmComponent component, GameRuleComponent gameRule, float frameTime) diff --git a/Content.Server/StationEvents/Events/StationEventSystem.cs b/Content.Server/StationEvents/Events/StationEventSystem.cs index 67643a8df5..aaa48a482e 100644 --- a/Content.Server/StationEvents/Events/StationEventSystem.cs +++ b/Content.Server/StationEvents/Events/StationEventSystem.cs @@ -22,7 +22,6 @@ public abstract class StationEventSystem : GameRuleSystem where T : ICompo [Dependency] protected readonly ChatSystem ChatSystem = default!; [Dependency] protected readonly SharedAudioSystem Audio = default!; [Dependency] protected readonly StationSystem StationSystem = default!; - [Dependency] protected readonly GameTicker GameTicker = default!; protected ISawmill Sawmill = default!; -- 2.52.0