Every reader of an item's quality reads Lot.EffectiveQuality

Price, tier, equipped thermal and durability exponents, wear and the unequipped durability exponent now read the one effective quality; no reader keeps a path to the assembly alone. Tests pin each reader against a lot whose part sits below its assembly. Unverified until the Yggdrasil run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-18 07:09:31 +02:00
commit 174bdaded1
5 changed files with 86 additions and 21 deletions

View file

@ -2189,16 +2189,17 @@ public class EquippedItem : IStatContext
Hardpoint = hardpoint;
EquippableItem = item;
Lot = ItemManager.GetLot(item);
var quality = Lot.EffectiveQuality();
Position = position;
Conductivity = Data.Conductivity;
ThermalExponent = lerp(
ItemManager.GameplaySettings.ThermalQualityMin,
ItemManager.GameplaySettings.ThermalQualityMax,
pow(Lot.Quality, ItemManager.GameplaySettings.ThermalQualityExponent));
pow(quality, ItemManager.GameplaySettings.ThermalQualityExponent));
DurabilityExponent = lerp(
ItemManager.GameplaySettings.DurabilityQualityMin,
ItemManager.GameplaySettings.DurabilityQualityMax,
pow(Lot.Quality, ItemManager.GameplaySettings.DurabilityQualityExponent));
pow(quality, ItemManager.GameplaySettings.DurabilityQualityExponent));
var hullData = itemManager.GetData(entity.Hull);
InsetShape = hullData.Shape.Inset(Data.Shape, position, item.Rotation);
if (Entity.Temperature != null) oldTemperature = Temperature;
@ -2369,7 +2370,7 @@ public class EquippedItem : IStatContext
Entity.Resolver.InvalidateSource(this, StatSource.Durability);
var performanceThreshold = Entity.Settings.ShutdownPerformance;
Wear = (1 - pow(ThermalPerformance,
(1 - pow(Lot.Quality, ItemManager.GameplaySettings.QualityWearExponent)) *
(1 - pow(Lot.EffectiveQuality(), ItemManager.GameplaySettings.QualityWearExponent)) *
ItemManager.GameplaySettings.ThermalWearExponent) +
deltaTemp * ItemManager.GameplaySettings.DeltaTempWearExponent
) * Data.Durability / Data.ThermalResilience;

View file

@ -688,7 +688,7 @@ public class StatTerm
{
[JsonProperty("source"), Key(0)] public StatSource Source;
[JsonProperty("exponent"), Key(1)] public float Exponent;
// The design role whose part quality this term reads; unset reads the item's own workmanship quality.
// The design role whose part quality this term reads; unset reads the item's effective quality (Lot.EffectiveQuality).
// Njordr states the same rule as a derivation over dimensions; this is that rule with one dimension.
[Inspectable, JsonProperty("role"), Key(2)] public string Role;
}

View file

@ -82,7 +82,7 @@ public class ItemManager
return result;
}
// The unequipped case: quality and durability read live off the item and its lot; heat and modifiers do not
// The unequipped case: quality (the lot's effective quality) and durability read live off the item and its lot; heat and modifiers do not
// exist without an entity, so they resolve as the identity for their term rather than a bespoke formula.
private sealed class UnequippedStatContext : IStatContext
{
@ -99,7 +99,7 @@ public class ItemManager
_durabilityExponent = lerp(
items.GameplaySettings.DurabilityQualityMin,
items.GameplaySettings.DurabilityQualityMax,
pow(Lot.Quality, items.GameplaySettings.DurabilityQualityExponent));
pow(Lot.EffectiveQuality(), items.GameplaySettings.DurabilityQualityExponent));
}
public float HeatFactor(float exponent) => 1f;
@ -111,10 +111,11 @@ public class ItemManager
public float ConstantModifier(PerformanceStat stat) => 0f;
}
// Price follows effective quality (price-follows-effective-quality), so a sleeper's over-specced parts do not show in it.
public int GetPrice(CraftedItemInstance item)
{
var data = GetData(item);
return (int) (GameplaySettings.QualityPriceModifier.Evaluate(GetLot(item).Quality) * data.Price);
return (int) (GameplaySettings.QualityPriceModifier.Evaluate(GetLot(item).EffectiveQuality()) * data.Price);
}
// Builds one of a manufacturer's branded products (quality-is-assembly-over-supply-chain): the unit's own quality is its
@ -222,9 +223,10 @@ public class ItemManager
public string Title(ItemInstance item) =>
(item is CraftedItemInstance crafted ? Brand(crafted).Product?.Name : null) ?? GetData(item).Name;
// The tier name and colour follow price, so they hide the same sleepers.
public (RarityTier tier, int upgrades) GetTier(CraftedItemInstance item)
{
var quality = GetLot(item).Quality;
var quality = GetLot(item).EffectiveQuality();
var tier = GameplaySettings.Tiers[0];
foreach (var t in GameplaySettings.Tiers)
if (quality + .001f > t.Quality)