From 74ead53ceb9e25c9db547e63011b8f3c556dbffd Mon Sep 17 00:00:00 2001 From: Perry Fraser Date: Wed, 7 Jan 2026 18:48:17 -0500 Subject: [PATCH] Remove yaml'd non-existent components + test for that (#38878) * chore: remove some unregistered components * feat: test for components being ignored on client + server --- .../EntityPrototypeComponentsTest.cs | 31 +++++++++++++------ .../Machines/Medical/vaccinator.yml | 3 -- .../Structures/Shuttles/thrusters.yml | 1 - 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Content.IntegrationTests/Tests/GameObjects/Components/EntityPrototypeComponentsTest.cs b/Content.IntegrationTests/Tests/GameObjects/Components/EntityPrototypeComponentsTest.cs index 5c73245501..ef94cf0f00 100644 --- a/Content.IntegrationTests/Tests/GameObjects/Components/EntityPrototypeComponentsTest.cs +++ b/Content.IntegrationTests/Tests/GameObjects/Components/EntityPrototypeComponentsTest.cs @@ -26,7 +26,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components .ToList() .AsParallel() .Where(filePath => filePath.Extension == "yml" && - !filePath.Filename.StartsWith(".", StringComparison.Ordinal)) + !filePath.Filename.StartsWith('.')) .ToArray(); var cComponentFactory = client.ResolveDependency(); @@ -34,6 +34,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components var unknownComponentsClient = new List<(string entityId, string component)>(); var unknownComponentsServer = new List<(string entityId, string component)>(); + var doubleIgnoredComponents = new List<(string entityId, string component)>(); var entitiesValidated = 0; var componentsValidated = 0; @@ -72,26 +73,32 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components var componentType = component.GetNode("type").AsString(); var clientAvailability = cComponentFactory.GetComponentAvailability(componentType); + var serverAvailability = sComponentFactory.GetComponentAvailability(componentType); - if (clientAvailability == ComponentAvailability.Unknown) + var entityId = node.GetNode("id").AsString(); + + if ((clientAvailability, serverAvailability) is + (ComponentAvailability.Ignore, ComponentAvailability.Ignore)) { - var entityId = node.GetNode("id").AsString(); - unknownComponentsClient.Add((entityId, componentType)); + doubleIgnoredComponents.Add((entityId, componentType)); + continue; } - var serverAvailability = sComponentFactory.GetComponentAvailability(componentType); + // NOTE: currently, the client's component factory is configured to ignore /all/ + // non-registered components, meaning this case will never succeed. This is here + // mainly for future proofing plus any downstreams that were brave enough to not + // ignore all unknown components on clientside. + if (clientAvailability == ComponentAvailability.Unknown) + unknownComponentsClient.Add((entityId, componentType)); if (serverAvailability == ComponentAvailability.Unknown) - { - var entityId = node.GetNode("id").AsString(); unknownComponentsServer.Add((entityId, componentType)); - } } } } } - if (unknownComponentsClient.Count + unknownComponentsServer.Count == 0) + if (unknownComponentsClient.Count + unknownComponentsServer.Count + doubleIgnoredComponents.Count == 0) { await pair.CleanReturnAsync(); Assert.Pass($"Validated {entitiesValidated} entities with {componentsValidated} components in {paths.Length} files."); @@ -112,6 +119,12 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components $"SERVER: Unknown component {component} in prototype {entityId}\n"); } + foreach (var (entityId, component) in doubleIgnoredComponents) + { + message.Append( + $"Component {component} in prototype {entityId} is ignored by both client and serverV\n"); + } + Assert.Fail(message.ToString()); } diff --git a/Resources/Prototypes/Entities/Structures/Machines/Medical/vaccinator.yml b/Resources/Prototypes/Entities/Structures/Machines/Medical/vaccinator.yml index 53542cdfa9..49a77d1d09 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Medical/vaccinator.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Medical/vaccinator.yml @@ -15,9 +15,6 @@ shader: unshaded map: ["enum.DiseaseMachineVisualLayers.IsOn"] - type: Appearance - - type: DiseaseMachineVisuals - idleState: icon - runningState: running - type: Machine board: VaccinatorMachineCircuitboard - type: ContainerContainer diff --git a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml index e251d1bfff..eafaae4450 100644 --- a/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml +++ b/Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml @@ -35,7 +35,6 @@ - type: InteractionOutline - type: Sprite - type: Appearance - - type: ThrusterVisuals - type: ApcPowerReceiver powerLoad: 1500 - type: ExtensionCableReceiver -- 2.52.0