Fix the command bar selecting dead units
and crashing while doing a trait lookup on them.
This commit is contained in:
committed by
abcdefg30
parent
8a7020b4ef
commit
0d64fa549b
@@ -218,7 +218,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
protected override void SelectionChanged(World world, IEnumerable<Actor> selected)
|
protected override void SelectionChanged(World world, IEnumerable<Actor> selected)
|
||||||
{
|
{
|
||||||
minelayers.Clear();
|
minelayers.Clear();
|
||||||
minelayers.AddRange(selected.Where(s => s.Info.HasTraitInfo<MinelayerInfo>()));
|
minelayers.AddRange(selected.Where(s => !s.IsDead && s.Info.HasTraitInfo<MinelayerInfo>()));
|
||||||
if (!minelayers.Any())
|
if (!minelayers.Any())
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
public override void SelectionChanged(World world, IEnumerable<Actor> selected)
|
public override void SelectionChanged(World world, IEnumerable<Actor> selected)
|
||||||
{
|
{
|
||||||
// Guarding doesn't work without AutoTarget, so require at least one unit in the selection to have it
|
// Guarding doesn't work without AutoTarget, so require at least one unit in the selection to have it
|
||||||
subjects = selected.Where(s => s.Info.HasTraitInfo<GuardInfo>());
|
subjects = selected.Where(s => !s.IsDead && s.Info.HasTraitInfo<GuardInfo>());
|
||||||
if (!subjects.Any(s => s.Info.HasTraitInfo<AutoTargetInfo>()))
|
if (!subjects.Any(s => s.Info.HasTraitInfo<AutoTargetInfo>()))
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override void SelectionChanged(World world, IEnumerable<Actor> selected)
|
public override void SelectionChanged(World world, IEnumerable<Actor> selected)
|
||||||
{
|
{
|
||||||
subjects = selected.SelectMany(a => a.TraitsImplementing<AttackMove>()
|
subjects = selected.Where(s => !s.IsDead).SelectMany(a => a.TraitsImplementing<AttackMove>()
|
||||||
.Select(am => new TraitPair<AttackMove>(a, am)))
|
.Select(am => new TraitPair<AttackMove>(a, am)))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user