Improve Paper UI, allow an to entity configure how it's UI looks (#13494)

Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
This commit is contained in:
eoineoineoin
2023-01-17 08:32:46 +00:00
committed by GitHub
parent 741991602f
commit bda5f8248f
48 changed files with 2212 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
using Content.Server.Administration;
using Content.Server.Administration;
using Content.Server.Administration.Managers;
using Content.Server.Chat.Managers;
using Content.Server.DeviceNetwork;
@@ -275,8 +275,9 @@ public sealed class FaxSystem : EntitySystem
args.Data.TryGetValue(FaxConstants.FaxPaperStampStateData, out string? stampState);
args.Data.TryGetValue(FaxConstants.FaxPaperStampedByData, out List<string>? stampedBy);
args.Data.TryGetValue(FaxConstants.FaxPaperPrototypeData, out string? prototypeId);
var printout = new FaxPrintout(content, name, stampState, stampedBy);
var printout = new FaxPrintout(content, name, prototypeId, stampState, stampedBy);
Receive(uid, printout, args.SenderAddress);
break;
@@ -397,12 +398,21 @@ public sealed class FaxSystem : EntitySystem
{ FaxConstants.FaxPaperContentData, paper.Content },
};
if (metadata.EntityPrototype != null)
{
/// todo: Ideally, we could just make a copy of the whole entity when it's
/// faxed, in order to preserve visuals, etc.. This functionality isn't
/// available yet, so we'll pass along the originating prototypeId and fall
/// back to "Paper" in SpawnPaperFromQueue if we can't find one here.
payload[FaxConstants.FaxPaperPrototypeData] = metadata.EntityPrototype.ID;
}
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}");
@@ -442,7 +452,9 @@ public sealed class FaxSystem : EntitySystem
return;
var printout = component.PrintingQueue.Dequeue();
var printed = EntityManager.SpawnEntity("Paper", Transform(uid).Coordinates);
var entityToSpawn = printout.PrototypeId.Length == 0 ? "Paper" : printout.PrototypeId;
var printed = EntityManager.SpawnEntity(entityToSpawn, Transform(uid).Coordinates);
if (TryComp<PaperComponent>(printed, out var paper))
{