void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance) { // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting if (newStance > oldStance || forceAttack) { return; } if (target.Type == TargetType.Actor) { var a = target.Actor; if (!autoTarget.HasValidTargetPriority(self, a.Owner, a.GetEnabledTargetTypes())) { Cancel(self, true); } } else if (target.Type == TargetType.FrozenActor) { var fa = target.FrozenActor; if (!autoTarget.HasValidTargetPriority(self, fa.Owner, fa.TargetTypes)) { Cancel(self, true); } } }
void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance) { // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting if (newStance > oldStance || forceAttack) { return; } if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes)) { target = Target.Invalid; } }
void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance) { // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting if (newStance > oldStance || forceAttack) { return; } // 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(); } }