mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-02-15 04:10:55 +01:00
Fax stamps (#13010)
* Change captain fax suffix * Add stamps transmit * Remove proto dependency * Add centcom fax address for nuke codes * Remove centcom address resolve * Remove centcom id
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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<string> StampedBy { get; }
|
||||
|
||||
public FaxPrintout(string content, string name, string? stampState = null, List<string>? stampedBy = null)
|
||||
{
|
||||
Content = content;
|
||||
Name = name;
|
||||
StampState = stampState;
|
||||
StampedBy = stampedBy ?? new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<string>? 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<PaperComponent>(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<MetaDataComponent>(printed, out var metadata))
|
||||
metadata.EntityName = printout.Name;
|
||||
|
||||
|
||||
@@ -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<FaxMachineComponent>();
|
||||
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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user