Improve paper stamping experience (#17135)

This commit is contained in:
eoineoineoin
2023-08-13 19:28:10 +01:00
committed by GitHub
parent ae2dcc8aba
commit 4ccc8a04be
28 changed files with 629 additions and 202 deletions

View File

@@ -1,9 +1,10 @@
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Components;
using Content.Server.EUI;
using Content.Server.Ghost.Components;
using Content.Shared.Eui;
using Content.Shared.Fax;
using Content.Shared.Follower;
using Content.Shared.Paper;
namespace Content.Server.Fax.AdminUI;
@@ -53,7 +54,8 @@ public sealed class AdminFaxEui : BaseEui
}
case AdminFaxEuiMsg.Send sendData:
{
var printout = new FaxPrintout(sendData.Content, sendData.Title, null, sendData.StampState, new() { sendData.From });
var printout = new FaxPrintout(sendData.Content, sendData.Title, null, sendData.StampState,
new() { new StampDisplayInfo { StampedName = sendData.From, StampedColor = sendData.StampColor } });
_faxSystem.Receive(sendData.Target, printout);
break;
}

View File

@@ -1,4 +1,5 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Paper;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
@@ -136,18 +137,18 @@ public sealed class FaxPrintout
public string? StampState { get; }
[DataField("stampedBy")]
public List<string> StampedBy { get; } = new();
public List<StampDisplayInfo> StampedBy { get; } = new();
private FaxPrintout()
{
}
public FaxPrintout(string content, string name, string? prototypeId = null, string? stampState = null, List<string>? stampedBy = null)
public FaxPrintout(string content, string name, string? prototypeId = null, string? stampState = null, List<StampDisplayInfo>? stampedBy = null)
{
Content = content;
Name = name;
PrototypeId = prototypeId ?? "";
StampState = stampState;
StampedBy = stampedBy ?? new List<string>();
StampedBy = stampedBy ?? new List<StampDisplayInfo>();
}
}

View File

@@ -16,6 +16,7 @@ using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.Fax;
using Content.Shared.Interaction;
using Content.Shared.Paper;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
@@ -272,7 +273,7 @@ public sealed class FaxSystem : EntitySystem
return;
args.Data.TryGetValue(FaxConstants.FaxPaperStampStateData, out string? stampState);
args.Data.TryGetValue(FaxConstants.FaxPaperStampedByData, out List<string>? stampedBy);
args.Data.TryGetValue(FaxConstants.FaxPaperStampedByData, out List<StampDisplayInfo>? stampedBy);
args.Data.TryGetValue(FaxConstants.FaxPaperPrototypeData, out string? prototypeId);
var printout = new FaxPrintout(content, name, prototypeId, stampState, stampedBy);
@@ -461,9 +462,9 @@ public sealed class FaxSystem : EntitySystem
// Apply stamps
if (printout.StampState != null)
{
foreach (var stampedBy in printout.StampedBy)
foreach (var stamp in printout.StampedBy)
{
_paperSystem.TryStamp(printed, stampedBy, printout.StampState);
_paperSystem.TryStamp(printed, stamp, printout.StampState);
}
}
}