Drop invisible invalid targets immediately when changing stance
This commit is contained in:
@@ -156,7 +156,8 @@ namespace OpenRA.Mods.Cnc.Activities
|
||||
if (newStance > oldStance || forceAttack)
|
||||
return;
|
||||
|
||||
if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
// If lastVisibleTarget is invalid we could never view the target in the first place, so we just drop it here too
|
||||
if (!lastVisibleTarget.IsValidFor(self) || !autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
target = Target.Invalid;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (newStance > oldStance || forceAttack)
|
||||
return;
|
||||
|
||||
if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
// If lastVisibleTarget is invalid we could never view the target in the first place, so we just drop it here too
|
||||
if (!lastVisibleTarget.IsValidFor(self) || !autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
attackAircraft.ClearRequestedTarget();
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
if (newStance > oldStance || forceAttack)
|
||||
return;
|
||||
|
||||
if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
// If lastVisibleTarget is invalid we could never view the target in the first place, so we just drop it here too
|
||||
if (!lastVisibleTarget.IsValidFor(self) || !autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
target = Target.Invalid;
|
||||
}
|
||||
|
||||
|
||||
@@ -364,7 +364,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (newStance > oldStance || forceAttack)
|
||||
return;
|
||||
|
||||
if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
// If lastVisibleTarget is invalid we could never view the target in the first place, so we just drop it here too
|
||||
if (!lastVisibleTarget.IsValidFor(self) || !autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
|
||||
attack.ClearRequestedTarget();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user