Commit graph Aetheria/Assets/Scripts/ServerShared/ItemManager.cs
Author SHA1 Message Date
Meta Vens
aaab561f98 Consumable host: initialise at activation, dispose at expiry, instantiate consumables
ActivateConsumable runs Initialize on the effect's behaviours; expiry disposes
them before Resolver.Forget, so a consumable's modifiers exist exactly while
its effect is active. ItemManager.CreateInstance returns a ConsumableItem for a
consumable design. StatResolver.DetachModifier drops an entry left with
nothing attached, so ModifierEntryCount returns to baseline. LoadoutTests'
hand-built ConsumableItem goes through CreateInstance. Builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 20:19:22 +02:00
Meta Vens
ec081b9b6d Brand: ItemData.Get already refuses an unset ref; drop the duplicate IsSet guard
Stryker's one survivor in the first sweep was the guard's `true ?` mutant: the
cache's Get(ref) extension already returns null for an unset reference, so the
guard was a second path. Adds the removed-product fact the spec names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 19:04:09 +02:00
Meta Vens
978632bc26 A lot records its product: Lot.Product owns an item's brand, Brand reads it
Brand no longer re-derives the product from maker and design (key-first pick);
CreateLot(product) is the one writer of Lot.Product. The census duplicate-brand
block and the key-order tie-break test go with the derivation they policed.
Unverified at this commit; build and tests follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:45:56 +02:00
Meta Vens
7f700d3c78 Items are titled by their product: ItemManager.Title, read by every title site
Title derives the brand's product name and falls back to the design name.
The trade list, buy dialog and properties title read it; the product name
line leaves the properties body. Build not yet verified at this commit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-08 14:34:47 +02:00
Meta Vens
05b5a209db Cut 1: terms replace the four fixed exponents; R-heat
PerformanceStat's four fixed fields (HeatExponentMultiplier,
DurabilityExponentMultiplier, QualityExponent, FromRole) tombstone into a
declared List<StatTerm> (source + exponent + role), walked by the one
evaluation path Cut 0 unified. A stat with no terms resolves to Max (the
same identity a stat with all-zero exponents already produced), so the
migration is exact: a zero multiplier becomes no term, not a term with
exponent 0.

R-heat (operator, docs/stats-and-power-cut.md): EquippableItemData's
HeatPerformanceCurve (a BezierCurve, plus the 100-sample scan that inferred
OptimalTemperature and its cache) is retired in favor of an authored
minimum, maximum, optimum and plateau width, with linear falloff outside
the plateau. StatValidation refuses an optimum outside its bounds or a
negative plateau width, loudly, at catalog load. The plateau's consequence
rides along for free: Wear's thermal term is pow(ThermalPerformance, ...),
and Performance() now returns exactly 1 across the plateau, so a
well-managed item takes wear only from deltaTemp there -- the
operational-lifespan lever the operator asked for.

ConsumableItemEffect's progress-through-duration substitution for "heat"
becomes its own StatSource (ConsumableProgress) rather than an unconditional
override applied regardless of what a stat declares.

Tests: LoadoutTests' four PerformanceStat-shaped fixtures rebuilt against
Terms/authored heat fields; HeatResponseTests.cs (new) pins load
validation, the plateau shape, and the three wear-lever claims (held
inside takes no thermal wear, held outside does, a fast swing across still
wears) each under its own mutation in tests/mutation_tests_stats_power_cut1.py
(new, 10 rules including a no-op control; all pass).

64 pre-Cut-1 tests still pass unmodified; 71 total with the 7 new ones.
Unity batchmode: 0 error CS. ShieldPanelCut1Verify and Cut2Verify pass;
Cut3Verify fails with an unrelated pre-existing "Kernel 'KInit' not found"
compute-shader error, reproduced against Cut 0's own landing state with no
shader/compute file in this diff -- flagged for Soul, not fixed here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 17:18:06 +02:00
Meta Vens
e9b688de51 Cut 0: collapse the three disagreeing stat evaluate bodies into one
ItemManager.Evaluate (unequipped), ConsumableItemEffect.Evaluate and
EquippedItem.Evaluate each hand-computed the same quality/durability/heat/
modifier arithmetic with small, undocumented disagreements (docs/stats-and-
power-cut.md Sec 0.2). Collapse the arithmetic into one function,
PerformanceStat.Evaluate(IStatContext), fed by three IStatContext
implementations: EquippedItem (the only one with heat, live durability and
modifiers), ConsumableItemEffect (progress substitutes for heat,
unconditionally, matching its prior behaviour exactly) and a new
UnequippedStatContext in ItemManager (no heat, no modifiers, by name).

No behaviour change beyond the two disagreements the cut map names as
defects. Each context's original NaN handling is preserved exactly
(unequipped throws with diagnostic detail; equipped/consumable fall back to
Min). Behavior.Evaluate(PerformanceStat) keeps its name and signature, so
the ~81 existing call sites are untouched.

Verified: dotnet test tests/Aetheria.Shared.Tests unchanged at 61/61 before
new tests are added; a real-catalog probe over GameData/Aetheria.cc found
the new unequipped path reproduces the old formula exactly across 3123
(item, quality, durability, stat) cases; Unity batchmode compiles with 0
error CS and the Cut 1/2/3 shield probes still pass; AetherDb census,
factions, dangling, station-fit, loadout 1 and hardpoint-fit are
byte-identical before and after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-18 16:19:22 +02:00
Meta Vens
415f8e1152 Add the lot ledger and mint every crafted instance through it
Quality, Ingredients and Product leave CraftedItemInstance; a unit now
carries only a LotId into the run-scoped ProvenanceLedger. ItemManager
gains the one lot-minting path (CreateLot/CreateInstance(int)), GetLot,
and Brand(), which derives a maker and product from provenance instead
of a stored field. RunSave persists the ledger pruned to what the saved
zones' entities still reach; the live ledger is never pruned, so a
floor pickup collected after a save still resolves. CopyBuild is gone:
matching hardpoints now share the same lot instead of copying values.
PropertiesPanel shows the derived brand where the design's manufacturer
used to be. AetherDb's census flags duplicate (maker, design) products
and its save command checks every crafted instance's lot against a real
run store.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 04:16:23 +02:00
Meta Vens
69801bbb2c Delete the re-mint path and the dead debug menu
Cut A of docs/item-provenance-cut.md. TradeMenuDebug.cs was dead (its
script GUID appears in no scene/prefab/asset and no other .cs names the
type). ItemManager.Instantiate and CreateInstance(SimpleCommodityData,
int) re-rolled quality and dropped provenance on every load; nothing
outside EntitySerializer called them once the instantiate parameter is
gone. EntitySerializer.Unpack/Restore no longer thread an instantiate
flag, so Temperature and Armor are restored unconditionally like every
other caller already got. The starting ship and spawnturret now keep
what the generator built instead of re-minting.

Verification: Aetheria.Shared, tools/AetherDb build green against
CultLib a0813c6; tests/Aetheria.Shared.Tests 29 passed (unchanged); the
four negative greps in the map are empty. Unity compile is still owed
(the editor is open on this project; batchmode was not run per
instructions).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 03:42:12 +02:00
Meta Vens
a2b54889b4 Move the ServerShared data model onto CultLib's CultCache
Cut 8b. Aetheria.Shared builds headless against GameCult.Caching and
GameCult.Caching.MessagePack at the pinned CultLib; the pin guard also
checks the Caching project exists.

Documents: [CultDocument("aetheria.<type>", "1")] with [MessagePackObject]
and integer [Key]s on the Q7 concrete types (the eight ItemData leaves,
Faction, FactionProductData, PersonalityAttribute, NameFile, OrbitData, the
four BodyData leaves, SavedZone, SavedGame, PlayerSettings, InputLayout).
SavedGame and PlayerSettings are [CultGlobal]; Name members are [CultName].
ItemData, CraftedItemData, EquippableItemData, BodyData and AgentTask lose
[MessagePackObject]; BodyData and AgentTask lose their [Union]s. InputLayout
moves into ServerShared so AetheriaStores can route it.

References: Guid and DatabaseLink<T> members become CultRecordRef<T>;
Guid-keyed maps become ref-keyed with [CultReference(..., many: true)];
ZonePack holds refs to orbit and body records. Runtime maps (Zone orbits,
bodies and belts, cargo ItemsOfType, agent targets) key by CultRecordKey.
Identity is the record key: ID comparisons become reference or key
comparisons. StatModifierData.RequireBehavior is a simple type name.

AetheriaStores.Open composes the catalog (read-only unless writable), run
and player stores, one home per type. CultRecordRefs carries IsSet, a
null-safe Get(ref), RefOf (key from TryGetHandle) and Upsert.
ItemManager.GetData is the one item resolution path. MathResolver is
declared by [assembly: CultCacheFormatterResolver].

Inspector attributes: text, range and asset path map onto CultLib's
CultInspector attributes (asset path only on string members); every
replaced Aetheria attribute keeps [Inspectable] for the runtime panel.

Builds: Aetheria.Shared. Does not build: AetherDb and the Unity project,
which follow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 19:00:42 +02:00
Meta Vens
6140a06a0a Swap Unity.Mathematics usings for CultMath
Every Unity.Mathematics using, alias and qualified name under Assets\Scripts
and tools now names CultMath. The nine `using static ...noise;` lines are
gone: snoise lives on CultMath's math. UnityExtensions loses float4.ToColor
and Color.ToFloat4, which duplicate the bridge's ToColor and ToCultMath; the
float3 colour pair stays because the bridge has none.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:39:12 +02:00
Meta Vens
8d93b937bc Author manufacturer variation as faction products
A design lists role names; a faction product is a manufacturer's branded
build of one, carrying its name, its flavor text, and a pseudo-gaussian
quality distribution per role whose mean is the technology put in and
whose deviation is their quality control. A PerformanceStat may name the
role whose quality it reads, unset reading the item own workmanship as
before, so old saves behave unchanged. Generation selects products rather
than designs, which makes what a faction makes the availability rule.

This is Njordr shape at one dimension: role names, per-role derivation
and per-product distributions carry over when quality widens into
dimensions. No parts exist yet; the product authors the role quality.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 01:12:12 +02:00
Meta Vens
3dcfaf9783 Delete commented-out code blocks
Git keeps the history. SimpleCommodityData records its retired
MessagePack keys so they are not reused against old data.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 22:14:58 +02:00
Meta Vens
7006a6b0dd Restore the stable legacy Unity project 2026-08-10 14:57:50 +01:00
Meta Vens
0cf4591b8f Centralize catalog item object lookup 2026-06-28 12:21:38 +01:00
Meta Vens
be1207c585 Move runtime API namespace to Verse 2026-06-21 09:54:15 +01:00
Meta Vens
39a0dc8737 Sync daemon authority migration 2026-06-21 09:37:54 +01:00
Meta Vens
5d7f0ef9b2 Remove redundant runtime item catalog adapter 2026-06-16 19:14:35 +01:00
Meta Vens
6391176a40 Remove dead ItemManager cache residue 2026-06-16 13:11:38 +01:00
Meta Vens
18a4ead6f8 Delete runtime behavior config bridge 2026-06-15 20:12:34 +01:00
Meta Vens
6479f6fcfa Bypass config for AetherDrive 2026-06-15 19:54:54 +01:00
Meta Vens
70c9e965a1 Bypass configs for heavy behaviors 2026-06-15 19:29:34 +01:00
Meta Vens
3877b4b263 Bypass configs for medium behaviors 2026-06-15 19:20:06 +01:00
Meta Vens
b97bf31b50 Bypass configs for simple behaviors 2026-06-15 19:06:13 +01:00
Meta Vens
068bc11622 Bypass configs for no-payload behaviors 2026-06-15 18:51:59 +01:00
Meta Vens
e173989b3d Project behavior item refs as typed keys 2026-06-15 16:10:13 +01:00
Meta Vens
0b92a2faae Remove item instance legacy ID projection 2026-06-15 02:57:50 +01:00
Meta Vens
2554b34c76 Remove behavior payload GUID reader 2026-06-15 02:36:26 +01:00
Meta Vens
ffe9d6d7bf Make runtime item catalog key-only 2026-06-15 01:31:16 +01:00
Meta Vens
95bd76ee91 Use typed item keys in behavior item refs 2026-06-14 23:31:54 +01:00
Meta Vens
8337d5f5c7 Move runtime item references to typed keys 2026-06-14 22:58:02 +01:00
Meta Vens
d8db6c3e2c Replace behavior config reflection mapper 2026-06-14 22:07:05 +01:00
Meta Vens
32187038eb Demote behavior construction configs 2026-06-14 21:48:43 +01:00
Meta Vens
84bf298596 Name runtime item references as definition ids 2026-06-14 11:40:28 +01:00
Meta Vens
22e7d0a972 Expose item reference API on runtime instances 2026-06-14 11:19:27 +01:00
Meta Vens
d163b3064c Expose item identity on runtime instances 2026-06-14 11:12:48 +01:00
Meta Vens
477e1b2ed5 Keep behavior config bridge inside item manager 2026-06-14 10:54:17 +01:00
Meta Vens
f403ab28a7 Target live behavior data for stat modifiers 2026-06-14 10:38:04 +01:00
Meta Vens
37f4ef4a12 Route runtime behavior construction through item manager 2026-06-14 10:29:17 +01:00
Meta Vens
301b1251b1 Use typed runtime item category tokens 2026-06-14 09:38:55 +01:00
Meta Vens
1a7ea0a0e5 Rename runtime item reader around typed catalog 2026-06-14 09:19:53 +01:00
Meta Vens
c0d0fbf656 Delete runtime item DTO hydration 2026-06-14 07:52:18 +01:00
Meta Vens
4d5b6cda22 Clone blueprint items from typed rows 2026-06-14 07:41:32 +01:00
Meta Vens
d15418a389 Delete dead runtime item projection bridge 2026-06-14 07:35:33 +01:00
Meta Vens
a786da0e24 Instantiate loadout items from typed rows 2026-06-14 07:27:23 +01:00
Meta Vens
4e151cd61d Use typed durability for item instantiation 2026-06-14 06:35:34 +01:00
Meta Vens
df46979095 Use typed durability for item stat evaluation 2026-06-14 06:23:45 +01:00
Meta Vens
c68dc15c3e Use typed item rows for blueprint pricing 2026-06-14 05:56:41 +01:00
Meta Vens
18dc4a61ce Use typed payloads for behavior construction 2026-06-14 05:51:15 +01:00
Meta Vens
ce8adfbaf2 Use typed rows for loadout selection 2026-06-14 05:25:56 +01:00
Meta Vens
64214c5dd8 Use typed hull facets in motion consumers 2026-06-14 05:15:18 +01:00