Wren becomes a test fixture; compose and validate refuse an offered hull with no schematic
Move the starter-box aetheria.wren package from GameData/Mods to tests/fixtures/mods (LFS rule added) so it no longer ships; the Wren tests compose it through TestCatalog.RepoWithFixtures. ShipModCatalog.SchematicFault, built on LoadoutGenerator.IsOffered, excludes an offered hull with no schematic lines at compose and is reported by ship-authoring validate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3b7b55f384
commit
ce5d012540
13 changed files with 121 additions and 9 deletions
|
|
@ -110,6 +110,7 @@ public static class ShipModCatalog
|
|||
if (shipIds.Contains(ship.Id))
|
||||
Exclude(directory, $"ship ID collides with an existing catalog ship authoring record.");
|
||||
if (StationKinds.HullKindFault(cache, hull) is { } kindFault) Exclude(directory, kindFault);
|
||||
if (SchematicFault(cache, ship, package.Products) is { } schematicFault) Exclude(directory, schematicFault);
|
||||
foreach (var product in package.Products)
|
||||
{
|
||||
if (!factionKeys.Contains(product.Manufacturer.Key))
|
||||
|
|
@ -157,6 +158,18 @@ public static class ShipModCatalog
|
|||
}
|
||||
}
|
||||
|
||||
// Why a package's hull cannot go on the market, or null: a hull offered through any of its products is drawn on the map and
|
||||
// the schematic by its lines (ShipModVisual.BuildLineMesh builds nothing from none), so an offered hull without any is
|
||||
// excluded. An unoffered stand-in is left alone. Offered is LoadoutGenerator.IsOffered, the one reader of NotOffered
|
||||
// (ruling off-market-is-unoffered-product); `items` is the catalog the products' bins resolve in. A product whose bin
|
||||
// line the catalog does not hold is not judged here: the catalog read refuses it.
|
||||
public static string SchematicFault(CultCache items, ShipAuthoring ship, FactionProductData[] products)
|
||||
{
|
||||
if (ship.SchematicLines != null && ship.SchematicLines.Any(line => line?.Points != null && line.Points.Length > 0)) return null;
|
||||
var offered = products.Any(product => (product.Bin == null || items.Get(product.Bin.Line) != null) && LoadoutGenerator.IsOffered(items, product));
|
||||
return offered ? $"{ship.Id}: the hull is offered on the market but has no schematic lines." : null;
|
||||
}
|
||||
|
||||
public static Package ReadPackage(string shipPath)
|
||||
{
|
||||
var path = Path.GetFullPath(shipPath);
|
||||
|
|
|
|||
Loading…
Reference in a new issue