Add ActorsHavingTrait<TTrait>([Func<TTrait, bool])

This commit is contained in:
atlimit8
2015-10-25 04:45:53 -05:00
parent 0997f5b52f
commit b6f17df260
27 changed files with 132 additions and 125 deletions

View File

@@ -72,10 +72,9 @@ namespace OpenRA.Mods.Common.Traits
continue; // Cell is empty; continue search
// Cell contains an actor. Is it the type we want?
if (world.ActorsWithTrait<LineBuildNode>().Any(a =>
(a.Actor.Location == cell &&
a.Actor.Info.TraitInfo<LineBuildNodeInfo>()
.Types.Overlaps(lbi.NodeTypes))))
if (world.ActorsHavingTrait<LineBuildNode>()
.Any(a => a.Location == cell
&& a.Info.TraitInfo<LineBuildNodeInfo>().Types.Overlaps(lbi.NodeTypes)))
dirs[d] = i; // Cell contains actor of correct type
else
dirs[d] = -1; // Cell is blocked by another actor type