Fix return fire logic ignoring AutoAttack priotities

Added brand new feature

Unnecessary assignmet removed
This commit is contained in:
Guillermoqnk
2023-03-10 11:06:57 +01:00
committed by Gustas
parent 3b0b15abb9
commit b3d468aca1

View File

@@ -256,6 +256,15 @@ namespace OpenRA.Mods.Common.Traits
if (attacker.AppearsFriendlyTo(self))
return;
// Respect AutoAttack priorities.
if (stance > UnitStance.ReturnFire)
{
var autoTarget = ScanForTarget(self, allowMove, true);
if (autoTarget != Target.Invalid)
attacker = autoTarget.Actor;
}
Aggressor = attacker;
Attack(Target.FromActor(Aggressor), allowMove);