From 26148829bdc71f09effae7ae6e270eb8d89caade Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 15 Jun 2026 17:38:55 +0100 Subject: [PATCH] Demote behavior configs from stat authority --- .voidbot/state/aetheria.cc | Bin 109309 -> 111199 bytes Aetheria.State/README.md | 4 ++- .../ServerShared/Behaviors/Behaviors.cs | 31 ++++++++++-------- docs/aetheria-perfect-machine-map.md | 2 ++ 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 7b27f05358816d5a8e85f83a4bfb4ae310986e03..5e0aad0cdb44a7dcdd80b758403e39a7ca922c7f 100644 GIT binary patch delta 1421 zcmZ9M&ubJ(6vwF;qY)Jpe-H(I?y3+-k4YT!Ls^k1D>(?_50vbJ)=XE=ly+A&Rn?<| zU>04J4SR_}>tJ-_FLW0dJQ?sLUUSgP9^yq8yz4(8_`14#l6dOkb-jAu_kEwLum5#? z_|);@Xd%)bGj*mo^|FvxVRhQzQhC}?;~82BnVq;vem!w* zglYyO`EL;N5>#ny62&ycOa)R!R8$$Hc^asJsubF&q-wYnz;Vr}4>AD74CR80n*CfR zn}4JlR3Z$IvQ(gnsY}I8v-G4IQXai0tL&FD*|c1-h;sX&M!Lp5{G;{K3Khlu8tZ{d zVp=Lor&RMOGshR?okVp`yFxW6v*^KJD#G=B0MHt!ENR;n9>)_Pl%mEIwkuNy(w(h_ zrApTUuYs&wU{wPcP%H>>sX;a{iyNSU!9^nn(h6ZkoV~>yHq?`I=q#JK1R`E|arc zU!4|s$riAWdRWn!f$4cyV47K6&}%X7g{}rRT`R692mS7H~aJg%l&PFYlAx zs~1<9dbey#{t6EE6_4fXJTkN|e<(X_`wWTm=y100)(p8;MBIZq+y8*P>C8fdz5Qd~ E0K?n^&Hw-a delta 181 zcmccrgzfKDwhhafI1Q~#jrA-oETSedicUVt)B_c;GzJMwPgu^#Ho26!6eem0R>r|1 z&ot{mvnI=SO%_I72gcdk!(ABTqozwNV^o_SH;<8b@ _performanceStats; public string Kind { get; } public int Group { get; } public EquippedItem Item { get; } @@ -46,7 +46,7 @@ public abstract class Behavior protected Behavior(RuntimeBehaviorConfig config, EquippedItem item) { - _config = config; + _performanceStats = CapturePerformanceStats(config); Kind = config?.Kind ?? ""; Group = config?.Group ?? 0; Item = item; @@ -55,7 +55,7 @@ public abstract class Behavior protected Behavior(RuntimeBehaviorConfig config, ConsumableItemEffect consumable) { - _config = config; + _performanceStats = CapturePerformanceStats(config); Kind = config?.Kind ?? ""; Group = config?.Group ?? 0; Consumable = consumable; @@ -66,18 +66,21 @@ public abstract class Behavior public bool TryGetPerformanceStat(string statName, out PerformanceStat stat) { - stat = null; - if (_config == null || string.IsNullOrWhiteSpace(statName)) - { - return false; - } + return !string.IsNullOrWhiteSpace(statName) && + _performanceStats.TryGetValue(statName, out stat); + } - var statField = _config - .GetType() - .GetFields() - .FirstOrDefault(field => field.FieldType == typeof(PerformanceStat) && field.Name == statName); - stat = statField?.GetValue(_config) as PerformanceStat; - return stat != null; + private static Dictionary CapturePerformanceStats(RuntimeBehaviorConfig config) + { + return config == null + ? new Dictionary(StringComparer.Ordinal) + : config + .GetType() + .GetFields() + .Where(field => field.FieldType == typeof(PerformanceStat)) + .Select(field => (field.Name, Stat: field.GetValue(config) as PerformanceStat)) + .Where(entry => entry.Stat != null) + .ToDictionary(entry => entry.Name, entry => entry.Stat, StringComparer.Ordinal); } protected void AddHeat(float heat) => Item?.AddHeat(heat); // TODO: Heat for Consumables diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b48bed494..255d6d2a5 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -302,6 +302,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. behavior-class construction bridge, not the runtime behavior payload owner; bridge instances carry the typed behavior payload kind so runtime logic does not have to reselect behavior identity from the old class graph. + Base `Behavior` now captures a runtime performance-stat table during + construction and no longer retains the config object for later stat lookup. `StatModifier` behavior requirements and behavior-stat targets compare typed behavior kinds on the live equipped behavior instances through `AetheriaRuntimeBehaviorMetadataCatalog` instead of scanning config