Replace IPreventsAutoTarget with IDisable(Enemy)AutoTarget.

This allows traits on the attacking unit to suppress auto targeting
and makes the distinction between the two interfaces clear.
This commit is contained in:
Paul Chote
2019-05-17 19:51:35 +00:00
committed by abcdefg30
parent f9fe7486b3
commit 55f6744cf3
3 changed files with 23 additions and 6 deletions

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public class CaptureManager : INotifyCreated, INotifyCapture, ITick, IPreventsAutoTarget
public class CaptureManager : INotifyCreated, INotifyCapture, ITick, IDisableEnemyAutoTarget
{
readonly CaptureManagerInfo info;
ConditionManager conditionManager;
@@ -283,7 +283,7 @@ namespace OpenRA.Mods.Common.Traits
w.Update(currentTarget, self, currentTarget, currentTargetDelay, currentTargetTotal);
}
bool IPreventsAutoTarget.PreventsAutoTarget(Actor self, Actor attacker)
bool IDisableEnemyAutoTarget.DisableEnemyAutoTarget(Actor self, Actor attacker)
{
return info.PreventsAutoTarget && currentCaptors.Any(c => attacker.AppearsFriendlyTo(c));
}