WeaponData.Tracking and Weapon.Tracking: the gun's mount rate in degrees per second

Key 33 (first free across WeaponData and its subclasses), default positive infinity: an unauthored gun has a mount
that follows anything. The resolver's NaN fallback to Min yields +infinity for the degenerate lerp.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-07 16:39:59 +02:00
commit 8cd71ed6da

View file

@ -66,6 +66,11 @@ public abstract class WeaponData : BehaviorData
[Inspectable, JsonProperty("velocity"), Key(16)]
public PerformanceStat Velocity = new PerformanceStat();
// How fast the mount follows a target sweeping the shooter's sky, in degrees per second, authored per gun (ruling
// weapon-tracking-authored). Unauthored is a mount that follows anything: FireControl.PMount reads +infinity as 1.
[Inspectable, JsonProperty("tracking"), Key(33), RuntimeInspectable]
public PerformanceStat Tracking = new PerformanceStat { Min = float.PositiveInfinity, Max = float.PositiveInfinity };
}
public abstract class Weapon : Behavior, IActivatedBehavior
@ -87,6 +92,7 @@ public abstract class Weapon : Behavior, IActivatedBehavior
public float Visibility { get; protected set; }
public float Spread { get; protected set; }
public float Velocity { get; protected set; }
public float Tracking { get; protected set; }
// Mining Cut 3 fix (Q12 A, "launchers cannot mine"): whether this weapon can mine a chunk. The one mining
// predicate: chunk reach (Entity.VisibleChunksInReach) reads it, and so does anything that decides a weapon
@ -138,6 +144,7 @@ public abstract class Weapon : Behavior, IActivatedBehavior
Visibility = Evaluate(_data.Visibility);
Spread = Evaluate(_data.Spread);
Velocity = Evaluate(_data.Velocity);
Tracking = Evaluate(_data.Tracking);
}
public override bool Execute(float dt)