diff --git a/Content.Server/_FTL/PrinterPaper/PrinterPaperPrototype.cs b/Content.Server/_FTL/PrinterPaper/PrinterPaperPrototype.cs index 8f5808616b..d097178bdb 100644 --- a/Content.Server/_FTL/PrinterPaper/PrinterPaperPrototype.cs +++ b/Content.Server/_FTL/PrinterPaper/PrinterPaperPrototype.cs @@ -15,6 +15,9 @@ public sealed class PrinterPaperPrototype : IPrototype [DataField("corruptProb")] public float CorruptionProbability { get; } = 0.1f; + [DataField("tag")] + public string Tag = "Default"; + [DataField("corruptChars")] public List CorruptionCharacters = new () { diff --git a/Content.Server/_FTL/PrinterPaper/PrinterPaperSystem.cs b/Content.Server/_FTL/PrinterPaper/PrinterPaperSystem.cs index 269da48abc..e9d0f1781a 100644 --- a/Content.Server/_FTL/PrinterPaper/PrinterPaperSystem.cs +++ b/Content.Server/_FTL/PrinterPaper/PrinterPaperSystem.cs @@ -20,7 +20,19 @@ public override void Initialize() private void OnComponentInit(EntityUid uid, RandomPrinterPaperComponent component, ComponentInit args) { var prototypes = _prototypeManager.EnumeratePrototypes().ToList(); - var prototype = _random.Pick(prototypes); + PrinterPaperPrototype? prototype = null; + + while (prototype == null) + { + var chosenPrototype = _random.Pick(prototypes); + if (component.Tag == null) + { + prototype = chosenPrototype; + break; + } + if (component.Tag == chosenPrototype.Tag) + prototype = chosenPrototype; + } var contentPicked = prototype.Content; var content = new StringBuilder(); diff --git a/Content.Server/_FTL/PrinterPaper/RandomPrinterPaperComponent.cs b/Content.Server/_FTL/PrinterPaper/RandomPrinterPaperComponent.cs index afb094554c..bdeba7395e 100644 --- a/Content.Server/_FTL/PrinterPaper/RandomPrinterPaperComponent.cs +++ b/Content.Server/_FTL/PrinterPaper/RandomPrinterPaperComponent.cs @@ -6,5 +6,7 @@ namespace Content.Server._FTL.PrinterPaper; [RegisterComponent] public sealed partial class RandomPrinterPaperComponent : Component { - [ViewVariables(VVAccess.ReadOnly)] public string Content = ""; + [DataField, ViewVariables(VVAccess.ReadOnly)] + public string Content = ""; + [DataField] public string? Tag; }