From fa7217fcc829ac783d6d7a887115fefde938260f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 15 Jun 2026 17:44:06 +0100 Subject: [PATCH] Stop simple behaviors retaining configs --- .voidbot/state/aetheria.cc | Bin 111199 -> 113264 bytes Aetheria.State/README.md | 3 +++ .../ServerShared/Behaviors/Cooldown.cs | 10 +++++----- .../ServerShared/Behaviors/EnergyDraw.cs | 13 ++++++++----- Assets/Scripts/ServerShared/Behaviors/Heat.cs | 13 ++++++++----- docs/aetheria-perfect-machine-map.md | 3 +++ 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 5e0aad0cdb44a7dcdd80b758403e39a7ca922c7f..7303dcc66b9c093a71600b90ecb46b8a34736c3c 100644 GIT binary patch delta 1612 zcma)6O^6&t6s9)I5*HMLS(7N3Vu@m8rq|h-tZTd^CX4YP%0>~Ekyz9HX1bE@s-~)X zCIjLSg9z#+jHV9~MBP7f5(F1S2s!8_7q2Ud7th8+z-wOBbocBSK`;IDe!utL_ulV+ z%=~q4=9|r_*+%_jqvkCxKfiX3%ng5>`nZt1P`8rooh>pmO!t{myyOh`PamDSS-*OG zdgu5wsh%P?cHTNmZnLFNwquB;>c0}~o?u`?P@GjqqN?U`5<#^EA?tFfs=gF$-l_Vj z$v*m!G++DR957R%D*{xfe^#+xg)$M)Gg3x@>Sf1=K+BS6>7^YtlalM^b#PpDBi`yQNKd9L~I;~qA4r7h}dY4 zqgYtnw522q5LTI_rFhVR3L-Ynpq)k$f{taEMO3!w>S(sv-wpCec3_n}I@tZ~jKq11 z6fBx9DE#h>1G?#Pgx#`)N%~f4`UwQq`d{e-my?M5+>|XH@u*_)2pT|SyMoTPc?u$I zo1H^ZAg0L)(+hco13(gh>e{s0;J{-Ua15v%r^~Xf3WJ8=UrHpBm}-a_#`U##lLqbAJT^SlJ2X4qj_k_kWbW7xW5FbDiXFfDwSx9;by({?J#CrhT%P>Sk#1sH z#>O>kyua8v=kUb$#qWa|GWHocIQU6*XjRbpoCDN*7Dr>-~dw#*9dni48LU zusz7ndCQIE`eJP@k delta 189 zcmezHh3)nL`)69A{;F8OpBD7 zHCeW6vM}m8FwWT??!tI5ak}O@M%C#PmNN29zQ`;A(_?N3(ldSXI>!AlAq!Ke!EDpZ h*E8nBge@T|SvN2?!iB(2*uHcF<3UcSn7M&b6aYmGG`s)+ diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index 283729998..83a305544 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -179,6 +179,9 @@ identity owners or a public behavior API. Stat modifiers ask live behavior instances for target stats instead of reading behavior config objects directly; base `Behavior` captures a runtime stat table at construction and no longer retains the config object for later reflection. +Heat, EnergyDraw, and Cooldown behavior instances now copy their constructor +stat/scalar inputs into explicit runtime fields and no longer retain their +config subclasses after construction. `ItemManager` currently owns the explicit typed-payload-to-config bridge. Typed name-file documents are `aetheria.name_file.v2` records. They carry the legacy ID, display name, count, compact sample names for surfaces, and the full diff --git a/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs b/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs index 0b7ca6650..01fff3370 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Cooldown.cs @@ -26,7 +26,7 @@ public class CooldownConfig : RuntimeBehaviorConfig public class Cooldown : Behavior, IAlwaysUpdatedBehavior, IProgressBehavior { - private CooldownConfig _data; + private readonly PerformanceStat _cooldownDuration; private float _cooldown; // Normalized @@ -34,12 +34,12 @@ public class Cooldown : Behavior, IAlwaysUpdatedBehavior, IProgressBehavior public Cooldown(CooldownConfig data, EquippedItem item) : base(data, item) { - _data = data; + _cooldownDuration = data.Cooldown; } public Cooldown(CooldownConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _cooldownDuration = data.Cooldown; } public override bool Execute(float dt) @@ -55,6 +55,6 @@ public class Cooldown : Behavior, IAlwaysUpdatedBehavior, IProgressBehavior public void Update(float delta) { - _cooldown -= delta / Evaluate(_data.Cooldown); + _cooldown -= delta / Evaluate(_cooldownDuration); } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs b/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs index cbd9c7370..ec4248538 100644 --- a/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs +++ b/Assets/Scripts/ServerShared/Behaviors/EnergyDraw.cs @@ -26,20 +26,23 @@ public class EnergyDrawConfig : RuntimeBehaviorConfig public class EnergyDraw : Behavior { - private EnergyDrawConfig _data; + private readonly PerformanceStat _energyDraw; + private readonly bool _perSecond; public EnergyDraw(EnergyDrawConfig data, EquippedItem item) : base(data, item) { - _data = data; + _energyDraw = data.EnergyDraw; + _perSecond = data.PerSecond; } public EnergyDraw(EnergyDrawConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _energyDraw = data.EnergyDraw; + _perSecond = data.PerSecond; } public override bool Execute(float dt) { - return Entity.TryConsumeEnergy(Evaluate(_data.EnergyDraw) * (_data.PerSecond ? dt : 1)); + return Entity.TryConsumeEnergy(Evaluate(_energyDraw) * (_perSecond ? dt : 1)); } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Heat.cs b/Assets/Scripts/ServerShared/Behaviors/Heat.cs index 0a9f47cf7..d275ec58f 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Heat.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Heat.cs @@ -26,21 +26,24 @@ public class HeatConfig : RuntimeBehaviorConfig public class Heat : Behavior { - private HeatConfig _data; + private readonly PerformanceStat _heat; + private readonly bool _perSecond; public Heat(HeatConfig data, EquippedItem item) : base(data, item) { - _data = data; + _heat = data.Heat; + _perSecond = data.PerSecond; } public Heat(HeatConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _heat = data.Heat; + _perSecond = data.PerSecond; } public override bool Execute(float dt) { - AddHeat(Evaluate(_data.Heat) * (_data.PerSecond ? dt : 1)); + AddHeat(Evaluate(_heat) * (_perSecond ? dt : 1)); return true; } -} \ No newline at end of file +} diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 255d6d2a5..b401805a3 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -304,6 +304,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. 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. + Heat, EnergyDraw, and Cooldown behavior instances now copy constructor + stat/scalar inputs into explicit runtime fields and no longer retain their + config subclasses after construction. `StatModifier` behavior requirements and behavior-stat targets compare typed behavior kinds on the live equipped behavior instances through `AetheriaRuntimeBehaviorMetadataCatalog` instead of scanning config