Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Fix: Clear news articles on round restart (new-frontiers-14#1428)
Browse files Browse the repository at this point in the history
* NewsSystem: clear articles on round restart

* Update NewsSystem.cs

---------

Co-authored-by: Dvir <[email protected]>
  • Loading branch information
whatston3 and dvir001 authored May 30, 2024
1 parent f505fc3 commit 6afbc0d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Content.Server/MassMedia/Systems/NewsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Content.Shared.Popups;
using Content.Shared.StationRecords;
using Robust.Shared.Audio.Systems;
using Content.Shared.GameTicking; // Frontier

namespace Content.Server.MassMedia.Systems;

Expand All @@ -43,6 +44,8 @@ public override void Initialize()
// News writer
// Frontier: News is shared across the sector. No need to create shuttle-local news caches.
// SubscribeLocalEvent<NewsWriterComponent, MapInitEvent>(OnMapInit);

SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
// End Frontier

// New writer bui messages
Expand All @@ -59,6 +62,14 @@ public override void Initialize()
SubscribeLocalEvent<NewsReaderCartridgeComponent, CartridgeMessageEvent>(OnReaderUiMessage);
SubscribeLocalEvent<NewsReaderCartridgeComponent, CartridgeUiReadyEvent>(OnReaderUiReady);
}

// Frontier: article lifecycle management
private void OnRoundRestart(RoundRestartCleanupEvent ev)
{
// A new round is starting, clear any articles from the previous round.
SectorNewsComponent.Articles.Clear();
}
// End Frontier

public override void Update(float frameTime)
{
Expand Down

0 comments on commit 6afbc0d

Please sign in to comment.