Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable preemptive targeting for queued orders. #16918

Merged
merged 1 commit into from Aug 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions OpenRA.Mods.Common/Activities/Move/AttackMoveActivity.cs
Expand Up @@ -63,11 +63,7 @@ public override bool Tick(Actor self)
ChildActivity.Cancel(self);
var attackBases = autoTarget.ActiveAttackBases;
foreach (var ab in attackBases)
{
var activity = ab.GetAttackActivity(self, target, true, false);
QueueChild(activity);
ab.OnQueueAttackActivity(self, activity, target, true, false);
}
QueueChild(ab.GetAttackActivity(self, target, true, false));

// Make sure to continue moving when the attack activities have finished.
QueueChild(getInner());
Expand Down
9 changes: 3 additions & 6 deletions OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
Expand Up @@ -399,15 +399,12 @@ public void AttackTarget(Target target, bool queued, bool allowMove, bool forceA
if (!target.IsValidFor(self))
return;

if (!queued)
self.CancelActivity();

var activity = GetAttackActivity(self, target, allowMove, forceAttack, targetLineColor);
self.QueueActivity(activity);
OnQueueAttackActivity(self, activity, target, allowMove, forceAttack);
self.QueueActivity(queued, activity);
OnResolveAttackOrder(self, activity, target, queued, forceAttack);
}

public virtual void OnQueueAttackActivity(Actor self, Activity activity, Target target, bool allowMove, bool forceAttack) { }
public virtual void OnResolveAttackOrder(Actor self, Activity activity, Target target, bool queued, bool forceAttack) { }

public bool IsReachableTarget(Target target, bool allowMove)
{
Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs
Expand Up @@ -157,11 +157,11 @@ public override Activity GetAttackActivity(Actor self, Target newTarget, bool al
return new AttackActivity(self, newTarget, allowMove, forceAttack, targetLineColor);
}

public override void OnQueueAttackActivity(Actor self, Activity activity, Target target, bool allowMove, bool forceAttack)
public override void OnResolveAttackOrder(Actor self, Activity activity, Target target, bool queued, bool forceAttack)
{
// We can improve responsiveness for turreted actors by preempting
// the last order (usually a move) and setting the target immediately
if (self.CurrentActivity != null && self.CurrentActivity.NextActivity == activity)
if (!queued)
{
RequestedTarget = target;
requestedForceAttack = forceAttack;
Expand Down