diff --git a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs index dcb904d5a5..9a4b93e3d3 100644 --- a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -28,19 +28,12 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem if (!TryComp(uid, out SpriteComponent? sprite)) return; - if (!_resCache.TryGetResource(SpriteSpecifierSerializer.TextureRoot / component.RsiPath, out RSIResource? rsi)) - { - Logger.Error($"{nameof(AtmosPipeAppearanceSystem)} could not load to load RSI {component.RsiPath}."); - return; - } - foreach (PipeConnectionLayer layerKey in Enum.GetValues(typeof(PipeConnectionLayer))) { sprite.LayerMapReserveBlank(layerKey); var layer = sprite.LayerMapGet(layerKey); - sprite.LayerSetRSI(layer, rsi.RSI); - var layerState = component.State; - sprite.LayerSetState(layer, layerState); + sprite.LayerSetRSI(layer, component.Sprite.RsiPath); + sprite.LayerSetState(layer, component.Sprite.RsiState); sprite.LayerSetDirOffset(layer, ToOffset(layerKey)); } } diff --git a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsComponent.cs b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsComponent.cs index d84e838c2b..1608e2d013 100644 --- a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsComponent.cs +++ b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsComponent.cs @@ -32,7 +32,7 @@ namespace Content.Client.Chemistry.Visualizers [DataField("metamorphic")] public bool Metamorphic = false; [DataField("metamorphicDefaultSprite")] - public SpriteSpecifier MetamorphicDefaultSprite = SpriteSpecifier.Invalid; + public SpriteSpecifier? MetamorphicDefaultSprite; [DataField("metamorphicNameFull")] public string MetamorphicNameFull = "transformable-container-component-glass"; @@ -41,9 +41,12 @@ namespace Content.Client.Chemistry.Visualizers /// If not set, will work as default. /// [DataField("solutionName")] - public string SolutionName = ""; + public string? SolutionName; + [DataField("initialName")] public string InitialName = string.Empty; + + [DataField("initialDescription")] public string InitialDescription = string.Empty; } } diff --git a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs index 6fdf38441d..7c518b4a61 100644 --- a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs +++ b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs @@ -76,7 +76,8 @@ public sealed class SolutionContainerVisualsSystem : VisualizerSystem - /// This test writes all known prototypes as yaml files, then validates that the result is valid yaml. + /// This test writes all known server prototypes as yaml files, then validates that the result is valid yaml. /// Can help prevent instances where prototypes have bad C# default values. /// [Test] - public async Task TestAllPrototypesAreSerializable() + public async Task TestAllServerPrototypesAreSerializable() { await using var pairTracker = await PoolManager.GetServerClient(); var context = new PrototypeSaveTest.TestEntityUidContext(); - Assert.Multiple(() => - { - Validate(pairTracker.Pair.Server, "server", context); - - // TODO fix client serialization - //Validate(pairTracker.Pair.Client, "client", context); - }); + await SaveThenValidatePrototype(pairTracker.Pair.Server, "server", context); await pairTracker.CleanReturnAsync(); } - public void Validate(RobustIntegrationTest.IntegrationInstance instance, string instanceId, + /// + /// This test writes all known client prototypes as yaml files, then validates that the result is valid yaml. + /// Can help prevent instances where prototypes have bad C# default values. + /// + [Test] + public async Task TestAllClientPrototypesAreSerializable() + { + await using var pairTracker = await PoolManager.GetServerClient(); + var context = new PrototypeSaveTest.TestEntityUidContext(); + await SaveThenValidatePrototype(pairTracker.Pair.Client, "client", context); + await pairTracker.CleanReturnAsync(); + } + + public async Task SaveThenValidatePrototype(RobustIntegrationTest.IntegrationInstance instance, string instanceId, PrototypeSaveTest.TestEntityUidContext ctx) { var protoMan = instance.ResolveDependency(); - var errors = protoMan.ValidateAllPrototypesSerializable(ctx); + Dictionary>> errors = default!; + await instance.WaitPost(() => errors = protoMan.ValidateAllPrototypesSerializable(ctx)); if (errors.Count == 0) return; diff --git a/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs b/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs index f36ede3dfb..b412599d65 100644 --- a/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs +++ b/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs @@ -1,11 +1,10 @@ +using Robust.Shared.Utility; + namespace Content.Shared.Atmos.Components; [RegisterComponent] public sealed class PipeAppearanceComponent : Component { - [DataField("rsi")] - public string RsiPath = "Structures/Piping/Atmospherics/pipe.rsi"; - - [DataField("baseState")] - public string State = "pipeConnector"; + [DataField("sprite")] + public SpriteSpecifier.Rsi Sprite = new(new("Structures/Piping/Atmospherics/pipe.rsi"), "pipeConnector"); }