Use typed keys for faction shell links
This commit is contained in:
parent
0aea729eff
commit
392c24a7da
6 changed files with 48 additions and 10 deletions
Binary file not shown.
|
|
@ -14,6 +14,7 @@ RequireTypedRuntimeFactionKeys(root);
|
|||
RequireTypedGalaxyFactionRelationships(root);
|
||||
RequireRuntimeCatalogKeyOnlyLookups(root);
|
||||
RequireTypedBehaviorBodyKeys(root);
|
||||
RequireTypedFactionShellLinks(root);
|
||||
RequireEveRuntimeBootstrap(root);
|
||||
RequireNoRendererLocalConsole(root);
|
||||
RequireNoRendererLocalDebugPanels(root);
|
||||
|
|
@ -772,6 +773,42 @@ static void RequireTypedBehaviorBodyKeys(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequireTypedFactionShellLinks(string root)
|
||||
{
|
||||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "Corporations.cs"),
|
||||
Path.Combine(root, "Assets", "Scripts", "ServerShared", "Galaxy.cs")
|
||||
};
|
||||
|
||||
var forbiddenSymbols = new[]
|
||||
{
|
||||
"Guid GeonameFile",
|
||||
"Guid BossHull",
|
||||
"GeonameFile =",
|
||||
"BossHull =",
|
||||
"ParseOptionalLegacyId",
|
||||
"GeonameFileLegacyId",
|
||||
"BossHullLegacyId",
|
||||
".BossHull != Guid.Empty"
|
||||
};
|
||||
|
||||
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(
|
||||
"Temporary Faction shell links must use typed key fields, not geoname/boss-hull legacy GUID projections: " +
|
||||
string.Join("; ", hits));
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireEveRuntimeBootstrap(string root)
|
||||
{
|
||||
var bootstrapPath = Path.Combine(
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ longer rebuild corporation references from legacy `Faction.ID` GUIDs.
|
|||
Galaxy faction relationship projection is also typed-key-only: the old
|
||||
`Faction.Allegiance` GUID dictionary, GUID containment helper, and GUID faction
|
||||
resolver are deleted from the simulation shell.
|
||||
The remaining temporary `Faction` shell also uses `GeonameFileKey` and
|
||||
`BossHullItemKey`; it no longer parses name-file or boss-hull legacy IDs into
|
||||
GUID link fields.
|
||||
Run checkpoint commit DTOs carry typed `OrbitKey`, `ParentOrbitKey`, and
|
||||
`BodyKey` only for zone orbit/body snapshots. The old pending-command
|
||||
`OrbitLegacyId`, `ParentLegacyId`, and `BodyLegacyId` fallback fields are
|
||||
|
|
|
|||
|
|
@ -33,9 +33,8 @@ public class Faction : INamedEntry
|
|||
|
||||
[InspectableColor]
|
||||
public float3 SecondaryColor;
|
||||
public Guid GeonameFile;
|
||||
public string GeonameFileKey;
|
||||
public Guid BossHull;
|
||||
public string BossHullItemKey;
|
||||
|
||||
[Inspectable]
|
||||
public int InfluenceDistance = 4;
|
||||
|
|
|
|||
|
|
@ -261,9 +261,8 @@ public class Galaxy
|
|||
Name = corporation.Name,
|
||||
ShortName = corporation.ShortName,
|
||||
Description = corporation.Description,
|
||||
GeonameFile = ParseLegacyId(corporation.GeonameFileLegacyId, nameof(corporation.GeonameFileLegacyId), corporation.Name),
|
||||
GeonameFileKey = corporation.GeonameFileKey,
|
||||
BossHull = ParseOptionalLegacyId(corporation.BossHullLegacyId),
|
||||
BossHullItemKey = corporation.BossHullItemKey,
|
||||
InfluenceDistance = corporation.InfluenceDistance,
|
||||
};
|
||||
}
|
||||
|
|
@ -278,11 +277,6 @@ public class Galaxy
|
|||
throw new InvalidOperationException($"Typed catalog corporation {ownerName} has invalid {fieldName} '{legacyId}'.");
|
||||
}
|
||||
|
||||
private static Guid ParseOptionalLegacyId(string legacyId)
|
||||
{
|
||||
return Guid.TryParse(legacyId, out var parsed) ? parsed : Guid.Empty;
|
||||
}
|
||||
|
||||
private void PlaceFactionsMain(int bossCount, Action<string> progressCallback = null)
|
||||
{
|
||||
progressCallback?.Invoke("Finding Chokepoints");
|
||||
|
|
@ -298,7 +292,7 @@ public class Galaxy
|
|||
|
||||
// Choose some megas to have bosses placed based on whether a boss hull is assigned
|
||||
var bossMegas = Factions
|
||||
.Where(m => m.BossHull != Guid.Empty)
|
||||
.Where(m => !string.IsNullOrWhiteSpace(m.BossHullItemKey))
|
||||
.Take(bossCount)
|
||||
.ToArray();
|
||||
|
||||
|
|
|
|||
|
|
@ -1019,6 +1019,9 @@ First Aetheria surfaces to publish:
|
|||
`Galaxy.ResolveFaction(Guid)`; galaxy/loadout faction relationship logic
|
||||
now uses `AllegianceByKey`, `ContainsFaction(string)`, and
|
||||
`ResolveFactionByKey` only.
|
||||
- Done: delete the temporary `Faction` shell's `GeonameFile` and `BossHull`
|
||||
GUID link fields; galaxy name generation and boss-zone eligibility use
|
||||
`GeonameFileKey` and `BossHullItemKey`.
|
||||
- Done: move package and canonical manufacturer/corporation/name-file lookup
|
||||
to typed keys (`ManufacturerKey`, `CorporationKey`, `GeonameFileKey`,
|
||||
and `NameFileKey`), and move loadout manufacturer-distance weighting to
|
||||
|
|
@ -1759,6 +1762,8 @@ First Aetheria surfaces to publish:
|
|||
resource-scanner and mining-tool runtime state surfaces use `BodyKey` fields;
|
||||
old `*BodyId` readback names and generic legacy reference parsers may not
|
||||
return.
|
||||
- `Aetheria.State.Verify` guards temporary `Faction` shell links: geoname and
|
||||
boss-hull relationships use typed keys, not legacy GUID projection fields.
|
||||
- Unity batchmode compile returned cleanly after the runtime blueprint rename;
|
||||
live Unity source has no `EntityPack`, `ShipPack`, `OrbitalEntityPack`,
|
||||
`ZonePack`, `PackedContents`, `PackZone`, `EntitySerializer.Pack`, or
|
||||
|
|
|
|||
Loading…
Reference in a new issue