diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 5e0aad0cd..7303dcc66 100644 Binary files a/.voidbot/state/aetheria.cc and b/.voidbot/state/aetheria.cc differ 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