From 886df832421f2d29ccd3b5d0dcba42ff7d104f1a Mon Sep 17 00:00:00 2001 From: Falcon Date: Thu, 16 Jul 2026 08:31:28 -0700 Subject: [PATCH] fix: GameDataScrounger treats ignored files as abstract (#44467) * fix: GameDataScrounger properly ignores ignore-list * refactor: GDC to treat ignored files as abstract * fix: use wizden's fix for windows * refactor: check ignoredDir first for perf and readability --- .../Utility/GameDataScrounger.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Content.IntegrationTests/Utility/GameDataScrounger.cs b/Content.IntegrationTests/Utility/GameDataScrounger.cs index bb190fbe21..feaaa9e930 100644 --- a/Content.IntegrationTests/Utility/GameDataScrounger.cs +++ b/Content.IntegrationTests/Utility/GameDataScrounger.cs @@ -169,17 +169,15 @@ public static partial class GameDataScrounger // Take a directory off the stack. var dir = explorationStack.Pop(); - if (ignoreList.Contains(Path.GetFullPath(dir))) - continue; // It's all abstract anyway. + var ignoredDir = ignoreList.Contains(Path.GetFullPath(dir)); explorationStack.AddRange(Directory.EnumerateDirectories(dir)); foreach (var file in Directory.EnumerateFiles(dir, "*.yml")) { - if (ignoreList.Contains(Path.GetFullPath(file))) - continue; // It's all abstract anyway. + var ignored = ignoredDir || ignoreList.Contains(Path.GetFullPath(file)); - foreach (var (kind, id) in IndexPrototypesIn(file)) + foreach (var (kind, id) in IndexPrototypesIn(file, ignored)) { // alternate universe where .net has rust's Entry api. if (!_prototypeIndex.TryGetValue(kind, out var list)) @@ -204,8 +202,9 @@ public static partial class GameDataScrounger /// yielding all (type, id) pairs. /// /// The file to index. + /// Whether or not the file is ignored. This treats the entire file as abstract. /// An enumerator of all prototypes in the file, regardless of kind. - private static IEnumerable<(string type, string id)> IndexPrototypesIn(string file) + private static IEnumerable<(string type, string id)> IndexPrototypesIn(string file, bool ignored = false) { var stream = new YamlStream(); @@ -223,7 +222,7 @@ public static partial class GameDataScrounger var id = entryMapping[IdNode]; var type = entryMapping[TypeNode]; - var @abstract = false; + var @abstract = ignored; if (entryMapping.TryGetNode("abstract", out YamlScalarNode? abstractNode)) { // TODO: This technically will exclude prototypes that use the abstract field for their own stuff,