From 4f5cbb63dea7f933760a05d37fca427faf52238c Mon Sep 17 00:00:00 2001 From: 20kdc Date: Sat, 9 Oct 2021 14:48:53 +0100 Subject: [PATCH] Paper Visualizer (#4811) --- Content.Server/Paper/PaperComponent.cs | 4 ++-- Content.Shared/Paper/SharedPaperComponent.cs | 13 +++++++++++++ .../Prototypes/Entities/Objects/Misc/paper.yml | 13 +++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Content.Server/Paper/PaperComponent.cs b/Content.Server/Paper/PaperComponent.cs index 8378e76b4a..63ed32864f 100644 --- a/Content.Server/Paper/PaperComponent.cs +++ b/Content.Server/Paper/PaperComponent.cs @@ -72,9 +72,9 @@ namespace Content.Server.Paper Content += msg.Text + '\n'; - if (Owner.TryGetComponent(out SpriteComponent? sprite)) + if (Owner.TryGetComponent(out AppearanceComponent? appearance)) { - sprite.LayerSetState(0, "paper_words"); + appearance.SetData(PaperVisuals.Status, PaperStatus.Written); } Owner.Description = ""; diff --git a/Content.Shared/Paper/SharedPaperComponent.cs b/Content.Shared/Paper/SharedPaperComponent.cs index d65a158ee4..e239ed3ecd 100644 --- a/Content.Shared/Paper/SharedPaperComponent.cs +++ b/Content.Shared/Paper/SharedPaperComponent.cs @@ -57,5 +57,18 @@ namespace Content.Shared.Paper Stamp } + [Serializable, NetSerializable] + public enum PaperVisuals : byte + { + Status + } + + [Serializable, NetSerializable] + public enum PaperStatus : byte + { + Blank, + Written + } + } } diff --git a/Resources/Prototypes/Entities/Objects/Misc/paper.yml b/Resources/Prototypes/Entities/Objects/Misc/paper.yml index 444e61604e..6b8eb3c850 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/paper.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/paper.yml @@ -6,6 +6,7 @@ components: - type: Sprite sprite: Objects/Misc/bureaucracy.rsi + netsync: false layers: - state: paper - type: Paper @@ -13,14 +14,26 @@ interfaces: - key: enum.PaperUiKey.Key type: PaperBoundUserInterface + - type: Appearance + visuals: + - type: GenericEnumVisualizer + key: enum.PaperVisuals.Status + layer: 0 + states: + # This default isn't actually explicitly used right now. + enum.PaperStatus.Blank: paper + enum.PaperStatus.Written: paper_words - type: entity parent: Paper id: PaperWritten abstract: true components: + - type: Paper - type: Sprite layers: + # Changing it here is fine - if the PaperStatus key is actually added, + # something happened, so that ought to override this either way. - state: paper_words - type: entity