Use typed keys for faction shell links

This commit is contained in:
Meta Vens 2026-06-16 11:22:18 +01:00
commit 392c24a7da
6 changed files with 48 additions and 10 deletions

View file

@ -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;

View file

@ -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();