Assembly is the maker's: re-land of h1 on 0f5def17 (net diff of ae300c6a..5187a59d)

Applies the net diff of eureka/aetheria-release-assembly-from-maker (5187a59d) without its catalog blob and RunStartTests residue, git apply -3, overlaps resolved on master's side. 066fb581's message ('git log --oneline -1') was a heredoc slip; the old branch stays as it is. Drops the Rarity = fixture member from the tests master added since ae300c6a. Faction keys 19-20 here are h1's; the next commit reshapes them to one Assembly at 19.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 18:55:16 +02:00
commit d23038f53c
67 changed files with 409 additions and 98 deletions

View file

@ -63,6 +63,15 @@ public class Faction
// The faction's rules of engagement; null fights as FactionDoctrine.Default.
[Inspectable, JsonProperty("doctrine"), Key(17)]
public FactionDoctrine Doctrine;
// The maker's final-assembly technology (mean) and quality control (deviation): the distribution every lot of
// theirs draws its own quality from, and the hard ceiling on every one of its roles (quality-lean-assembly-hard-ceiling).
// Key 18 is reserved for Livery and 16 for Relations.
[Inspectable, JsonProperty("assemblyMean"), Key(19)]
public float AssemblyMean = .5f;
[Inspectable, JsonProperty("assemblyDeviation"), Key(20)]
public float AssemblyDeviation = .15f;
}
[CultDocument("aetheria.namefile", "1"), Inspectable, MessagePackObject]

View file

@ -117,31 +117,20 @@ public class ItemManager
return (int) (GameplaySettings.QualityPriceModifier.Evaluate(GetLot(item).Quality) * data.Price);
}
// The tier roll every mint applies, whether or not the lot fills roles.
public float RollQuality()
{
var quality = Random.NextFloat();
var tier = GameplaySettings.Tiers[0];
foreach (var t in GameplaySettings.Tiers)
{
if (t.Rarity > quality)
tier = t;
}
return tier.Quality;
}
// Builds one of a manufacturer's branded products: the unit's own workmanship rolled as before, and each of
// the design's roles filled with a part whose quality is drawn from that manufacturer's distribution for it.
// 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)
{
var design = ItemData.Get(product.Design);
var maker = ItemData.Get(product.Manufacturer) ?? new Faction();
var lot = new Lot
{
Design = ItemData.RefOf<ItemData>(design),
Origin = new Attributed { Faction = product.Manufacturer },
Product = ItemData.RefOf(product),
Quality = RollQuality(),
Quality = clamp(Random.NextGaussian(maker.AssemblyMean, maker.AssemblyDeviation), .01f, 1),
Roles = new List<RoleFill>()
};
if (design.Roles != null)

View file

@ -72,18 +72,20 @@ public class Lot
// (console give, presets, extracted), which brand their maker only.
[Key(4)] public CultRecordRef<FactionProductData> Product;
// The quality a stat reads for one of the design's roles. An unnamed role, a design without roles, and a lot
// minted before roles existed all fall back to the lot's own workmanship.
// The quality a stat reads for one of the design's roles: the part's, capped by the lot's own final assembly
// (quality-lean-assembly-hard-ceiling), so a part better than its assembly is worth the assembly. An unnamed role, a
// design without roles, and a lot minted before roles existed all fall back to the lot's own workmanship.
public float QualityForRole(string role)
{
if (string.IsNullOrEmpty(role) || Roles == null) return Quality;
foreach (var fill in Roles)
if (fill.Role == role) return fill.Quality;
if (fill.Role == role) return Math.Min(fill.Quality, Quality);
return Quality;
}
}
// One filled slot: the design's role name and how good the part that went into it turned out to be.
// One filled slot: the design's role name and how good the part that went into it turned out to be. Stats read it through
// Lot.QualityForRole, capped by the lot's assembly; the raw value is kept for disassembly (named-components-after-demo).
[MessagePackObject]
public class RoleFill
{

View file

@ -306,5 +306,4 @@ public class RarityTier
public string Name;
public float Quality;
public float3 Color;
public float Rarity;
}

View file

@ -0,0 +1,35 @@
using System;
using System.Linq;
using System.Reflection;
using MessagePack;
using Xunit;
// The shipped catalog carries each maker's derived assembly, and the Faction format pins its wire positions
// (aetheria-release, cut assembly-from-maker).
public sealed class AssemblyFromMakerCatalogTests
{
[Fact]
public void ShippedCatalogCarriesDerivation()
{
using var cache = RestoredHullsTests.OpenCatalog();
var products = cache.GetAll<FactionProductData>().Where(p => p.Roles.Count > 0).ToArray();
var makers = products.Select(p => p.Manufacturer.Key).Distinct().ToArray();
Assert.NotEmpty(makers);
foreach (var key in makers)
{
var roles = products.Where(p => p.Manufacturer.Key.Equals(key)).SelectMany(p => p.Roles).ToArray();
var faction = cache.Get<Faction>(key);
Assert.Equal(Math.Round(roles.Average(r => r.Mean), 2), faction.AssemblyMean, 2);
Assert.Equal(Math.Round(roles.Average(r => r.StandardDeviation), 2), faction.AssemblyDeviation, 2);
}
}
// 16 is reserved for Relations, 17 is Doctrine, 18 is reserved for Livery.
[Fact]
public void AssemblyFieldsSitAtKeys19And20()
{
int KeyOf(string field) => typeof(Faction).GetField(field).GetCustomAttribute<KeyAttribute>().IntKey.Value;
Assert.Equal(19, KeyOf(nameof(Faction.AssemblyMean)));
Assert.Equal(20, KeyOf(nameof(Faction.AssemblyDeviation)));
}
}

View file

@ -0,0 +1,87 @@
using System;
using System.IO;
using System.Linq;
using GameCult.Caching;
using Xunit;
// assembly-from-maker (aetheria-release, cut assembly-from-maker): each maker's assembly distribution is derived from the
// roles of the products it manufactures.
public sealed class AssemblyFromMakerCommandTests : IDisposable
{
private readonly string _root = Path.Combine(Path.GetTempPath(), "aetheria-assembly-cmd-" + Guid.NewGuid().ToString("N"));
private string Catalog => Path.Combine(_root, "Aetheria.cc");
public AssemblyFromMakerCommandTests() => Directory.CreateDirectory(_root);
public void Dispose() => Directory.Delete(_root, true);
private void Seed()
{
using var cache = AetheriaStores.Open(Catalog, catalogWritable: true);
cache.Upsert(new VerseGrammar { Revision = 1 });
var maker = cache.Upsert(new Faction { Name = "Maker" });
cache.Upsert(new Faction { Name = "Bystander", AssemblyMean = .9f, AssemblyDeviation = .01f });
var gear = cache.Upsert(new GearData { Name = "Lamp", Hardpoint = HardpointType.Sensors, Shape = new Shape(), Price = 10 });
var design = new CultRecordRef<CraftedItemData>(gear.Key);
// Two products, three roles: the mean is over roles (.2, .4, .9 -> .5), the deviation likewise (.1, .1, .4 -> .2).
cache.Upsert(new FactionProductData
{
Name = "A", Design = design, Manufacturer = maker,
Roles = { new ProductRole { Role = "x", Mean = .2f, StandardDeviation = .1f }, new ProductRole { Role = "y", Mean = .4f, StandardDeviation = .1f } }
});
cache.Upsert(new FactionProductData
{
Name = "B", Design = design, Manufacturer = maker,
Roles = { new ProductRole { Role = "x", Mean = .9f, StandardDeviation = .4f } }
});
// Figures that need two decimals: (.2 + .27 + .31) / 3 = .26 and (.11 + .17 + .2) / 3 = .16.
var fine = cache.Upsert(new Faction { Name = "Fine" });
cache.Upsert(new FactionProductData
{
Name = "C", Design = design, Manufacturer = fine,
Roles =
{
new ProductRole { Role = "x", Mean = .2f, StandardDeviation = .11f },
new ProductRole { Role = "y", Mean = .27f, StandardDeviation = .17f },
new ProductRole { Role = "z", Mean = .31f, StandardDeviation = .2f }
}
});
cache.FlushAsync().Wait();
}
private string Run(bool apply)
{
using var cache = AetheriaStores.Open(Catalog, catalogWritable: apply);
var output = new StringWriter();
Assert.Equal(0, AssemblyFromMakerCommand.Run(cache, apply, output));
cache.FlushAsync().Wait();
return output.ToString();
}
[Fact]
public void DryRunWritesNothingApplyIsIdempotent()
{
Seed();
var before = File.ReadAllBytes(Catalog);
Assert.Contains("Maker", Run(apply: false));
Assert.Equal(before, File.ReadAllBytes(Catalog));
Run(apply: true);
using (var cache = AetheriaStores.Open(Catalog))
{
var maker = cache.GetAll<Faction>().Single(f => f.Name == "Maker");
Assert.Equal(.5f, maker.AssemblyMean, 3);
Assert.Equal(.2f, maker.AssemblyDeviation, 3);
var fine = cache.GetAll<Faction>().Single(f => f.Name == "Fine");
Assert.Equal(.26f, fine.AssemblyMean, 3);
Assert.Equal(.16f, fine.AssemblyDeviation, 3);
// A faction that manufactures nothing is written the field defaults.
var bystander = cache.GetAll<Faction>().Single(f => f.Name == "Bystander");
Assert.Equal(.5f, bystander.AssemblyMean, 3);
Assert.Equal(.15f, bystander.AssemblyDeviation, 3);
}
var written = File.ReadAllBytes(Catalog);
Assert.Contains("No changes", Run(apply: true));
Assert.Equal(written, File.ReadAllBytes(Catalog));
}
}

View file

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GameCult.Caching;
using Xunit;
// Assembly is the maker's (aetheria-release, cut assembly-from-maker; rulings quality-is-assembly-over-supply-chain,
// quality-lean-assembly-hard-ceiling): a branded lot's own quality is drawn from its manufacturer's assembly distribution,
// and every role a stat reads is min(part, assembly). Lots here come from CreateLot(product), the production mint.
public sealed class AssemblyFromMakerTests : IDisposable
{
private readonly string _root = Path.Combine(Path.GetTempPath(), "aetheria-assembly-" + Guid.NewGuid().ToString("N"));
private readonly CultCache _cache;
private readonly ItemManager _items;
private readonly CultRecordRef<CraftedItemData> _lens;
public AssemblyFromMakerTests()
{
Directory.CreateDirectory(_root);
_cache = AetheriaStores.Open(Path.Combine(_root, "Aetheria.cc"), catalogWritable: true);
var gear = _cache.Upsert(new GearData
{
Name = "Lensed", Hardpoint = HardpointType.Sensors, Shape = new Shape(), Price = 10,
Roles = { new ItemRole { Name = "lens" } }
});
_lens = new CultRecordRef<CraftedItemData>(gear.Key);
_items = new ItemManager(_cache, new ProvenanceLedger(), RunSaveTests.TestSettings(), _ => { });
}
public void Dispose()
{
_cache.Dispose();
Directory.Delete(_root, true);
}
private FactionProductData Product(string name, Faction maker, float partMean, float partDeviation = 0)
{
var makerRef = maker == null ? default : _cache.Upsert(maker);
_cache.Upsert(new FactionProductData
{
Name = name, Design = _lens, Manufacturer = makerRef,
Roles = { new ProductRole { Role = "lens", Mean = partMean, StandardDeviation = partDeviation } }
});
return _cache.GetAll<FactionProductData>().Single(p => p.Name == name);
}
private float[] Mint(FactionProductData product, int count) =>
Enumerable.Range(0, count).Select(_ => _items.Lots[_items.CreateLot(product)].Quality).ToArray();
// Two makers, assembly .3 and .8: each lot's own quality follows its manufacturer, not a product-blind roll.
[Fact]
public void LotQualityFollowsMaker()
{
var low = Product("Low", new Faction { Name = "Low Maker", AssemblyMean = .3f, AssemblyDeviation = .02f }, .5f);
var high = Product("High", new Faction { Name = "High Maker", AssemblyMean = .8f, AssemblyDeviation = .02f }, .5f);
var lows = Mint(low, 300);
var highs = Mint(high, 300);
Assert.InRange(lows.Average(), .27f, .33f);
Assert.InRange(highs.Average(), .77f, .83f);
Assert.True(lows.Max() < highs.Min(), "a lot read the other maker's band");
}
// Quality control is the maker's too: the same mean, a wide and a tight deviation, and the spread of their lots follows.
[Fact]
public void LotSpreadFollowsMakerDeviation()
{
var wide = Mint(Product("Wide", new Faction { Name = "Wide Maker", AssemblyMean = .5f, AssemblyDeviation = .2f }, .5f), 400);
var tight = Mint(Product("Tight", new Faction { Name = "Tight Maker", AssemblyMean = .5f, AssemblyDeviation = .02f }, .5f), 400);
double Spread(float[] lots) => Math.Sqrt(lots.Select(q => Math.Pow(q - lots.Average(), 2)).Average());
Assert.InRange(Spread(wide), .15, .25);
Assert.InRange(Spread(tight), .01, .04);
}
// A maker the catalog cannot resolve assembles at a new Faction's defaults.
[Fact]
public void UnresolvedMakerAssemblesAtDefaults()
{
var orphan = Product("Orphan", null, .5f);
var defaults = new Faction();
Assert.InRange(Mint(orphan, 400).Average(), defaults.AssemblyMean - .03f, defaults.AssemblyMean + .03f);
}
// The ceiling at the mint: a part drawn at .9 in an assembly of .4 reads .4; a part at .2 in the same assembly reads .2.
[Fact]
public void RoleCappedByAssembly()
{
var maker = new Faction { Name = "Capped", AssemblyMean = .4f, AssemblyDeviation = 0 };
var over = _items.Lots[_items.CreateLot(Product("Over", maker, .9f))];
var under = _items.Lots[_items.CreateLot(Product("Under", maker, .2f))];
Assert.Equal(.4f, over.Quality, 3);
Assert.Equal(.4f, over.QualityForRole("lens"), 3);
Assert.Equal(.2f, under.QualityForRole("lens"), 3);
// The raw part is kept for disassembly (named-components-after-demo).
Assert.Equal(.9f, over.Roles.Single().Quality, 3);
}
// The fallbacks still read the assembly: an unnamed role, an unrolled role, and a lot with no roles.
[Fact]
public void FallbacksReadTheAssembly()
{
var lot = new Lot { Quality = .4f, Roles = new List<RoleFill> { new RoleFill { Role = "lens", Quality = .9f } } };
Assert.Equal(.4f, lot.QualityForRole(null), 3);
Assert.Equal(.4f, lot.QualityForRole(""), 3);
Assert.Equal(.4f, lot.QualityForRole("ghost"), 3);
Assert.Equal(.4f, new Lot { Quality = .4f }.QualityForRole("lens"), 3);
}
// A Quality term on a role with part .9 and assembly .4 evaluates as if quality were .4, on a real minted instance.
[Fact]
public void QualityTermReadsCeiling()
{
var maker = new Faction { Name = "Capped", AssemblyMean = .4f, AssemblyDeviation = 0 };
var instance = (EquippableItem) _items.CreateInstance(_items.CreateLot(Product("Over", maker, .9f)));
var stat = new PerformanceStat { Min = 0, Max = 1, Terms = { new StatTerm { Source = StatSource.Quality, Exponent = 1, Role = "lens" } } };
Assert.Equal(.4f, _items.Evaluate(stat, instance), 3);
}
}

View file

@ -52,7 +52,7 @@ public sealed class BrownoutTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -322,7 +322,7 @@ public sealed class CatalogRoleTests
private sealed class DisciplineContext : IStatContext
{
public DisciplineContext(float discipline) =>
Lot = new Lot { Quality = .123f, Roles = new List<RoleFill> { new RoleFill { Role = "emission-discipline", Quality = discipline } } };
Lot = new Lot { Quality = 1f, Roles = new List<RoleFill> { new RoleFill { Role = "emission-discipline", Quality = discipline } } };
public Lot Lot { get; }
public float HeatFactor(float exponent) => 1f;
public float DurabilityFactor(float exponent) => 1f;

View file

@ -27,7 +27,7 @@ public sealed class ConditionRatioTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -334,14 +334,15 @@ public sealed class ConsumableSupplyTests : IDisposable
.Concat(Enumerable.Range(0, 4).Select(_ => rig.Items.Random.NextFloat())).ToArray();
}
// What the plain catalog leaves in both generators' Random, measured on the tree before consumables existed
// (origin/master d4a27def, the same fixture and seeds), plus the one product draw each of the three generated
// ships makes for its tractor beam (loot-2): with that draw taken out the tree leaves the d4a27def values
// 0.85624266, 0.037778974, 0.7931649, 0.3596493, 0.17511952, 0.6642336, 0.31897342, 0.5977364. The gated and
// plain catalogs agreeing is not enough: a step that drew unconditionally would draw in both. This pins the value itself.
// What the plain catalog leaves in both generators' Random: the d4a27def measurement (before consumables existed, the
// same fixture and seeds) plus the one product draw each of the three generated ships makes for its tractor beam
// (loot-2), re-measured when a lot's assembly became a Gaussian draw from its maker (assembly-from-maker), which
// consumes the item stream differently from the tier roll it replaced; the generator's own stream (the first four
// values) is unchanged. The gated and plain catalogs agreeing is not enough: a step that drew unconditionally would
// draw in both. This pins the value itself.
var beforeConsumables = new[]
{
0.3596493f, 0.03616327f, 0.8790466f, 0.16682059f, 0.5977364f, 0.08633745f, 0.2869571f, 0.6890472f
0.3596493f, 0.03616327f, 0.8790466f, 0.16682059f, 0.55950844f, 0.87309176f, 0.7170387f, 0.8490041f
};
var plainAfter = AfterGeneration(plain);
Assert.Equal(beforeConsumables, plainAfter);

View file

@ -146,7 +146,7 @@ public sealed class ConsumablesFirstSetTests
var second = design.Roles[1].Name;
var lot = Ship.ItemManager.Lots.Add(new Lot
{
Design = Cache.RefOf<ItemData>(design), Origin = new Attributed(), Quality = .5f,
Design = Cache.RefOf<ItemData>(design), Origin = new Attributed(), Quality = 1f,
Roles = new List<RoleFill>
{
new RoleFill { Role = first, Quality = propellantOrNozzleQuality },

View file

@ -176,7 +176,7 @@ public sealed partial class ContactRevealTests : IDisposable
_items = new ItemManager(_openCache, ledger, new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -90,7 +90,7 @@ public sealed class ContactTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f,
FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f, ContactRestitution = restitution

View file

@ -86,7 +86,7 @@ public sealed class DrawnPoseTests : IDisposable
var items = new ItemManager(cache, ledger, new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
ShipLayerHeight = ShipLayerHeight, OrbitalLayerHeight = OrbitalLayerHeight
}, _ => { });

View file

@ -316,7 +316,7 @@ public sealed partial class ContactRevealTests
}
// A catalog-style sensor reads its intercept factor through the lot the ship equips it from: the lot's
// emission-discipline fill is the input (the workmanship is a decoy at .123), so a Sensor that read only the quiet or only
// emission-discipline fill is the input (the workmanship, at 1, is a decoy), so a Sensor that read only the quiet or only
// the loud end, or the workmanship, reads the wrong number. The expectations are lerp(.5, 2, q^log2(3)): a middling part
// reads 1, the Lucent mean (.2) reads about .62 and the Finch mean (.8) about 1.55.
[Theory]
@ -325,7 +325,7 @@ public sealed partial class ContactRevealTests
[InlineData(.8f, 1.5534f)]
public void ASensorReadsItsInterceptFactorFromItsLotsEmissionDiscipline(float discipline, float expected)
{
var lot = _items.CreateLot(_openCache.GetByName<EquippableItemData>("Disciplined"), _maker, .123f);
var lot = _items.CreateLot(_openCache.GetByName<EquippableItemData>("Disciplined"), _maker, 1f);
_items.Lots[lot].Roles = new List<RoleFill> { new RoleFill { Role = "emission-discipline", Quality = discipline } };
_preparedLots["Disciplined"] = lot;
var ship = Add(float3(0, 0, 0), new[] { "Disciplined" });
@ -345,7 +345,7 @@ public sealed partial class ContactRevealTests
public void AnEmissionIsHeardWithinRangeOverTheLotsAlpha(bool ping, float distance, bool heard)
{
var design = ping ? "Disciplined" : "DisciplinedScanner";
var lot = _items.CreateLot(_openCache.GetByName<EquippableItemData>(design), _maker, .123f);
var lot = _items.CreateLot(_openCache.GetByName<EquippableItemData>(design), _maker, 1f);
_items.Lots[lot].Roles = new List<RoleFill> { new RoleFill { Role = "emission-discipline", Quality = .2f } };
_preparedLots[design] = lot;
var third = Add(float3(-distance, 0, 0), new[] { "Eye" });

View file

@ -37,7 +37,7 @@ public sealed class FireAuthorityTests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
FiringArc = 170,

View file

@ -37,7 +37,7 @@ public sealed class FireControlCut11Tests : IDisposable
private static GameplaySettings TestSettings(float schematicCellSize = 1f) => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -39,7 +39,7 @@ public sealed class FireControlCut123Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -41,7 +41,7 @@ public sealed partial class FireControlCut124Tests : IDisposable
private static GameplaySettings TestSettings(float commitHorizon = .5f) => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -38,7 +38,7 @@ public sealed class FireControlCut12Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -39,7 +39,7 @@ public sealed class FireControlCut4Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
FiringArc = 170,

View file

@ -37,7 +37,7 @@ public sealed class FireControlCut5Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -37,7 +37,7 @@ public sealed class FireControlCut6Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -36,7 +36,7 @@ public sealed class FireControlCut6cTests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -38,7 +38,7 @@ public sealed class FireControlCut6dTests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -40,7 +40,7 @@ public sealed class FireControlCut7Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .9f,
@ -210,7 +210,7 @@ public sealed class FireControlCut7Tests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};
var log = new List<string>();

View file

@ -36,7 +36,7 @@ public sealed class FireControlCut8Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -39,7 +39,7 @@ public sealed class FireControlCut9Tests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -39,7 +39,7 @@ public sealed class FireControlPerWeaponTests : IDisposable
{
OrbitalLayerHeight = orbitalLayerHeight,
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -33,7 +33,7 @@ public sealed class FireControlTests : IDisposable
{
ShipLayerHeight = shipLayerHeight,
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .5f,
FiringArc = 120

View file

@ -919,7 +919,7 @@ public sealed class FlightTests : IDisposable
var slots = MessagePack.MessagePackSerializer.Deserialize<object[]>(MessagePack.MessagePackSerializer.Serialize(faction,
CultDocumentMessagePackSerialization.OptionsFor(typeof(Faction).Assembly)));
Assert.Equal(18, slots.Length);
Assert.Equal(21, slots.Length);
Assert.Null(slots[16]);
var doctrine = Assert.IsType<object[]>(slots[17]);
Assert.Equal(6f, Convert.ToSingle(doctrine[1]));

View file

@ -36,7 +36,7 @@ public sealed class FloatingBodyTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};
var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { });
@ -180,7 +180,7 @@ public sealed class FloatingBodyTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};
var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { });

View file

@ -25,7 +25,7 @@ public sealed class FlowFieldTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f,
FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f

View file

@ -24,7 +24,7 @@ public sealed class GravitySubtractTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f,
FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f

View file

@ -20,7 +20,7 @@ public sealed class HeatResponseTests : IDisposable
private GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -65,7 +65,7 @@ public sealed class IffAndCombatTests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .5f
};

View file

@ -24,7 +24,7 @@ public sealed class InputCapacitorTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -102,7 +102,7 @@ public sealed class InspectionScannerCatalogTests
ledger.Lots[1] = new Lot { Origin = new Attributed(), Quality = .5f };
ledger.Lots[2] = new Lot
{
Origin = new Attributed(), Quality = .5f,
Origin = new Attributed(), Quality = 1f,
Roles = product.Roles.Select(r => new RoleFill { Role = r.Role, Quality = r.Mean }).ToList(),
};
var items = new ItemManager(Cache, ledger, settings, _ => { });

View file

@ -113,7 +113,7 @@ public sealed class LaunchSuppressorCatalogTests
for (var i = 1; i <= suppressorLot; i++) ledger.Lots[i] = new Lot { Origin = new Attributed(), Quality = .5f };
ledger.Lots[suppressorLot] = new Lot
{
Origin = new Attributed(), Quality = .5f,
Origin = new Attributed(), Quality = 1f,
Roles = new List<RoleFill> { new RoleFill { Role = "baffles", Quality = baffles }, new RoleFill { Role = "heat sink", Quality = sink } },
};
var items = new ItemManager(Cache, ledger, settings, _ => { });

View file

@ -37,7 +37,7 @@ public sealed class LayerTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
ShipLayerHeight = ShipHeight, OrbitalLayerHeight = OrbitalHeight, FloaterLayerHeight = FloaterHeight
};

View file

@ -489,8 +489,8 @@ public sealed class LoadoutTests : IDisposable
Assert.Equal(hardpointItems[0].item.Lot, hardpointItems[1].item.Lot);
}
// A Lamp lot with Quality .2 and one role fill (lens .9): a stat reading that role gets .9, one reading none
// gets .2, and GetTier reads .2.
// A Lamp lot with Quality .2 and one role fill (lens .15, under the assembly): a stat reading that role gets .15, one
// reading none gets .2, and GetTier reads .2.
[Fact]
public void StatsReadTheLot()
{
@ -500,8 +500,8 @@ public sealed class LoadoutTests : IDisposable
// quality", since every lot would resolve to the only tier regardless of its own Quality.
settings.Tiers = new[]
{
new RarityTier { Name = "Common", Quality = .2f, Rarity = 0, Color = new float3(1, 1, 1) },
new RarityTier { Name = "Rare", Quality = .5f, Rarity = 1, Color = new float3(1, 1, 1) }
new RarityTier { Name = "Common", Quality = .2f, Color = new float3(1, 1, 1) },
new RarityTier { Name = "Rare", Quality = .5f, Color = new float3(1, 1, 1) }
};
var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { });
var lamp = cache.GetByName<GearData>("Lamp");
@ -510,7 +510,7 @@ public sealed class LoadoutTests : IDisposable
Design = cache.RefOf<ItemData>(lamp),
Origin = new Attributed(),
Quality = .2f,
Roles = new List<RoleFill> { new RoleFill { Role = "lens", Quality = .9f } }
Roles = new List<RoleFill> { new RoleFill { Role = "lens", Quality = .15f } }
});
var rareLot = items.Lots.Add(new Lot
{
@ -524,7 +524,7 @@ public sealed class LoadoutTests : IDisposable
var withRole = new PerformanceStat { Min = 0, Max = 1, Terms = { new StatTerm { Source = StatSource.Quality, Exponent = 1, Role = "lens" } } };
var noRole = new PerformanceStat { Min = 0, Max = 1, Terms = { new StatTerm { Source = StatSource.Quality, Exponent = 1 } } };
Assert.Equal(.9f, items.Evaluate(withRole, instance), 3);
Assert.Equal(.15f, items.Evaluate(withRole, instance), 3);
Assert.Equal(.2f, items.Evaluate(noRole, instance), 3);
Assert.Equal(.2f, items.GetTier(instance).tier.Quality, 3);
Assert.Equal(.5f, items.GetTier(rareInstance).tier.Quality, 3);

View file

@ -43,7 +43,7 @@ public sealed class LockWarningTests : IDisposable
_items = new ItemManager(_openCache, ledger, new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -66,7 +66,7 @@ public sealed class LootTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f,
FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 1f,

View file

@ -72,7 +72,7 @@ public sealed class MineTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f,
FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f,

View file

@ -27,7 +27,7 @@ public sealed class MiningCut1Tests : IDisposable
private static GameplaySettings GameSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -31,7 +31,7 @@ public sealed class MiningCut2Tests : IDisposable
private static GameplaySettings GameSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -37,7 +37,7 @@ public sealed partial class MiningCut3Tests : IDisposable
private static GameplaySettings GameSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
// Settings.asset's own values for the three detection tunables.
VisibilityDecay = .5f,

View file

@ -63,7 +63,7 @@ public sealed class PaintModeTests : IDisposable
_items = new ItemManager(_openCache, ledger, new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -71,7 +71,7 @@ public sealed class PickupTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f,
FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 1f,

View file

@ -64,7 +64,7 @@ public sealed class PopulatedRadiusTests : IDisposable
var items = new ItemManager(cache, new ProvenanceLedger(), new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
}, _ => { });

View file

@ -28,7 +28,7 @@ public sealed class PotentialOwnerTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};
_items = new ItemManager(_cache, new ProvenanceLedger(), settings, _ => { });

View file

@ -27,7 +27,7 @@ public sealed class PowerBusTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -36,7 +36,7 @@ public sealed class PowerCurveTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -27,7 +27,7 @@ public sealed class PowerTierTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -20,7 +20,7 @@ public sealed class RoleAuthoringTests : IDisposable
private GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};
@ -84,7 +84,7 @@ public sealed class RoleAuthoringTests : IDisposable
public void TwoProductsOfOneDesignWithDifferentRoleMeansResolveDifferentValues()
{
using var cache = AetheriaStores.Open(Catalog, catalogWritable: true);
var makerRef = cache.Upsert(new Faction { Name = "Maker", ShortName = "MKR" });
var makerRef = cache.Upsert(new Faction { Name = "Maker", ShortName = "MKR", AssemblyMean = 1f, AssemblyDeviation = 0 });
var lensGear = cache.Upsert(new GearData
{
Name = "Lensed", Hardpoint = HardpointType.Sensors, Shape = new Shape(), Price = 10,

View file

@ -693,7 +693,7 @@ public sealed class RunSaveTests : IDisposable
internal static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -32,7 +32,7 @@ public sealed class ShieldReserveTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -45,7 +45,7 @@ public sealed class SignatureTests : IDisposable
private GameplaySettings Settings(float visibilityDecay) => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = .1f,
TargetGearInfoThreshold = .8f,

View file

@ -26,7 +26,7 @@ public sealed class StatResolverTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -34,7 +34,7 @@ public sealed class TargetingSystemTests : IDisposable
private static GameplaySettings TestSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetGearInfoThreshold = .9f,
UnaidedAccuracy = .1f,

View file

@ -24,7 +24,7 @@ public sealed class ThrottleLockTests : IDisposable
private static GameplaySettings Settings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TorqueMultiplier = 1f
};

View file

@ -61,7 +61,7 @@ public sealed class VapourCloudTests : IDisposable
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp(),
TargetDetectionInfoThreshold = Threshold, TargetGearInfoThreshold = .8f,
TargetInfoDecay = .5f, VisibilityDecay = 0f,

View file

@ -32,7 +32,7 @@ public sealed class ZonePlacedAtBuildTests : IDisposable
private static GameplaySettings GameSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -27,7 +27,7 @@ internal sealed class ZoneWorlds : IDisposable
private static GameplaySettings GameSettings() => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};

View file

@ -0,0 +1,70 @@
/* 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 System.IO;
using System.Linq;
using GameCult.Caching;
// assembly-from-maker [apply] (aetheria-release, cut assembly-from-maker; rulings quality-is-assembly-over-supply-chain,
// quality-lean-assembly-hard-ceiling): derives each maker's final-assembly distribution from the products it sells. A faction
// that manufactures at least one product with roles gets AssemblyMean = the mean of those products' role means and
// AssemblyDeviation = the mean of their standard deviations, rounded to 2 dp; every other faction gets the field defaults.
// The derivation reads the products, so it replays last, after every command that adds products or factions. A faction that
// already holds the derived values is not rewritten, so a rerun writes nothing. Dry run unless apply.
public static class AssemblyFromMakerCommand
{
// The distribution a maker's roled products imply: the mean over every role of every product, so a product with more
// roles weighs more. Null when there is no role to average.
public static (float Mean, float Deviation)? Derive(IEnumerable<FactionProductData> products)
{
var roles = products.SelectMany(p => p.Roles ?? new List<ProductRole>()).ToArray();
if (roles.Length == 0) return null;
return ((float) Math.Round(roles.Average(r => r.Mean), 2), (float) Math.Round(roles.Average(r => r.StandardDeviation), 2));
}
public static int Run(CultCache cache, bool apply, TextWriter output)
{
var defaults = new Faction();
var byMaker = cache.GetAll<FactionProductData>()
.GroupBy(p => p.Manufacturer.Key)
.Select(g => (Maker: g.Key, Derived: Derive(g)))
.Where(m => m.Derived != null)
.ToDictionary(m => m.Maker, m => m.Derived.Value);
var changed = new List<Faction>();
foreach (var faction in cache.GetAll<Faction>().OrderBy(f => f.Name, StringComparer.Ordinal))
{
var (mean, deviation) = byMaker.TryGetValue(cache.RefOf(faction).Key, out var derived)
? derived
: (defaults.AssemblyMean, defaults.AssemblyDeviation);
if (faction.AssemblyMean == mean && faction.AssemblyDeviation == deviation) continue;
output.WriteLine($"{faction.Name}: assembly {faction.AssemblyMean:0.##}±{faction.AssemblyDeviation:0.##} -> {mean:0.##}±{deviation:0.##}");
faction.AssemblyMean = mean;
faction.AssemblyDeviation = deviation;
changed.Add(faction);
}
if (changed.Count == 0)
{
output.WriteLine("No changes.");
return 0;
}
if (!apply)
{
output.WriteLine($"\nDry run. Pass \"apply\" to write {changed.Count} factions.");
return 0;
}
foreach (var faction in changed) CultRecordRefs.Validate(faction);
cache.Commit(batch =>
{
foreach (var faction in changed) batch.Upsert(typeof(Faction), faction, cache.RefOf(faction).Key);
});
output.WriteLine($"\nWrote {changed.Count} factions in Aetheria.cc");
return 0;
}
}

View file

@ -57,9 +57,10 @@ public static class Program
case "inspection-scanner": return InspectionScannerCatalog(args.Contains("apply"));
case "product-lines": return ProductLinesCommand.Run(args.Skip(1).ToArray());
case "minor-power-factions": return MinorPowerFactionsCommand.Run(args.Skip(1).ToArray());
case "assembly-from-maker": return AssemblyFromMakerCommand.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out);
case "doctrine-catalog": return DoctrineCatalog.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out);
default:
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective <fraction>] [--end <multiplier>], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], product-lines weapons|minor-powers|gear [apply], doctrine-catalog [apply]");
Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear <Type.Member>]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective <fraction>] [--end <multiplier>], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], product-lines weapons|minor-powers|gear [apply], doctrine-catalog [apply], assembly-from-maker [apply]");
return 1;
}
}
@ -557,7 +558,7 @@ public static class Program
Console.WriteLine($" zone radius curve {zones.ZoneRadius?.Minimum}-{zones.ZoneRadius?.Maximum} exponent {zones.ZoneRadius?.Exponent}");
Console.WriteLine($" sub zone count {zones.SubZoneCount?.Minimum}-{zones.SubZoneCount?.Maximum} exponent {zones.SubZoneCount?.Exponent}");
Console.WriteLine($"gameplay: weapon groups {gameplay.WeaponGroupCount}, shutdown performance {gameplay.DefaultEntitySettings?.ShutdownPerformance}");
Console.WriteLine($" tiers: {string.Join(", ", (gameplay.Tiers ?? new RarityTier[0]).Select(t => $"{t.Name} q{t.Quality} r{t.Rarity}"))}");
Console.WriteLine($" tiers: {string.Join(", ", (gameplay.Tiers ?? new RarityTier[0]).Select(t => $"{t.Name} q{t.Quality}"))}");
Console.WriteLine($" price modifier {gameplay.QualityPriceModifier?.Minimum}-{gameplay.QualityPriceModifier?.Maximum} exponent {gameplay.QualityPriceModifier?.Exponent}");
// Assert counts, not non-null: an empty array reads as populated and would make every number a fixture
@ -792,7 +793,7 @@ public static class Program
var settings = new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } },
QualityPriceModifier = new ExponentialLerp()
};