diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 7303dcc66..7c5c1e098 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 83a305544..d17d10d5c 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -182,6 +182,9 @@ 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. +Wear, Visibility, Reflector, VelocityLimit, VelocityConversion, and ItemUsage +also copy their constructor stat/key/scalar inputs into explicit runtime fields +instead of retaining config subclasses. `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/ItemUsage.cs b/Assets/Scripts/ServerShared/Behaviors/ItemUsage.cs index b25f8810d..94aa10d27 100644 --- a/Assets/Scripts/ServerShared/Behaviors/ItemUsage.cs +++ b/Assets/Scripts/ServerShared/Behaviors/ItemUsage.cs @@ -21,24 +21,24 @@ public class ItemUsageConfig : RuntimeBehaviorConfig public class ItemUsage : Behavior { - private ItemUsageConfig _data; + private readonly string _itemKey; public ItemUsage(ItemUsageConfig data, EquippedItem item) : base(data, item) { - _data = data; + _itemKey = data.ItemKey; } public ItemUsage(ItemUsageConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _itemKey = data.ItemKey; } public override bool Execute(float dt) { - var cargo = Entity.FindItemInCargo(_data.ItemKey); + var cargo = Entity.FindItemInCargo(_itemKey); if (cargo == null) return false; - var item = cargo.GetFirstItem(_data.ItemKey); + var item = cargo.GetFirstItem(_itemKey); if (item is SimpleCommodity simpleCommodity) cargo.Remove(simpleCommodity, 1); if (item is CraftedItemInstance craftedItemInstance) diff --git a/Assets/Scripts/ServerShared/Behaviors/Reflector.cs b/Assets/Scripts/ServerShared/Behaviors/Reflector.cs index 36d9bba4f..235e0d3eb 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Reflector.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Reflector.cs @@ -27,22 +27,22 @@ public class ReflectorConfig : RuntimeBehaviorConfig public class Reflector : Behavior { - private ReflectorConfig _data; + private readonly PerformanceStat _crossSection; public Reflector(ReflectorConfig data, EquippedItem item) : base(data, item) { - _data = data; + _crossSection = data.CrossSection; } public Reflector(ReflectorConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _crossSection = data.CrossSection; } public override bool Execute(float dt) { - Entity.VisibilitySources[this] = Evaluate(_data.CrossSection) * Entity.Zone.GetLight(Entity.Position.xz); + Entity.VisibilitySources[this] = Evaluate(_crossSection) * Entity.Zone.GetLight(Entity.Position.xz); return true; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/VelocityConversion.cs b/Assets/Scripts/ServerShared/Behaviors/VelocityConversion.cs index 830abd439..c98779f85 100644 --- a/Assets/Scripts/ServerShared/Behaviors/VelocityConversion.cs +++ b/Assets/Scripts/ServerShared/Behaviors/VelocityConversion.cs @@ -21,20 +21,20 @@ public class VelocityConversionConfig : RuntimeBehaviorConfig public class VelocityConversion : Behavior { - private VelocityConversionConfig _data; + private readonly PerformanceStat _lambda; public VelocityConversion(VelocityConversionConfig data, EquippedItem item) : base(data, item) { - _data = data; + _lambda = data.Lambda; } public VelocityConversion(VelocityConversionConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _lambda = data.Lambda; } public override bool Execute(float dt) { - Entity.Velocity = AetheriaMath.Damp(Entity.Velocity, Entity.Direction * length(Entity.Velocity), Evaluate(_data.Lambda), dt); + Entity.Velocity = AetheriaMath.Damp(Entity.Velocity, Entity.Direction * length(Entity.Velocity), Evaluate(_lambda), dt); return true; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs b/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs index a28d343b9..1dc89731f 100644 --- a/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs +++ b/Assets/Scripts/ServerShared/Behaviors/VelocityLimit.cs @@ -26,25 +26,25 @@ public class VelocityLimit : Behavior { public float Limit { get; private set; } - private VelocityLimitConfig _data; + private readonly PerformanceStat _topSpeed; public VelocityLimit(VelocityLimitConfig data, EquippedItem item) : base(data, item) { - _data = data; - Limit = Evaluate(_data.TopSpeed); + _topSpeed = data.TopSpeed; + Limit = Evaluate(_topSpeed); } public VelocityLimit(VelocityLimitConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; - Limit = Evaluate(_data.TopSpeed); + _topSpeed = data.TopSpeed; + Limit = Evaluate(_topSpeed); } public override bool Execute(float dt) { - Limit = Evaluate(_data.TopSpeed); + Limit = Evaluate(_topSpeed); if (length(Entity.Velocity) > Limit) Entity.Velocity = normalize(Entity.Velocity) * Limit; return true; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Visibility.cs b/Assets/Scripts/ServerShared/Behaviors/Visibility.cs index 6bc5b41ee..c248eaecd 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Visibility.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Visibility.cs @@ -25,20 +25,20 @@ public class VisibilityConfig : RuntimeBehaviorConfig public class Visibility : Behavior { - private VisibilityConfig _data; + private readonly PerformanceStat _visibility; public Visibility(VisibilityConfig data, EquippedItem item) : base(data, item) { - _data = data; + _visibility = data.Visibility; } public Visibility(VisibilityConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _visibility = data.Visibility; } public override bool Execute(float dt) { - Entity.VisibilitySources[this] = Evaluate(_data.Visibility); + Entity.VisibilitySources[this] = Evaluate(_visibility); return true; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Wear.cs b/Assets/Scripts/ServerShared/Behaviors/Wear.cs index 2fbfec40b..3d5c107f8 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Wear.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Wear.cs @@ -24,20 +24,20 @@ public class WearConfig : RuntimeBehaviorConfig public class Wear : Behavior { - private WearConfig _data; + private readonly bool _perSecond; public Wear(WearConfig data, EquippedItem item) : base(data, item) { - _data = data; + _perSecond = data.PerSecond; } public Wear(WearConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _perSecond = data.PerSecond; } public override bool Execute(float dt) { - CauseWearDamage(_data.PerSecond ? dt : 1); + CauseWearDamage(_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 b401805a3..d5170b282 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -307,6 +307,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. 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. + Wear, Visibility, Reflector, VelocityLimit, VelocityConversion, and ItemUsage + now follow the same rule for their constructor stat/key/scalar inputs. `StatModifier` behavior requirements and behavior-stat targets compare typed behavior kinds on the live equipped behavior instances through `AetheriaRuntimeBehaviorMetadataCatalog` instead of scanning config