Don't show Station Event announcements to players in the lobby. (#30886)
* Don't show Station Event announcements to players in the lobby. * fix pr --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Chat.Systems;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
using Content.Server.Station.Systems;
|
||||
using Content.Server.StationEvents.Components;
|
||||
@@ -21,6 +22,7 @@ public abstract class StationEventSystem<T> : GameRuleSystem<T> 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!;
|
||||
|
||||
@@ -41,10 +43,13 @@ public abstract class StationEventSystem<T> : GameRuleSystem<T> where T : ICompo
|
||||
|
||||
AdminLogManager.Add(LogType.EventAnnounced, $"Event added / announced: {ToPrettyString(uid)}");
|
||||
|
||||
if (stationEvent.StartAnnouncement != null)
|
||||
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(stationEvent.StartAnnouncement), playSound: false, colorOverride: stationEvent.StartAnnouncementColor);
|
||||
// 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);
|
||||
|
||||
Audio.PlayGlobal(stationEvent.StartAudio, Filter.Broadcast(), true);
|
||||
if (stationEvent.StartAnnouncement != null)
|
||||
ChatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(stationEvent.StartAnnouncement), playSound: false, colorOverride: stationEvent.StartAnnouncementColor);
|
||||
|
||||
Audio.PlayGlobal(stationEvent.StartAudio, allPlayersInGame, true);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -77,10 +82,13 @@ public abstract class StationEventSystem<T> : GameRuleSystem<T> where T : ICompo
|
||||
|
||||
AdminLogManager.Add(LogType.EventStopped, $"Event ended: {ToPrettyString(uid)}");
|
||||
|
||||
if (stationEvent.EndAnnouncement != null)
|
||||
ChatSystem.DispatchGlobalAnnouncement(Loc.GetString(stationEvent.EndAnnouncement), playSound: false, colorOverride: stationEvent.EndAnnouncementColor);
|
||||
// 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);
|
||||
|
||||
Audio.PlayGlobal(stationEvent.EndAudio, Filter.Broadcast(), true);
|
||||
if (stationEvent.EndAnnouncement != null)
|
||||
ChatSystem.DispatchFilteredAnnouncement(allPlayersInGame, Loc.GetString(stationEvent.EndAnnouncement), playSound: false, colorOverride: stationEvent.EndAnnouncementColor);
|
||||
|
||||
Audio.PlayGlobal(stationEvent.EndAudio, allPlayersInGame, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user