From 977fa52b189185773a5f7a76290eeea399fa4135 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 15 Jun 2026 17:01:03 +0100 Subject: [PATCH] Hide behavior config runtime authority --- .voidbot/state/aetheria.cc | Bin 104703 -> 105412 bytes Aetheria.State/README.md | 6 +++-- .../ServerShared/Behaviors/Behaviors.cs | 23 +++++++++++++++--- .../ServerShared/Behaviors/StatModifier.cs | 11 +-------- .../RuntimeProjection/Attributes.cs | 10 -------- docs/aetheria-perfect-machine-map.md | 13 +++++++--- 6 files changed, 34 insertions(+), 29 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 21d152db9b70e438cf1ef1bd568bc45e14fbed97..fd5dbed1b02f00f95380c456413a04bfe740b6d5 100644 GIT binary patch delta 1632 zcmaJ?U5Fc16!vbHr7MD3s=J`pL)X$qk}=y|wm;x@yRJV)7wfvEvh|@iGiQ?9PUePt z?<5T@#L@>VYDGqzcdb8&)b=SN*di#1FU2QW@Xa@U@aIW=(Q{`q$r^%?hsnvE?|k2P zzH{@>jft11rNweMJ%->6NzI=)6g@5 zFTzP4K*$Y+C;8oHQwJS*Dl(BmXr$sm*JKoU1Qi6lLFu9CQ)p~&LwM~5dU4~A=^1W) zBTQ~1QA(3$g=MEfR?eXtzw+e$ou5`DnPlh?0VwH3?jW?i0Ttmys2emvUI}oWIvlWV zq<>&!JPUjCSA@Da!3C$yP`iNHslXCj{K31=3`m z?O^@FCe1MVuVZ&RpHNn7Qmvt{f4t*?`1{#sx@Y#WkH>3gS8ODQ)EqZP2}%q?i`(P{ zXp_f%L;j6a2^kls2hf-Xu z-O z`Sg}CH@7$2{&LFD`4pRWCtS>o+ts~3$3EPdJio{ujBo#WKKbHtR){Nq^DaHS$Ks`5 zCeF51754X_UaoBR?y=E=vTffSa)0xGvy}Y0$PTl;@#&xUBrhFfi@WgYR5nok4Ln{mRh$=iNEOSBbRE)x7a?>{I zM7>@9SC86BqZ`j=h?cQZa0P)84xE=tL5O6X(cs(eljX~xd5De>QA2=^$S+D=rp8#6 zhKPxnw7{H2Vxx!%I1^ieK&~`#L~Jd=9?R$=gggR=BI`mj>5F}Zc=*~l@n|Zr=&}mo zTSM#5{LB(T7+pmzQ4{#0l|dPky|e6#(Z-!`V;_@ancQL9nm$BL#o#I?rZwULk*P(r zA|;6`a6`$)HMUR4%r;|5qP1qJ+3+IQJR2PCPQ?TcEGIK8Dd8H3RVFi&|38BxYp%6b zXN#rA zbp7qZ!TQ9;fpmV5o$lH5n9L3`A$1wmz}xBH_7cYtalKyEhWyTnsIAR;Ztjp z^sF+Q+?`;b=NjY9>VbB3fC`)1vgvnLr*q?y*Q>0OQsF(8{4~#cll_xypm+0nkDMxA zz3+LMB!87&o@9Ts^x`zT@_py3Q$liho$cSzu1H?2u|GSf#gVT!Ux)7G`E3?<(*9Xz deaVmOY Item?.Evaluate(stat) ?? Consumable.Evaluate(stat); + + public bool TryGetPerformanceStat(string statName, out PerformanceStat stat) + { + stat = null; + if (_config == null || string.IsNullOrWhiteSpace(statName)) + { + return false; + } + + var statField = _config + .GetType() + .GetFields() + .FirstOrDefault(field => field.FieldType == typeof(PerformanceStat) && field.Name == statName); + stat = statField?.GetValue(_config) as PerformanceStat; + return stat != null; + } + protected void AddHeat(float heat) => Item?.AddHeat(heat); // TODO: Heat for Consumables protected void CauseDamage(float damage) diff --git a/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs b/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs index 74d8162e7..93920cde4 100644 --- a/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs +++ b/Assets/Scripts/ServerShared/Behaviors/StatModifier.cs @@ -18,7 +18,6 @@ public class StatModifierConfig : RuntimeBehaviorConfig [Inspectable] public StatModifierType Type; - [InspectableType(typeof(RuntimeBehaviorConfig))] public string RequireBehavior; public override Behavior CreateInstance(EquippedItem item) @@ -69,14 +68,7 @@ public class StatModifier : Behavior, IInitializableBehavior, IDisposable, IAlwa private PerformanceStat FindTargetStat(Behavior behavior) { - var data = behavior.Config; - var statField = data - .GetType() - .GetFields() - .Where(f => f.FieldType == typeof(PerformanceStat)) - .FirstOrDefault(f => f.Name == _data.Stat.Stat); - - return statField?.GetValue(data) as PerformanceStat; + return behavior.TryGetPerformanceStat(_data.Stat.Stat, out var stat) ? stat : null; } private static bool BehaviorKindMatches(string runtimeKind, string expectedKind) @@ -153,7 +145,6 @@ public enum StatModifierType [Inspectable] public class StatReference { - [InspectableType(typeof(RuntimeBehaviorConfig))] public string Target; [Inspectable] diff --git a/Assets/Scripts/ServerShared/RuntimeProjection/Attributes.cs b/Assets/Scripts/ServerShared/RuntimeProjection/Attributes.cs index f14fccd1b..206a819d7 100644 --- a/Assets/Scripts/ServerShared/RuntimeProjection/Attributes.cs +++ b/Assets/Scripts/ServerShared/RuntimeProjection/Attributes.cs @@ -49,16 +49,6 @@ public class InspectableRangedIntAttribute : PreferredInspectorAttribute } } -public class InspectableTypeAttribute : PreferredInspectorAttribute -{ - public readonly Type Type; - - public InspectableTypeAttribute(Type type) - { - Type = type; - } -} - public class OrderAttribute : Attribute { public int Order; diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 54b7f5295..32baf62d3 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -243,7 +243,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `StatModifier` requirement and stat-target lookup now inspects the live equipped behavior instances and asks package-owned typed behavior metadata for kind/family matching, not a freshly rebuilt config list or a - behavior-local class taxonomy. The unused `TradeMenuDebug` script has been + behavior-local class taxonomy. Live behaviors no longer expose their + construction config object as a public runtime authority; stat targeting now + crosses a behavior-owned stat lookup. 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 @@ -1402,9 +1404,12 @@ First Aetheria surfaces to publish: construction machinery. - Done: rename the temporary behavior construction DTO family from `BehaviorData`/`*Data` to `RuntimeBehaviorConfig`/`*Config`; live - `Behavior` instances expose `Config`, while typed behavior kind strings - such as `Cockpit`, `TurretController`, and `Capacitor` remain stable - catalog facts rather than class-name-derived selectors. + `Behavior` instances expose typed kind/group values while typed behavior + kind strings such as `Cockpit`, `TurretController`, and `Capacitor` remain + stable catalog facts rather than class-name-derived selectors. + - Done: remove the public `Behavior.Config` runtime API; stat modifiers ask + behavior instances for target performance stats instead of reflecting over + exposed construction config objects. - Done: replace `ItemManager` behavior config reflection with an explicit typed behavior-kind mapper. - Done: delete `LegacyPayloadKeyAttribute` from live Unity source after