Update PostMapInitTest.cs

This commit is contained in:
Ed
2025-04-14 16:48:45 +03:00
parent b7e4fbb74a
commit 613dc050d6

View File

@@ -202,6 +202,7 @@ namespace Content.IntegrationTests.Tests
// TODO MAP TESTS
// Move this to some separate test?
CheckDoNotMap(map, root, protoManager);
CP14CheckOnlyForkFiltered(map, root, protoManager);
if (version >= 7)
{
@@ -270,6 +271,31 @@ namespace Content.IntegrationTests.Tests
});
}
private void CP14CheckOnlyForkFiltered(ResPath map, YamlNode node, IPrototypeManager protoManager)
{
if (DoNotMapWhitelist.Contains(map.ToString()))
return;
var yamlEntities = node["entities"];
if (!protoManager.TryIndex<EntityCategoryPrototype>("ForkFiltered", out var filterCategory))
return;
Assert.Multiple(() =>
{
foreach (var yamlEntity in (YamlSequenceNode)yamlEntities)
{
var protoId = yamlEntity["proto"].AsString();
// This doesn't properly handle prototype migrations, but thats not a significant issue.
if (!protoManager.TryIndex(protoId, out var proto, false))
continue;
Assert.That(proto.Categories.Contains(filterCategory),
$"\nMap {map} contains entities without FORK FILTERED category ({proto.Name})");
}
});
}
private bool IsPreInit(ResPath map,
MapLoaderSystem loader,
IDependencyCollection deps,