Remove invalid squad members before responding to attack.

This commit is contained in:
Matthias Mailänder
2024-07-27 11:38:10 +02:00
committed by Gustas
parent ff276b4877
commit 822a29aa76

View File

@@ -476,6 +476,7 @@ namespace OpenRA.Mods.Common.Traits
{
var protectSq = GetSquadOfType(SquadType.Protection);
protectSq ??= RegisterNewSquad(bot, SquadType.Protection, (attacker, WVec.Zero));
protectSq.Units.RemoveWhere(unitCannotBeOrdered);
if (protectSq.IsValid && !protectSq.IsTargetValid(protectSq.CenterUnit()))
protectSq.SetActorToTarget((attacker, WVec.Zero));