]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Remove yaml'd non-existent components + test for that (#38878)
authorPerry Fraser <perryprog@users.noreply.github.com>
Wed, 7 Jan 2026 23:48:17 +0000 (18:48 -0500)
committerGitHub <noreply@github.com>
Wed, 7 Jan 2026 23:48:17 +0000 (23:48 +0000)
* chore: remove some unregistered components

* feat: test for components being ignored on client + server

Content.IntegrationTests/Tests/GameObjects/Components/EntityPrototypeComponentsTest.cs
Resources/Prototypes/Entities/Structures/Machines/Medical/vaccinator.yml
Resources/Prototypes/Entities/Structures/Shuttles/thrusters.yml

index 5c7324550117cd3419010c686d4852aa9559cd2a..ef94cf0f0033827e1edb500b38a8dc48f5176395 100644 (file)
@@ -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<IComponentFactory>();
@@ -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());
         }
 
index 53542cdfa91495767eba43c26edba9909cfd7654..49a77d1d095a42b6fbaefd6ce282b38f4fd6602d 100644 (file)
@@ -15,9 +15,6 @@
       shader: unshaded
       map: ["enum.DiseaseMachineVisualLayers.IsOn"]
   - type: Appearance
-  - type: DiseaseMachineVisuals
-    idleState: icon
-    runningState: running
   - type: Machine
     board: VaccinatorMachineCircuitboard
   - type: ContainerContainer
index e251d1bfff3a74505d58a2c803369231be2e2dfd..eafaae445001cd9a8a92c0cac42689fd85022806 100644 (file)
@@ -35,7 +35,6 @@
     - type: InteractionOutline
     - type: Sprite
     - type: Appearance
-    - type: ThrusterVisuals
     - type: ApcPowerReceiver
       powerLoad: 1500
     - type: ExtensionCableReceiver