Reduce code duplication in AttackFollow

This commit is contained in:
abcdefg30
2022-06-09 14:21:44 +02:00
committed by Matthias Mailänder
parent 0134f63f4d
commit 5f86f56bed

View File

@@ -46,11 +46,11 @@ namespace OpenRA.Mods.Common.Traits
bool opportunityForceAttack; bool opportunityForceAttack;
bool opportunityTargetIsPersistentTarget; bool opportunityTargetIsPersistentTarget;
public void SetRequestedTarget(in Target target, bool isForceAttack = false) public void SetRequestedTarget(in Target target, bool isForceAttack = false, Activity requestedTargetPreset = null)
{ {
RequestedTarget = target; RequestedTarget = target;
requestedForceAttack = isForceAttack; requestedForceAttack = isForceAttack;
requestedTargetPresetForActivity = null; requestedTargetPresetForActivity = requestedTargetPreset;
} }
public void ClearRequestedTarget() public void ClearRequestedTarget()
@@ -164,11 +164,7 @@ namespace OpenRA.Mods.Common.Traits
// 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 (!queued) if (!queued)
{ SetRequestedTarget(target, forceAttack, activity);
RequestedTarget = target;
requestedForceAttack = forceAttack;
requestedTargetPresetForActivity = activity;
}
} }
public override void OnStopOrder(Actor self) public override void OnStopOrder(Actor self)