Use typed faction keys for galaxy allegiance
This commit is contained in:
parent
d496d2d04b
commit
a29794232d
6 changed files with 58 additions and 36 deletions
|
|
@ -11,6 +11,7 @@ RequireGameplaySourcePurity(root);
|
|||
RequirePackageSerializerBoundary(root);
|
||||
RequireTypedPendingCommitKeys(root);
|
||||
RequireTypedRuntimeFactionKeys(root);
|
||||
RequireTypedGalaxyFactionRelationships(root);
|
||||
RequireEveRuntimeBootstrap(root);
|
||||
RequireNoRendererLocalConsole(root);
|
||||
RequireNoRendererLocalDebugPanels(root);
|
||||
|
|
@ -662,6 +663,42 @@ static void RequireTypedRuntimeFactionKeys(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequireTypedGalaxyFactionRelationships(string root)
|
||||
{
|
||||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "Corporations.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "Galaxy.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "LoadoutGenerator.cs")
|
||||
};
|
||||
|
||||
var forbiddenSymbols = new[]
|
||||
{
|
||||
"Dictionary<Guid, float> Allegiance",
|
||||
".Allegiance[",
|
||||
"ContainsFaction(Guid",
|
||||
"ResolveFaction(Guid",
|
||||
"CorporationLegacyId",
|
||||
"factionsByLegacyId",
|
||||
"_containedFactions"
|
||||
};
|
||||
|
||||
var hits = checkedFiles
|
||||
.Where(File.Exists)
|
||||
.SelectMany(path => File.ReadLines(path)
|
||||
.Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
|
||||
.Where(line => forbiddenSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
|
||||
.Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}")
|
||||
.ToArray();
|
||||
|
||||
if (hits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Galaxy faction relationships must use typed corporation keys, not legacy GUID allegiance state: " +
|
||||
string.Join("; ", hits));
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireEveRuntimeBootstrap(string root)
|
||||
{
|
||||
var bootstrapPath = Path.Combine(
|
||||
|
|
|
|||
Loading…
Reference in a new issue