Remove yaml'd non-existent components + test for that (#38878)

* chore: remove some unregistered components

* feat: test for components being ignored on client + server
This commit is contained in:
Perry Fraser
2026-01-07 18:48:17 -05:00
committed by GitHub
parent a9b953cdfe
commit 74ead53ceb
3 changed files with 25 additions and 16 deletions

View 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);
if (clientAvailability == ComponentAvailability.Unknown)
{
var entityId = node.GetNode("id").AsString();
unknownComponentsClient.Add((entityId, componentType));
}
var serverAvailability = sComponentFactory.GetComponentAvailability(componentType);
if (serverAvailability == ComponentAvailability.Unknown)
var entityId = node.GetNode("id").AsString();
if ((clientAvailability, serverAvailability) is
(ComponentAvailability.Ignore, ComponentAvailability.Ignore))
{
var entityId = node.GetNode("id").AsString();
unknownComponentsServer.Add((entityId, componentType));
doubleIgnoredComponents.Add((entityId, componentType));
continue;
}
// 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)
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());
}

View 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

View File

@@ -35,7 +35,6 @@
- type: InteractionOutline
- type: Sprite
- type: Appearance
- type: ThrusterVisuals
- type: ApcPowerReceiver
powerLoad: 1500
- type: ExtensionCableReceiver