Add ActorInfo.HasTraitInfo<T>() requiring ITraitInfo types

This commit is contained in:
atlimit8
2015-08-02 12:44:46 -05:00
parent 85fab45451
commit 8162fa27ab
77 changed files with 138 additions and 136 deletions

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common
if (self.IsDead)
return false;
if (!self.Info.Traits.Contains<IOccupySpace>())
if (!self.Info.HasTraitInfo<IOccupySpaceInfo>())
return false;
if (!self.IsInWorld)
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common
if (stance == Stance.Ally)
return true;
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.Traits.Contains<IgnoresDisguiseInfo>())
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.HasTraitInfo<IgnoresDisguiseInfo>())
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Ally;
return stance == Stance.Ally;
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common
if (stance == Stance.Ally)
return false; /* otherwise, we'll hate friendly disguised spies */
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.Traits.Contains<IgnoresDisguiseInfo>())
if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.Info.HasTraitInfo<IgnoresDisguiseInfo>())
return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Enemy;
return stance == Stance.Enemy;