Files
Delta-v/Content.Server/_Goobstation/StationReport/StationReportSystem.cs
T
Cepelinas1 376ed6a5b4 port: IAA Endround Report (#5997)
* it breathes

* probably okay

* Create station-report.ftl

thing miwssing

* IAA store update

* guidebook

* update on things

* revert robusttoolbox

* make it fit into folders and clipboards

* update on the styling of paper
2026-07-02 12:28:28 +02:00

54 lines
1.8 KiB
C#

using Content.Server.GameTicking;
using Content.Shared._Goobstation.StationReport;
using Content.Shared.Paper;
using Robust.Shared.GameObjects;
using System.Text;
namespace Content.Server._Goobstation.StationReportSystem;
public sealed class StationReportSystem : EntitySystem
{
//this is shitcode?
public override void Initialize()
{
//subscribes to the endroundevent
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndTextAppend);
}
private void OnRoundEndTextAppend(RoundEndTextAppendEvent args)
{
//locates the first entity with StationReportComponent and combines them
var stationReports = new StringBuilder();
var reportNumber = 1;
var query = EntityQueryEnumerator<StationReportComponent>();
while (query.MoveNext(out var uid, out _)) // finds every entity with StationReportComponent
{
if (!TryComp<PaperComponent>(uid, out var paper))
continue;
if (string.IsNullOrWhiteSpace(paper.Content))
continue;
stationReports.AppendLine($"[bold]Station Report #{reportNumber}[/bold]");
stationReports.AppendLine(paper.Content);
stationReports.AppendLine();
reportNumber++;
}
var stationReportText = stationReports.Length > 0
? stationReports.ToString()
: null;
BroadcastStationReport(stationReportText);
}
//sends a networkevent to tell the client to update the stationreporttext when recived
public void BroadcastStationReport(string? stationReportText)
{
RaiseNetworkEvent(new StationReportEvent(stationReportText));//to send to client
RaiseLocalEvent(new StationReportEvent(stationReportText));//to send to discord intergration
}
}