Disable preemptive targeting for queued orders.

This commit is contained in:
tovl
2019-08-09 23:57:57 +02:00
committed by Paul Chote
parent 4193247169
commit 5393b689d4
3 changed files with 6 additions and 13 deletions

View File

@@ -63,11 +63,7 @@ namespace OpenRA.Mods.Common.Activities
ChildActivity.Cancel(self); ChildActivity.Cancel(self);
var attackBases = autoTarget.ActiveAttackBases; var attackBases = autoTarget.ActiveAttackBases;
foreach (var ab in attackBases) foreach (var ab in attackBases)
{ QueueChild(ab.GetAttackActivity(self, target, true, false));
var activity = ab.GetAttackActivity(self, target, true, false);
QueueChild(activity);
ab.OnQueueAttackActivity(self, activity, target, true, false);
}
// Make sure to continue moving when the attack activities have finished. // Make sure to continue moving when the attack activities have finished.
QueueChild(getInner()); QueueChild(getInner());

View File

@@ -399,15 +399,12 @@ namespace OpenRA.Mods.Common.Traits
if (!target.IsValidFor(self)) if (!target.IsValidFor(self))
return; return;
if (!queued)
self.CancelActivity();
var activity = GetAttackActivity(self, target, allowMove, forceAttack, targetLineColor); var activity = GetAttackActivity(self, target, allowMove, forceAttack, targetLineColor);
self.QueueActivity(activity); self.QueueActivity(queued, activity);
OnQueueAttackActivity(self, activity, target, allowMove, forceAttack); 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) public bool IsReachableTarget(Target target, bool allowMove)
{ {

View File

@@ -157,11 +157,11 @@ namespace OpenRA.Mods.Common.Traits
return new AttackActivity(self, newTarget, allowMove, forceAttack, targetLineColor); 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 // We can improve responsiveness for turreted actors by preempting
// the last order (usually a move) and setting the target immediately // the last order (usually a move) and setting the target immediately
if (self.CurrentActivity != null && self.CurrentActivity.NextActivity == activity) if (!queued)
{ {
RequestedTarget = target; RequestedTarget = target;
requestedForceAttack = forceAttack; requestedForceAttack = forceAttack;