diff --git a/Content.Server/Fax/FaxConstants.cs b/Content.Server/Fax/FaxConstants.cs index d8b3aea6db..6ca12c4e52 100644 --- a/Content.Server/Fax/FaxConstants.cs +++ b/Content.Server/Fax/FaxConstants.cs @@ -24,5 +24,7 @@ public static class FaxConstants public const string FaxNameData = "fax_data_name"; public const string FaxPaperNameData = "fax_data_title"; public const string FaxPaperContentData = "fax_data_content"; + public const string FaxPaperStampStateData = "fax_data_stamp_state"; + public const string FaxPaperStampedByData = "fax_data_stamped_by"; public const string FaxSyndicateData = "fax_data_i_am_syndicate"; } diff --git a/Content.Server/Fax/FaxMachineComponent.cs b/Content.Server/Fax/FaxMachineComponent.cs index 2b6e7e053e..1e7b8adc1a 100644 --- a/Content.Server/Fax/FaxMachineComponent.cs +++ b/Content.Server/Fax/FaxMachineComponent.cs @@ -134,9 +134,17 @@ public sealed class FaxPrintout [DataField("content")] public string Content { get; } - public FaxPrintout(string content, string name) + [DataField("stampState")] + public string? StampState { get; } + + [DataField("stampedBy")] + public List StampedBy { get; } + + public FaxPrintout(string content, string name, string? stampState = null, List? stampedBy = null) { Content = content; Name = name; + StampState = stampState; + StampedBy = stampedBy ?? new List(); } } diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 044fba0001..362941286f 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -273,7 +273,10 @@ public sealed class FaxSystem : EntitySystem !args.Data.TryGetValue(FaxConstants.FaxPaperContentData, out string? content)) return; - var printout = new FaxPrintout(content, name); + args.Data.TryGetValue(FaxConstants.FaxPaperStampStateData, out string? stampState); + args.Data.TryGetValue(FaxConstants.FaxPaperStampedByData, out List? stampedBy); + + var printout = new FaxPrintout(content, name, stampState, stampedBy); Receive(uid, printout, args.SenderAddress); break; @@ -393,6 +396,13 @@ public sealed class FaxSystem : EntitySystem { FaxConstants.FaxPaperNameData, metadata.EntityName }, { FaxConstants.FaxPaperContentData, paper.Content }, }; + + if (paper.StampState != null) + { + payload[FaxConstants.FaxPaperStampStateData] = paper.StampState; + payload[FaxConstants.FaxPaperStampedByData] = paper.StampedBy; + } + _deviceNetworkSystem.QueuePacket(uid, component.DestinationFaxAddress, payload); _adminLogger.Add(LogType.Action, LogImpact.Low, $"{(sender != null ? ToPrettyString(sender.Value) : "Unknown"):user} sent fax from \"{component.FaxName}\" {ToPrettyString(uid)} to {faxName} ({component.DestinationFaxAddress}): {paper.Content}"); @@ -435,8 +445,19 @@ public sealed class FaxSystem : EntitySystem var printed = EntityManager.SpawnEntity("Paper", Transform(uid).Coordinates); if (TryComp(printed, out var paper)) + { _paperSystem.SetContent(printed, printout.Content); + // Apply stamps + if (printout.StampState != null) + { + foreach (var stampedBy in printout.StampedBy) + { + _paperSystem.TryStamp(printed, stampedBy, printout.StampState); + } + } + } + if (TryComp(printed, out var metadata)) metadata.EntityName = printout.Name; diff --git a/Content.Server/Nuke/NukeCodePaperSystem.cs b/Content.Server/Nuke/NukeCodePaperSystem.cs index 4965018916..d8546170da 100644 --- a/Content.Server/Nuke/NukeCodePaperSystem.cs +++ b/Content.Server/Nuke/NukeCodePaperSystem.cs @@ -1,6 +1,5 @@ using System.Diagnostics.CodeAnalysis; using Content.Server.Chat.Systems; -using Content.Server.Communications; using Content.Server.Fax; using Content.Server.Paper; using Content.Server.Station.Components; @@ -46,8 +45,8 @@ namespace Content.Server.Nuke return false; } - var wasSent = false; var faxes = EntityManager.EntityQuery(); + var wasSent = false; foreach (var fax in faxes) { if (!fax.ReceiveNukeCodes || !TryGetRelativeNukeCode(fax.Owner, out var paperContent, station)) @@ -55,7 +54,11 @@ namespace Content.Server.Nuke continue; } - var printout = new FaxPrintout(paperContent, Loc.GetString("nuke-codes-fax-paper-name")); + var printout = new FaxPrintout( + paperContent, + Loc.GetString("nuke-codes-fax-paper-name"), + "paper_stamp-cent", + new() { Loc.GetString("stamp-component-stamped-name-centcom") }); _faxSystem.Receive(fax.Owner, printout, null, fax); wasSent = true; diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 97d55d7185..684b1690df 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -99,7 +99,7 @@ parent: FaxMachineBase id: FaxMachineCaptain name: captain long range fax machine - suffix: Centcom + suffix: NukeCodes components: - type: FaxMachine name: "Captain's Office"