Aetheria/Assets/Scripts/ServerShared/FactionProduct.cs
Meta Vens 30597b0e45 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>
2026-10-17 19:03:12 +02:00

65 lines
2.7 KiB
C#

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
using System;
using System.Collections.Generic;
using GameCult.Caching;
using MessagePack;
using Newtonsoft.Json;
// A manufacturer's branded variant of a generic design: its name, its flavor text, and how it builds each of
// the design's roles. Which products exist is what a faction makes, so market segmentation and regional
// progression are authored here rather than as duplicate item entries.
[CultDocument("aetheria.factionproductdata", "1"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class FactionProductData
{
[Inspectable, CultName, JsonProperty("name"), Key(1)]
public string Name;
[Inspectable, CultInspectorTextArea, JsonProperty("description"), Key(2)]
public string Description;
[Inspectable, JsonProperty("design"), Key(3)]
public CultRecordRef<CraftedItemData> Design;
[Inspectable, JsonProperty("manufacturer"), Key(4)]
public CultRecordRef<Faction> Manufacturer;
[Inspectable, JsonProperty("roles"), Key(5)]
public List<ProductRole> Roles = new List<ProductRole>();
// This line's own final test (maker-design-tiers-allowed): a binned or premium line is a better assembly as well as better
// parts. Null assembles as its maker does.
[Inspectable, JsonProperty("assembly"), Key(6)]
public AssemblyDistribution Assembly;
}
// How good this product's part is in one of its design's roles: a pseudo-gaussian distribution whose mean is
// the technology the manufacturer puts in and whose standard deviation is their quality control. A market
// segment is a second product with a role pumped up; what makes that part better is the flavor text's to tell,
// because a part here carries quality and nothing else.
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class ProductRole
{
[Inspectable, JsonProperty("role"), Key(0)]
public string Role;
[Inspectable, JsonProperty("mean"), Key(1)]
public float Mean = .5f;
[Inspectable, JsonProperty("standardDeviation"), Key(2)]
public float StandardDeviation = .15f;
}
// How well a maker puts the thing together: the technology and quality control of final assembly. A lot's own quality is drawn
// from it, and it is the ceiling on every role the lot fills. Defaults are a middling maker.
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class AssemblyDistribution
{
[Inspectable, JsonProperty("mean"), Key(0)]
public float Mean = .5f;
[Inspectable, JsonProperty("standardDeviation"), Key(1)]
public float StandardDeviation = .15f;
}