Move turret weapon stats behind runtime owner

This commit is contained in:
Meta Vens 2026-06-14 17:32:53 +01:00
commit a424be6bbc
4 changed files with 18 additions and 6 deletions

Binary file not shown.

View file

@ -22,7 +22,6 @@ public class TurretControllerData : BehaviorData
public class TurretController : Behavior, IInitializableBehavior
{
private TurretControllerData _data;
private List<Weapon> _weapons = new List<Weapon>();
private float _shotSpeed;
private bool _predictShots;
@ -33,12 +32,10 @@ public class TurretController : Behavior, IInitializableBehavior
public TurretController(TurretControllerData data, EquippedItem item) : base(data, item)
{
_data = data;
}
public TurretController(TurretControllerData data, ConsumableItemEffect item) : base(data, item)
{
_data = data;
}
public void Initialize()
@ -46,7 +43,7 @@ public class TurretController : Behavior, IInitializableBehavior
foreach (var weapon in Entity.GetBehaviors<Weapon>())
{
_weapons.Add(weapon);
var vel = weapon.Evaluate(weapon.WeaponData.Velocity);
var vel = weapon.EvaluateVelocity();
if (vel > .1f)
{
_predictShots = true;
@ -77,11 +74,10 @@ public class TurretController : Behavior, IInitializableBehavior
foreach (var x in _weapons)
{
var data = x.Data as WeaponData;
var fire = dot(
x.Direction,
Entity.LookDirection) > .99f;
if (x.Evaluate(data.Range) > dist && fire)
if (x.EvaluateRange() > dist && fire)
{
x.Activate();
}

View file

@ -126,4 +126,14 @@ public abstract class Weapon : Behavior, IActivatedBehavior
{
_firing = false;
}
public float EvaluateRange()
{
return Evaluate(_data.Range);
}
public float EvaluateVelocity()
{
return Evaluate(_data.Velocity);
}
}

View file

@ -838,6 +838,9 @@ First Aetheria surfaces to publish:
and target-stat count.
- Done: extend behavior state rows for TurretController initialized weapon
count, shot speed, and predictive-aim flag.
- Done: move TurretController weapon range and shot-speed evaluation behind
`Weapon` runtime methods, so turret AI no longer casts weapon config DTOs
to decide firing range or predictive aim.
- Done: cut live simulation grids out of `RuntimeEntityBlueprint`; loadout
and construction templates no longer capture or restore temperature,
armor, max-armor, or hull-conductivity state.
@ -994,6 +997,9 @@ First Aetheria surfaces to publish:
config bridge onto `Behavior.Kind` and `Behavior.Group`, so state
snapshots, weapon snapshots, progress rows, stat-modifier matching, and
behavior grouping use runtime instance identity.
- Done: move TurretController's weapon range/velocity reads off
`WeaponData` casts and onto `Weapon.EvaluateRange`/`EvaluateVelocity`;
weapon config fields remain private inputs to the weapon runtime owner.
- Done: delete the legacy `Behaviors` lists from `ConsumableItemData` and
`EquippableItemData`; item DTOs can no longer carry behavior config state.
- Done: move runtime blueprint price aggregation and conductivity restore