Human Note: i used AI to change the code so this works (rebuilt project and tested myself)
just the basic functionality not a dedicated toggle
it is just meant as a starting point to make your job easier if you do choose to implement such a feature.
here is a video of the wanted behaviour working ingame:
https://www.youtube.com/watch?v=l8Xq6xcuXRk
Is your feature request related to a problem? Please describe.
Currently, Guard Mode's point defense logic only populates the PDMslTgts list using results.incomingMissiles. Because the incoming threat scanner only flags missiles that are on a direct collision course with the defending vessel, ships cannot act as an active point-defense umbrella for nearby fleet members. They will exclusively intercept missiles that are actively threatening themselves.
Describe the solution you'd like
I would like to see a toggle switch or option (e.g., "Area Defense" or "Fleet Point Defense") added to the Weapon Manager GUI. When enabled, this would bypass results.incomingMissiles and instead evaluate the global BDATargetManager.FiredMissiles list to intercept any hostile ordnance within physical reach.
I have already written and tested the backend logic for this. By filtering the global list using a sqrMagnitude check against pointDefenseMissileMaxRange (instead of the visual guardRange), the AI avoids feeding out-of-range targets into the array. This prevents the GetNextPDMslTgt failsafe from resetting the tracking index to 0, allowing the vessel to cleanly ripple-fire across an entire enemy salvo without encountering a targeting deadlock.
This logic successfully replaces the if (guardMode && missileIsIncoming) block located in Control\MissileFire.cs (approximately line 9143, inside the PointDefenseTurretFiring() method
if (guardMode)
{
// Cache the squared physical range of the interceptors to optimize the math.
// CRITICAL: We must filter by the interceptor's actual physical range rather than the visual
// 'guardRange'. If out-of-range targets enter the list, the AI trips a hardcoded failsafe,
// resets its tracking index to 0, and gets trapped in a targeting deadlock.
float maxSqrDist = pointDefenseMissileMaxRange * pointDefenseMissileMaxRange;
// Iterate through the global list of all currently active missiles in the game
using (var missile = BDATargetManager.FiredMissiles.GetEnumerator())
{
while (missile.MoveNext())
{
// Verify the object is a valid missile with an active physics vessel
if (missile.Current is not MissileBase currMsl || currMsl.vessel == null) continue;
// Ignore friendly ordnance
if (!Team.IsEnemy(currMsl.Team)) continue;
// Ignore enemy missiles that are outside our physical engagement envelope
if ((vessel.CoM - currMsl.vessel.CoM).sqrMagnitude > maxSqrDist) continue;
// Extract the targeting component and add it to our point defense queue if it isn't already tracked
if (currMsl.vessel.gameObject.TryGetComponent<TargetInfo>(out var tInfo) && !PDMslTgts.Contains(tInfo))
{
PDMslTgts.Add(tInfo);
}
}
}
}
Describe alternatives you've considered
Not submitting a feature request
Additional context
Please tell if there is anything else that i can do to help incase you go forward with this.
Human Note: i used AI to change the code so this works (rebuilt project and tested myself)
just the basic functionality not a dedicated toggle
it is just meant as a starting point to make your job easier if you do choose to implement such a feature.
here is a video of the wanted behaviour working ingame:
https://www.youtube.com/watch?v=l8Xq6xcuXRk
Is your feature request related to a problem? Please describe.
Currently, Guard Mode's point defense logic only populates the PDMslTgts list using results.incomingMissiles. Because the incoming threat scanner only flags missiles that are on a direct collision course with the defending vessel, ships cannot act as an active point-defense umbrella for nearby fleet members. They will exclusively intercept missiles that are actively threatening themselves.
Describe the solution you'd like
I would like to see a toggle switch or option (e.g., "Area Defense" or "Fleet Point Defense") added to the Weapon Manager GUI. When enabled, this would bypass results.incomingMissiles and instead evaluate the global BDATargetManager.FiredMissiles list to intercept any hostile ordnance within physical reach.
I have already written and tested the backend logic for this. By filtering the global list using a sqrMagnitude check against pointDefenseMissileMaxRange (instead of the visual guardRange), the AI avoids feeding out-of-range targets into the array. This prevents the GetNextPDMslTgt failsafe from resetting the tracking index to 0, allowing the vessel to cleanly ripple-fire across an entire enemy salvo without encountering a targeting deadlock.
This logic successfully replaces the if (guardMode && missileIsIncoming) block located in Control\MissileFire.cs (approximately line 9143, inside the PointDefenseTurretFiring() method
Describe alternatives you've considered
Not submitting a feature request
Additional context
Please tell if there is anything else that i can do to help incase you go forward with this.