From 613dc050d647c8a72f921d4c0f7e313db4957842 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Mon, 14 Apr 2025 16:48:45 +0300 Subject: [PATCH] Update PostMapInitTest.cs --- .../Tests/PostMapInitTest.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Content.IntegrationTests/Tests/PostMapInitTest.cs b/Content.IntegrationTests/Tests/PostMapInitTest.cs index d433b1379f..79e603af07 100644 --- a/Content.IntegrationTests/Tests/PostMapInitTest.cs +++ b/Content.IntegrationTests/Tests/PostMapInitTest.cs @@ -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("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,