Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ public async Task NoSavedPostMapInitTest()
// TODO MAP TESTS
// Move this to some separate test?
CheckDoNotMap(map, root, protoManager);
CECheckOnlyForkFiltered(map, root, protoManager); //CrystallEdge

if (version >= 7)
{
Expand Down Expand Up @@ -270,6 +271,35 @@ private bool IsWhitelistedForMap(EntProtoId protoId, ResPath map)
return allowedProtos.Contains(protoId);
}

/// <summary>
/// CrystallEdge - we ensure that maps don't have any vanilla entities
/// </summary>
private void CECheckOnlyForkFiltered(ResPath map, YamlNode node, IPrototypeManager protoManager)
{
//ignore all vanilla maps
if (!map.ToString().Contains("_CE"))
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})");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace from Name to ProtoId

}
});
}

/// <summary>
/// Check that maps do not have any entities that belong to the DoNotMap entity category
/// </summary>
Expand Down
Loading