From f403ab28a79521d48a4900b619ff75ee14d9630a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 10:38:04 +0100 Subject: [PATCH] Target live behavior data for stat modifiers --- .voidbot/state/aetheria.cc | Bin 84802 -> 84184 bytes .../ServerShared/Behaviors/StatModifier.cs | 18 ++++++------ Assets/Scripts/ServerShared/ItemManager.cs | 13 +++------ docs/aetheria-perfect-machine-map.md | 27 +++++++++++------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index e3bf1a9356513b9e85bfcb569b4240aac606d6d6..2982fd915832afea3b0064c6c7819e30cb9a6585 100644 GIT binary patch delta 1227 zcmZux&rj4q7|p<dX{_7eYLG z(niPVRWva%@nSdX*%R@-9`lu$xK@b31fB*AV-ASo4PsND%04VPcH((qr{~!)53dqh zqyo4&;i%y>m=_;Z(TJ&hV#7XP0wl~Yd{;5&KMF|$ujuVO>gXb-Nu|ULey*azC3c81 z3v}m+OF)_DpWDtD?-g|=OBtnc{TxuR7H24MJ)|Bk&*`6Gp%hOr#W`Hf*lfCQ0)0do0+<~8>K@(piV5HebZMy zd_CY|+_Y+ntZ?79LIq;?Yw3_MCyWrLT@6*<)xzy1ruV0L#tj=6Q7cpI-j>iQ7;bMd1@W6Q>&`@t(Lun)Y76k#s&L1>t|G1fu zQ;3|>69eczn$xI&hE5+i&HbS6lk|aL)CQ=f#&(+0xOPHI+o-Wno2Znijf&Xu?$|qIcV?NH zt!so7RXrjhRg0J_m3T;8S|m_UfI#BLg&T^HI3kV}M=t!cFT3=B54QY!{LlCL|NZUm z#8010JosX4?}>%x{HbcAQQx?WCX=7XJ}fJ*rWLW{{j$S_mbfdj#NRALu8ZfS}; z)F(HYkeG3$33sW&odNckg!91wcd2%L#(TqaIiP?k4S?V(mjr=5;hf7`T_BoN&qIGr z+j&!`im&=~keADSdmLag@f1-04+9Y3pJ9R|)A`W0& zL~POc@Y(Z+aVpdF7Np50(`Jd&TUM7m}s#}xx!8wm-%1SZB*-(|^I|NUpB!g@T*y+{aYN0_fQ6NFGw*Gu_wm+S$|2gyQyiH&_ z3)w`c+V8d6TY7P5R$oC^lC6bj&W hp.EquippableItem) .Where(HasRequiredBehavior) - .SelectMany(gear => ItemManager.GetTemporaryRuntimeBehaviorConfigs(gear)) - .Where(behavior => BehaviorKindMatches(behavior.Kind, _data.Stat.Target)) + .SelectMany(gear => gear.Behaviors ?? Array.Empty()) + .Where(behavior => BehaviorKindMatches(behavior.Data.Kind, _data.Stat.Target)) .Select(FindTargetStat) .Where(stat => stat != null) .ToArray(); } - private PerformanceStat FindTargetStat(BehaviorData behavior) + private PerformanceStat FindTargetStat(Behavior behavior) { - var statField = behavior + var data = behavior.Data; + var statField = data .GetType() .GetFields() .Where(f => f.FieldType == typeof(PerformanceStat)) .FirstOrDefault(f => f.Name == _data.Stat.Stat); - return statField?.GetValue(behavior) as PerformanceStat; + return statField?.GetValue(data) as PerformanceStat; } private static bool BehaviorKindMatches(string runtimeKind, string expectedKind) @@ -90,11 +90,11 @@ public class StatModifier : Behavior, IInitializableBehavior, IDisposable, IAlwa string.Equals(runtimeKind, expectedKind.Substring(0, expectedKind.Length - legacyDataSuffix.Length), StringComparison.Ordinal); } - private bool HasRequiredBehavior(EquippableItem gear) + private bool HasRequiredBehavior(EquippedItem gear) { return string.IsNullOrWhiteSpace(_data.RequireBehavior) || - ItemManager.GetTemporaryRuntimeBehaviorConfigs(gear) - .Any(behavior => BehaviorKindMatches(behavior.Kind, _data.RequireBehavior)); + (gear?.Behaviors ?? Array.Empty()) + .Any(behavior => BehaviorKindMatches(behavior.Data.Kind, _data.RequireBehavior)); } private void ApplyModifier() diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index 7b5b77b9f..0914882f4 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -64,14 +64,6 @@ public class ItemManager return itemId == Guid.Empty ? null : _runtimeItems.GetRuntimeItem(itemId); } - public IReadOnlyList GetTemporaryRuntimeBehaviorConfigs(ItemInstance item) - { - var itemId = item?.Data?.ItemId ?? Guid.Empty; - return itemId == Guid.Empty - ? Array.Empty() - : _runtimeItems.GetTemporaryBehaviorConfigs(itemId); - } - public Behavior[] CreateRuntimeBehaviors(EquippedItem item) { return CreateRuntimeBehaviorConfigs(item?.EquippableItem) @@ -88,7 +80,10 @@ public class ItemManager private IReadOnlyList CreateRuntimeBehaviorConfigs(ItemInstance item) { - return GetTemporaryRuntimeBehaviorConfigs(item); + var itemId = item?.Data?.ItemId ?? Guid.Empty; + return itemId == Guid.Empty + ? Array.Empty() + : _runtimeItems.GetTemporaryBehaviorConfigs(itemId); } public Shape GetRuntimeShape(ItemInstance item) diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 63ac68e3b..1fb7fabc3 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -160,9 +160,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. station bay fit, hull/category, and behavior-kind prefilters run against typed catalog rows. `EquippedItem` and `ConsumableItemEffect` now create behavior instances through `ItemManager.CreateRuntimeBehaviors`; the remaining - `BehaviorData` config list is explicitly temporary and exposed only for the - surviving `StatModifier` stat-target bridge. The unused `TradeMenuDebug` - script has been deleted instead of preserving an old uGUI debug path that + `BehaviorData` config list is explicitly temporary and internal to behavior + construction. `StatModifier` requirement and stat-target lookup now inspects + the live equipped behavior instances and their typed payload kinds, not a + freshly rebuilt config list. The unused `TradeMenuDebug` script has been + deleted instead of preserving an old uGUI debug path that turned typed trade rows back into legacy `ItemData` objects. That hydration now comes from typed state, not `AetherDB.msgpack`. The surviving trade menu wraps rows in a typed `TradeRow`: name, mass, price, size, hardpoint type, @@ -219,8 +221,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. owner; bridge instances carry the typed behavior payload kind so runtime logic does not have to reselect behavior identity from the old class graph. `StatModifier` behavior requirements and behavior-stat targets compare typed - behavior kinds from that bridge instead of scanning `BehaviorData` subclasses - or hydrating `EquippableItemData.Behaviors`. `ConsumableItemData` and + behavior kinds on the live equipped behavior instances instead of scanning + `BehaviorData` subclasses, rebuilding temporary configs, or hydrating + `EquippableItemData.Behaviors`. `ConsumableItemData` and `EquippableItemData` no longer expose legacy `Behaviors` lists at all. The old item-DTO stat branch was deleted after inspection showed no active `PerformanceStat` fields on the live equippable item DTO hierarchy. @@ -533,8 +536,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. whole-item DTO projection cache. `AetheriaRuntimeItemCatalog` exposes typed item rows and temporarily builds `BehaviorData` config objects from typed behavior payloads behind the `ItemManager.CreateRuntimeBehaviors` runtime - construction primitive. Direct config reads are named temporary and remain - only where `StatModifier` still needs behavior-stat target lookup. + construction primitive. Direct config reads no longer escape `ItemManager`; + gameplay stat modifiers target live behavior instances instead of rebuilding + config DTOs for lookup. `RuntimeItemReference.ItemId` is the only item reference value. The reader interface for this bridge is named `IRuntimeItemCatalogReader` so callers see typed catalog row ownership rather than old DTO projection ownership. Behavior @@ -809,9 +813,8 @@ First Aetheria surfaces to publish: construction; `BehaviorData` remains only the temporary behavior-class config bridge. - Done: route `EquippedItem` and `ConsumableItemEffect` behavior instance - creation through `ItemManager.CreateRuntimeBehaviors`; direct - `GetTemporaryRuntimeBehaviorConfigs` access remains only for the - `StatModifier` behavior-stat target bridge. + creation through `ItemManager.CreateRuntimeBehaviors`; temporary config + reads are internal to that construction bridge. - Done: move the temporary behavior config constructor map from legacy union keys to typed behavior payload kind strings; union keys remain migration provenance only for this runtime path. @@ -821,6 +824,10 @@ First Aetheria surfaces to publish: `StatModifier` matches those kind strings for target and requirement selection. The obsolete item-DTO stat target branch is deleted because the live equippable item DTO hierarchy has no active `PerformanceStat` fields. + - Done: move `StatModifier` target and requirement lookup onto the live + equipped behavior instances. It now modifies the `PerformanceStat` objects + actually held by runtime behavior data instead of rebuilding temporary + config DTOs from the catalog. - Done: delete the legacy `Behaviors` lists from `ConsumableItemData` and `EquippableItemData`; item DTOs can no longer carry behavior config state. - Done: move runtime blueprint price aggregation and conductivity restore