Make AutoTargetIgnore upgradeable

This commit is contained in:
abcdefg30
2016-10-15 18:14:24 +02:00
parent 870c82e727
commit 700d141c24

View File

@@ -259,12 +259,19 @@ namespace OpenRA.Mods.Common.Traits
} }
[Desc("Will not get automatically targeted by enemy (like walls)")] [Desc("Will not get automatically targeted by enemy (like walls)")]
class AutoTargetIgnoreInfo : TraitInfo<AutoTargetIgnore> { } class AutoTargetIgnoreInfo : ConditionalTraitInfo
class AutoTargetIgnore : IPreventsAutoTarget
{ {
public override object Create(ActorInitializer init) { return new AutoTargetIgnore(this); }
}
class AutoTargetIgnore : ConditionalTrait<AutoTargetIgnoreInfo>, IPreventsAutoTarget
{
public AutoTargetIgnore(AutoTargetIgnoreInfo info)
: base(info) { }
public bool PreventsAutoTarget(Actor self, Actor attacker) public bool PreventsAutoTarget(Actor self, Actor attacker)
{ {
return true; return !IsTraitDisabled;
} }
} }