Merge pull request #9759 from atlimit8/ActorsHavingTrait

Add ActorsHavingTrait<TTrait>()
This commit is contained in:
Oliver Brakmann
2015-11-04 22:26:10 +01:00
27 changed files with 132 additions and 125 deletions

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns an array of actors representing all ground attack units of this player.")]
public Actor[] GetGroundAttackers()
{
return Player.World.ActorsWithTrait<AttackBase>().Select(a => a.Actor)
return Player.World.ActorsHavingTrait<AttackBase>()
.Where(a => a.Owner == Player && !a.IsDead && a.IsInWorld && a.Info.HasTraitInfo<MobileInfo>())
.ToArray();
}