diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 7c5c1e098..f29db5bbf 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 d17d10d5c..a2b562638 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -185,6 +185,9 @@ 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. +Capacitor, Shield, Thruster, MiningTool, ResourceScanner, Thermotoggle, Switch, +HeatStorage, and Cockpit have also dropped runtime config retention. Thermotoggle +adjustability is exposed on the live behavior instance, not through its config. `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/Capacitor.cs b/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs index ea8a9626a..3393894e8 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Capacitor.cs @@ -28,7 +28,8 @@ public class CapacitorConfig : RuntimeBehaviorConfig public class Capacitor : Behavior { - private CapacitorConfig _data; + private readonly PerformanceStat _capacity; + private readonly PerformanceStat _efficiency; public float Charge { get; private set; } public float Capacity { get; private set; } @@ -42,18 +43,20 @@ public class Capacitor : Behavior public Capacitor(CapacitorConfig data, EquippedItem item) : base(data, item) { - _data = data; + _capacity = data.Capacity; + _efficiency = data.Efficiency; } public Capacitor(CapacitorConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _capacity = data.Capacity; + _efficiency = data.Efficiency; } public override bool Execute(float dt) { - Capacity = Evaluate(_data.Capacity); - Efficiency = Evaluate(_data.Efficiency); + Capacity = Evaluate(_capacity); + Efficiency = Evaluate(_efficiency); return true; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Cockpit.cs b/Assets/Scripts/ServerShared/Behaviors/Cockpit.cs index d9b9249f7..f35acd664 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Cockpit.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Cockpit.cs @@ -21,15 +21,11 @@ public class CockpitConfig : RuntimeBehaviorConfig public class Cockpit : Behavior { - private CockpitConfig _data; - public Cockpit(CockpitConfig data, EquippedItem item) : base(data, item) { - _data = data; } public Cockpit(CockpitConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/HeatStorage.cs b/Assets/Scripts/ServerShared/Behaviors/HeatStorage.cs index df6b3d8bb..b8f52df84 100644 --- a/Assets/Scripts/ServerShared/Behaviors/HeatStorage.cs +++ b/Assets/Scripts/ServerShared/Behaviors/HeatStorage.cs @@ -21,15 +21,11 @@ public class HeatStorageConfig : RuntimeBehaviorConfig public class HeatStorage : Behavior { - private HeatStorageConfig _data; - public HeatStorage(HeatStorageConfig data, EquippedItem item) : base(data, item) { - _data = data; } public HeatStorage(HeatStorageConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs b/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs index 22256e8d1..b0ec805ea 100644 --- a/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs +++ b/Assets/Scripts/ServerShared/Behaviors/MiningTool.cs @@ -37,22 +37,31 @@ public class MiningTool : Behavior public Guid AsteroidBelt; public int Asteroid; - private MiningToolConfig _data; + private readonly PerformanceStat _damagePerSecond; + private readonly PerformanceStat _efficiency; + private readonly PerformanceStat _penetration; + private readonly PerformanceStat _range; public float Range { get; private set; } public MiningTool(MiningToolConfig data, EquippedItem item) : base(data, item) { - _data = data; + _damagePerSecond = data.DamagePerSecond; + _efficiency = data.Efficiency; + _penetration = data.Penetration; + _range = data.Range; } public MiningTool(MiningToolConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _damagePerSecond = data.DamagePerSecond; + _efficiency = data.Efficiency; + _penetration = data.Penetration; + _range = data.Range; } public override bool Execute(float dt) { - Range = Evaluate(_data.Range); + Range = Evaluate(_range); var belt = Entity.Zone.AsteroidBelts[AsteroidBelt]; if (AsteroidBelt != Guid.Empty && Entity.Zone.AsteroidExists(AsteroidBelt, Asteroid) && @@ -62,12 +71,12 @@ public class MiningTool : Behavior Entity, AsteroidBelt, Asteroid, - Evaluate(_data.DamagePerSecond) * dt, - Evaluate(_data.Efficiency), - Evaluate(_data.Penetration)); + Evaluate(_damagePerSecond) * dt, + Evaluate(_efficiency), + Evaluate(_penetration)); return true; } return false; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs b/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs index 0011d665e..3527b9dcc 100644 --- a/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs +++ b/Assets/Scripts/ServerShared/Behaviors/ResourceScanner.cs @@ -34,7 +34,9 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior { public int Asteroid = -1; - private ResourceScannerConfig _data; + private readonly PerformanceStat _range; + private readonly PerformanceStat _minimumDensity; + private readonly PerformanceStat _scanDuration; private float _scanTime; private Guid _scanTarget; @@ -58,12 +60,16 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior public ResourceScanner(ResourceScannerConfig data, EquippedItem item) : base(data, item) { - _data = data; + _range = data.Range; + _minimumDensity = data.MinimumDensity; + _scanDuration = data.ScanDuration; } public ResourceScanner(ResourceScannerConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _range = data.Range; + _minimumDensity = data.MinimumDensity; + _scanDuration = data.ScanDuration; } public override bool Execute(float dt) @@ -100,8 +106,8 @@ public class ResourceScanner : Behavior, IAlwaysUpdatedBehavior public void Update(float delta) { - Range = Evaluate(_data.Range); - MinimumDensity = Evaluate(_data.MinimumDensity); - ScanDuration = Evaluate(_data.ScanDuration); + Range = Evaluate(_range); + MinimumDensity = Evaluate(_minimumDensity); + ScanDuration = Evaluate(_scanDuration); } } diff --git a/Assets/Scripts/ServerShared/Behaviors/Shield.cs b/Assets/Scripts/ServerShared/Behaviors/Shield.cs index 3a471f757..45e75b699 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Shield.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Shield.cs @@ -29,21 +29,24 @@ public class Shield : Behavior, IProgressBehavior public float Efficiency { get; private set; } public float EnergyUsage { get; private set; } - private ShieldConfig _data; + private readonly PerformanceStat _efficiency; + private readonly PerformanceStat _energyUsage; public Shield(ShieldConfig data, EquippedItem item) : base(data, item) { - _data = data; + _efficiency = data.Efficiency; + _energyUsage = data.EnergyUsage; } public Shield(ShieldConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _efficiency = data.Efficiency; + _energyUsage = data.EnergyUsage; } public override bool Execute(float dt) { - Efficiency = Evaluate(_data.Efficiency); - EnergyUsage = Evaluate(_data.EnergyUsage); + Efficiency = Evaluate(_efficiency); + EnergyUsage = Evaluate(_energyUsage); return true; } @@ -59,4 +62,4 @@ public class Shield : Behavior, IProgressBehavior } public virtual float Progress => Item.ThermalPerformance; -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Switch.cs b/Assets/Scripts/ServerShared/Behaviors/Switch.cs index 078c632b8..368911124 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Switch.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Switch.cs @@ -19,17 +19,13 @@ public class SwitchConfig : RuntimeBehaviorConfig public class Switch : Behavior, IActivatedBehavior { - private SwitchConfig _data; - public bool Activated { get; set; } public Switch(SwitchConfig data, EquippedItem item) : base(data, item) { - _data = data; } public Switch(SwitchConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; } public override bool Execute(float dt) @@ -46,4 +42,4 @@ public class Switch : Behavior, IActivatedBehavior { Activated = false; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs b/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs index ce5b13109..f787a3a11 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs @@ -29,23 +29,24 @@ public class ThermotoggleConfig : RuntimeBehaviorConfig public class Thermotoggle : Behavior { public float TargetTemperature; - private ThermotoggleConfig _data; - - public ThermotoggleConfig ThermotoggleConfig => _data; + public bool Adjustable { get; } + private readonly bool _highPass; public Thermotoggle(ThermotoggleConfig data, EquippedItem item) : base(data, item) { - _data = data; TargetTemperature = data.TargetTemperature; + _highPass = data.HighPass; + Adjustable = data.Adjustable; } public Thermotoggle(ThermotoggleConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; TargetTemperature = data.TargetTemperature; + _highPass = data.HighPass; + Adjustable = data.Adjustable; } public override bool Execute(float dt) { - return Temperature < TargetTemperature ^ _data.HighPass; + return Temperature < TargetTemperature ^ _highPass; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs index 5ae503cf0..4c7b2f820 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Thruster.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Thruster.cs @@ -46,13 +46,19 @@ public class Thruster : Behavior, IAnalogBehavior set => _input = saturate(value); } - private ThrusterConfig _data; + private readonly PerformanceStat _thrust; + private readonly PerformanceStat _visibility; + private readonly PerformanceStat _heat; + private readonly PerformanceStat _energyUsage; private float _input; public Thruster(ThrusterConfig data, EquippedItem item) : base(data, item) { - _data = data; + _thrust = data.Thrust; + _visibility = data.Visibility; + _heat = data.Heat; + _energyUsage = data.EnergyUsage; ParticlesPrefab = data.ParticlesPrefab; var hullShape = ItemManager.GetRuntimeShape(Entity.Hull); var itemShape = ItemManager.GetRuntimeShape(item.EquippableItem); @@ -60,28 +66,31 @@ public class Thruster : Behavior, IAnalogBehavior var itemCenter = hullShape.Inset(itemShape, item.Position, item.EquippableItem.Rotation).CenterOfMass; var toCenter = hullCenter - itemCenter; Torque = -dot(normalize(toCenter), float2(1, 0).Rotate(item.EquippableItem.Rotation)); - Thrust = Evaluate(_data.Thrust); + Thrust = Evaluate(_thrust); } public Thruster(ThrusterConfig data, ConsumableItemEffect item) : base(data, item) { - _data = data; + _thrust = data.Thrust; + _visibility = data.Visibility; + _heat = data.Heat; + _energyUsage = data.EnergyUsage; ParticlesPrefab = data.ParticlesPrefab; Torque = 0; - Thrust = Evaluate(_data.Thrust); + Thrust = Evaluate(_thrust); } public override bool Execute(float dt) { Item.SetAudioParameter(SpecialAudioParameter.Intensity, _input); - if(_input > .01f && Entity.TryConsumeEnergy(_input * Evaluate(_data.EnergyUsage))) + if(_input > .01f && Entity.TryConsumeEnergy(_input * Evaluate(_energyUsage))) { - Thrust = Evaluate(_data.Thrust); + Thrust = Evaluate(_thrust); Entity.Velocity -= Direction.xz * _input * Thrust / Entity.Mass * dt; Entity.Direction = mul(Entity.Direction, Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust * ItemManager.GameplaySettings.TorqueMultiplier / Entity.Mass * dt)); - AddHeat(_input * Evaluate(_data.Heat) * dt); - var vis = _input * Evaluate(_data.Visibility); + AddHeat(_input * Evaluate(_heat) * dt); + var vis = _input * Evaluate(_visibility); if (!Entity.VisibilitySources.TryGetValue(this, out var existingVisibility) || vis > existingVisibility) Entity.VisibilitySources[this] = vis; return true; diff --git a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs index 8e697db32..dfea2458b 100644 --- a/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs +++ b/Assets/Scripts/UI/Properties Panel/PropertiesPanel.cs @@ -628,7 +628,7 @@ public class PropertiesPanel : MonoBehaviour { switch (behavior) { - case Thermotoggle thermotoggle when thermotoggle.ThermotoggleConfig.Adjustable: + case Thermotoggle thermotoggle when thermotoggle.Adjustable: AddField("Target Temperature", () => thermotoggle.TargetTemperature, temp => thermotoggle.TargetTemperature = temp); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index d5170b282..0c12a1add 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -309,6 +309,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. config subclasses after construction. Wear, Visibility, Reflector, VelocityLimit, VelocityConversion, and ItemUsage now follow the same rule for their constructor stat/key/scalar inputs. + Capacitor, Shield, Thruster, MiningTool, ResourceScanner, Thermotoggle, + Switch, HeatStorage, and Cockpit have also dropped runtime config retention; + Thermotoggle adjustability is now owned by the live behavior instance. `StatModifier` behavior requirements and behavior-stat targets compare typed behavior kinds on the live equipped behavior instances through `AetheriaRuntimeBehaviorMetadataCatalog` instead of scanning config