Split Target.Recalculate into methods with and without invalidation.

TargetExtensions is moved into its own file.
This commit is contained in:
Paul Chote
2019-01-16 11:07:07 +00:00
parent 2080c72ab9
commit d03c5b1c48
6 changed files with 94 additions and 48 deletions

View File

@@ -46,7 +46,9 @@ namespace OpenRA.Mods.Common.Traits
public override Activity Tick(Actor self)
{
target = target.Recalculate(self.Owner);
// This activity can't move to reacquire hidden targets, so use the
// Recalculate overload that invalidates hidden targets.
target = target.RecalculateInvalidatingHiddenTargets(self.Owner);
if (IsCanceled || !target.IsValidFor(self) || !attack.IsReachableTarget(target, allowMove))
return NextActivity;