Animate the correct fact

This commit is contained in:
Paul Chote
2010-02-06 17:44:19 +13:00
parent c280304875
commit 709fc39546

View File

@@ -26,12 +26,11 @@ namespace OpenRa.Traits
Sound.PlayToPlayer(order.Player, "placbldg.aud");
Sound.PlayToPlayer(order.Player, "build5.aud");
var facts = self.World.Queries.OwnedBy[self.Owner]
.WithTrait<ConstructionYard>().Select(x => x.Actor);
// TODO: Prioritise the primary conyard if it exists
var fact = self.World.Queries
.OwnedBy[self.Owner]
.WithTrait<ConstructionYard>()
.Select(x=>x.Actor).FirstOrDefault();
var primaryFact = facts.Where(y => y.traits.Get<Production>().IsPrimary);
var fact = (primaryFact.Count() > 0) ? primaryFact.FirstOrDefault() : facts.FirstOrDefault();
if (fact != null)
fact.traits.Get<RenderBuilding>().PlayCustomAnim(fact, "build");