Introduce a Targetable trait; Subs can attack bridges; May introduce subtle bugs due to previous stupid assumption that !selectable == !attackable.

This commit is contained in:
Paul Chote
2010-07-28 22:57:14 +12:00
parent f9f6720437
commit 7a4fa93ce9
15 changed files with 91 additions and 58 deletions

View File

@@ -81,17 +81,6 @@ namespace OpenRA
if (r * r >= (new int2(i, j) - a).LengthSquared)
yield return new int2(i, j);
}
public static IEnumerable<Actor> SelectActorsInBox(this World world, float2 a, float2 b)
{
return world.FindUnits(a, b)
.Where( x => x.traits.Contains<Selectable>() && x.IsVisible() )
.GroupBy(x => (x.Owner == world.LocalPlayer) ? x.Info.Traits.Get<SelectableInfo>().Priority : 0)
.OrderByDescending(g => g.Key)
.Select( g => g.AsEnumerable() )
.DefaultIfEmpty( new Actor[] {} )
.FirstOrDefault();
}
public static string GetTerrainType(this World world, int2 cell)
{