Remove Selectable boolean from Selectable trait

Add work-around for ta/td bridge huts since they need actor Bounds to
be targetable by C4/engineer repair.
This commit is contained in:
reaperrr
2015-06-05 16:36:54 +02:00
parent 2afa3cfa3a
commit c23ee1be2e
15 changed files with 73 additions and 51 deletions

View File

@@ -92,7 +92,7 @@ namespace OpenRA.Widgets
{
if (!hasBox && World.Selection.Actors.Any() && !multiClick)
{
if (!(World.ScreenMap.ActorsAt(xy).Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable &&
if (!(World.ScreenMap.ActorsAt(xy).Where(x => x.HasTrait<Selectable>() &&
(x.Owner.IsAlliedWith(World.RenderPlayer) || !World.FogObscures(x))).Any() && !mi.Modifiers.HasModifier(Modifiers.Ctrl) &&
!mi.Modifiers.HasModifier(Modifiers.Alt) && UnitOrderGenerator.InputOverridesSelection(World, xy, mi)))
{
@@ -292,7 +292,7 @@ namespace OpenRA.Widgets
var s = a.TraitOrDefault<Selectable>();
// sc == null means that units, that meet all other criteria, get selected
return s != null && s.Info.Selectable && (selectionClasses == null || selectionClasses.Contains(s.Class));
return s != null && (selectionClasses == null || selectionClasses.Contains(s.Class));
});
}
@@ -303,11 +303,7 @@ namespace OpenRA.Widgets
a = b;
return world.ScreenMap.ActorsInBox(a, b)
.Where(x =>
{
var s = x.TraitOrDefault<Selectable>();
return s != null && s.Info.Selectable && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x));
})
.Where(x => x.HasTrait<Selectable>() && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x)))
.GroupBy(x => x.GetSelectionPriority())
.OrderByDescending(g => g.Key)
.Select(g => g.AsEnumerable())