Assembly is an AssemblyDistribution: Faction key 19, optional per product, stated-quality mint

Replaces h1's AssemblyMean/AssemblyDeviation floats with one Faction.Assembly (key 19, null = not authored) and adds FactionProductData.Assembly (key 6, null = its maker's). CreateLot(product) draws from product.Assembly, else the maker's, else AssemblyDistribution defaults; CreateLot(product, quality) mints the lot and every fill at a stated quality and draws nothing. assembly-from-maker now seeds part mean + .1 and writes only a null Assembly.

The shipped-catalog test is red until the catalog commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 19:03:12 +02:00
commit 30597b0e45
8 changed files with 160 additions and 78 deletions

View file

@ -118,19 +118,24 @@ public class ItemManager
}
// Builds one of a manufacturer's branded products (quality-is-assembly-over-supply-chain): the unit's own quality is its
// final assembly, drawn from the maker's assembly distribution, and each of the design's roles is filled with a part whose
// quality is drawn from the product's distribution for it. A maker the catalog cannot resolve assembles at a new Faction's
// defaults.
public int CreateLot(FactionProductData product)
// final assembly, drawn from the product's assembly distribution, else its maker's, else AssemblyDistribution's defaults,
// and each of the design's roles is filled with a part whose quality is drawn from the product's distribution for it.
public int CreateLot(FactionProductData product) => Mint(product, null);
// The same lot at a stated quality: the assembly and every role fill are that quality and nothing is drawn, so a staged
// fit does not ride the item stream (ScenarioStage.Fit).
public int CreateLot(FactionProductData product, float quality) => Mint(product, clamp(quality, .01f, 1));
private int Mint(FactionProductData product, float? stated)
{
var design = ItemData.Get(product.Design);
var maker = ItemData.Get(product.Manufacturer) ?? new Faction();
var assembly = product.Assembly ?? ItemData.Get(product.Manufacturer)?.Assembly ?? new AssemblyDistribution();
var lot = new Lot
{
Design = ItemData.RefOf<ItemData>(design),
Origin = new Attributed { Faction = product.Manufacturer },
Product = ItemData.RefOf(product),
Quality = clamp(Random.NextGaussian(maker.AssemblyMean, maker.AssemblyDeviation), .01f, 1),
Quality = stated ?? clamp(Random.NextGaussian(assembly.Mean, assembly.StandardDeviation), .01f, 1),
Roles = new List<RoleFill>()
};
if (design.Roles != null)
@ -140,7 +145,7 @@ public class ItemManager
lot.Roles.Add(new RoleFill
{
Role = role.Name,
Quality = clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
Quality = stated ?? clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
});
}