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

@@ -17,11 +17,9 @@ namespace OpenRA.Mods.Common
{
public static bool HasNoRequiredUnits(this Player player)
{
return !player.World.ActorsWithTrait<MustBeDestroyed>().Any(p =>
{
return p.Actor.Owner == player &&
(player.World.LobbyInfo.GlobalSettings.ShortGame ? p.Trait.Info.RequiredForShortGame : p.Actor.IsInWorld);
});
if (player.World.LobbyInfo.GlobalSettings.ShortGame)
return !player.World.ActorsHavingTrait<MustBeDestroyed>(t => t.Info.RequiredForShortGame).Any(a => a.Owner == player);
return !player.World.ActorsHavingTrait<MustBeDestroyed>().Any(a => a.Owner == player && a.IsInWorld);
}
}
}