StationKinds: FieldableKindsOf is the pool Choose draws from
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fe7ea72c9b
commit
fce8c66284
1 changed files with 10 additions and 3 deletions
|
|
@ -52,6 +52,14 @@ public static class StationKinds
|
||||||
return Ordered(kinds);
|
return Ordered(kinds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The kinds this faction places that a station can be drawn for: those whose hull kind (its own model, else its stand-in's) some
|
||||||
|
// maker offers. A stand-in whose model has not landed leaves its kind out.
|
||||||
|
public static CultRecordRef<StationKindData>[] FieldableKindsOf(CultCache catalog, Faction faction)
|
||||||
|
{
|
||||||
|
var offered = OfferedKinds(catalog);
|
||||||
|
return KindsOf(catalog, faction).Where(kind => offered.Contains(HullKindFor(catalog, faction, kind).Key.Value)).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// A station's kind: a stable pick among the faction's kinds it can field, by the station's site, which generation names by the
|
// A station's kind: a stable pick among the faction's kinds it can field, by the station's site, which generation names by the
|
||||||
// zone's seed and the station's place in its orbit order (never by a key the cache mints). It draws nothing from any random
|
// zone's seed and the station's place in its orbit order (never by a key the cache mints). It draws nothing from any random
|
||||||
// stream, so adding the kind to generation moves no other roll. A kind the faction places but cannot field (neither its own
|
// stream, so adding the kind to generation moves no other roll. A kind the faction places but cannot field (neither its own
|
||||||
|
|
@ -60,11 +68,10 @@ public static class StationKinds
|
||||||
// Unset when the catalog has none.
|
// Unset when the catalog has none.
|
||||||
public static CultRecordRef<StationKindData> Choose(CultCache catalog, Faction faction, string site, Action<string> log = null)
|
public static CultRecordRef<StationKindData> Choose(CultCache catalog, Faction faction, string site, Action<string> log = null)
|
||||||
{
|
{
|
||||||
var offered = OfferedKinds(catalog);
|
var pool = FieldableKindsOf(catalog, faction);
|
||||||
var pool = KindsOf(catalog, faction).Where(kind => offered.Contains(HullKindFor(catalog, faction, kind).Key.Value)).ToArray();
|
|
||||||
if (pool.Length == 0)
|
if (pool.Length == 0)
|
||||||
{
|
{
|
||||||
pool = Ordered(offered);
|
pool = Ordered(OfferedKinds(catalog));
|
||||||
if (pool.Length == 0) return default;
|
if (pool.Length == 0) return default;
|
||||||
log?.Invoke($"{faction?.Name ?? "This galaxy"} builds no station kind it can field; placing a station of any kind some maker offers.");
|
log?.Invoke($"{faction?.Name ?? "This galaxy"} builds no station kind it can field; placing a station of any kind some maker offers.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue