Economy batch 1 (munitions): apply Munitions to the shipped catalog; re-pin what the catalog stales
economy author Munitions apply: 49 added, 4 changed. The pins that name the shipped catalog's contents follow it: the kind list gains munitions-works, the simple commodity count, the retirement check counts only its own stand-in, the stand-in liveness check exempts a faction awaiting its first station model (Zhestokost), and generated stations draw from the fieldable kinds. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fce8c66284
commit
b1b5031e4b
3 changed files with 17 additions and 6 deletions
BIN
GameData/Aetheria.cc
(Stored with Git LFS)
BIN
GameData/Aetheria.cc
(Stored with Git LFS)
Binary file not shown.
|
|
@ -13,7 +13,7 @@ public sealed class CommodityRecordsTests
|
|||
public void ShippedCatalogOpensWithTheRetiredKeysGone()
|
||||
{
|
||||
using var cache = RestoredHullsTests.OpenCatalog();
|
||||
Assert.Equal(13, cache.GetAll<SimpleCommodityData>().Count());
|
||||
Assert.Equal(22, cache.GetAll<SimpleCommodityData>().Count());
|
||||
Assert.Equal(51, cache.GetAll<CompoundCommodityData>().Count());
|
||||
Assert.Contains(cache.GetAll<SimpleCommodityData>(), c => c.Name == "Ammo");
|
||||
Assert.All(cache.GetAll<CompoundCommodityData>(), c => Assert.False(string.IsNullOrEmpty(c.Name)));
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ public sealed class StationKindTests : IDisposable
|
|||
Assert.True(station.Kind.IsSet(), "a placed station has a kind");
|
||||
Assert.Equal(station.Kind.Key, w.HullOf(station).Kind.Key);
|
||||
var faction = w.Cache.Get(station.Faction);
|
||||
var kinds = StationKinds.KindsOf(w.Cache, faction);
|
||||
var kinds = StationKinds.FieldableKindsOf(w.Cache, faction);
|
||||
if (kinds.Length > 0) Assert.Contains(station.Kind.Key.Value, kinds.Select(kind => kind.Key.Value));
|
||||
}
|
||||
}
|
||||
|
|
@ -433,19 +433,30 @@ public sealed class StationKindTests : IDisposable
|
|||
var ids = new[]
|
||||
{
|
||||
"mining", "volatiles", "agriculture", "processing", "fabrication", "shipyard", "depot", "trade-hub", "residential",
|
||||
"habitat-support", "urban", "administrative", "power", "research", "salvage", "black-market", "waystation"
|
||||
"habitat-support", "urban", "administrative", "power", "research", "salvage", "black-market", "waystation", "munitions-works"
|
||||
};
|
||||
Assert.Equal(ids.Select(id => StationKindData.KeyOf(id).Value).OrderBy(key => key, StringComparer.Ordinal),
|
||||
cache.GetAll<StationKindData>().Select(kind => cache.RefOf(kind).Key.Value).OrderBy(key => key, StringComparer.Ordinal));
|
||||
Assert.Equal(StationKindData.KeyOf("trade-hub").Value, cache.GetAll<HullData>().Single(h => h.Name == "Zenith").Kind.Key.Value);
|
||||
}
|
||||
|
||||
// Factions whose first station model has not landed (ruling faction-station-models): their stand-ins name the kind that model
|
||||
// will be and are not yet live. The generator seats such a faction by the any-maker fallback (StationKinds.Choose). Each is
|
||||
// checked to still own no station hull, so the exemption ends the day a model lands.
|
||||
private static readonly string[] AwaitingFirstModel = { "Zhestokost" };
|
||||
|
||||
private static void AssertStandInsLive(CultCache cache)
|
||||
{
|
||||
foreach (var kind in cache.GetAll<StationKindData>())
|
||||
foreach (var standIn in kind.StandIns)
|
||||
{
|
||||
var faction = cache.Get(standIn.Faction);
|
||||
if (AwaitingFirstModel.Contains(faction.Name))
|
||||
{
|
||||
Assert.DoesNotContain(cache.GetAll<FactionProductData>(), p => cache.Get(p.Manufacturer) == faction && LoadoutGenerator.IsOffered(cache, p)
|
||||
&& cache.Get(p.Design) is HullData { HullType: HullType.Station });
|
||||
continue;
|
||||
}
|
||||
var models = StationKinds.KindsOf(cache, faction);
|
||||
var own = cache.GetAll<FactionProductData>().Where(p => cache.Get(p.Manufacturer) == faction && LoadoutGenerator.IsOffered(cache, p))
|
||||
.Select(p => cache.Get(p.Design) as HullData).Where(h => h != null && h.HullType == HullType.Station).Select(h => h.Kind.Key).ToArray();
|
||||
|
|
@ -470,7 +481,7 @@ public sealed class StationKindTests : IDisposable
|
|||
var live = World.Make(this, zenithOffered: false);
|
||||
live.Sell(live.Au, "mining");
|
||||
live.StandIn("shipyard", live.Au, "mining");
|
||||
Assert.Single(live.Cache.GetAll<StationKindData>().SelectMany(kind => kind.StandIns));
|
||||
Assert.Single(live.Cache.GetAll<StationKindData>().SelectMany(kind => kind.StandIns), standIn => live.Cache.Get(standIn.Faction) == live.Au);
|
||||
AssertStandInsLive(live.Cache);
|
||||
|
||||
var retired = World.Make(this, zenithOffered: false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue