Allies 04: Make Soviets sell buildings when they are low on health. Have the bridge be destroyed by a Soviet tank

This commit is contained in:
Scott_NZ
2013-01-20 18:07:12 +13:00
parent 4b228a71ef
commit 5b7523b9e0
4 changed files with 173 additions and 74 deletions

View File

@@ -25,20 +25,23 @@ namespace OpenRA.Mods.RA
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "Sell")
{
if (!self.Trait<Building>().Lock())
return;
Sell(self);
}
foreach( var ns in self.TraitsImplementing<INotifySold>() )
ns.Selling( self );
public void Sell(Actor self)
{
if (!self.Trait<Building>().Lock())
return;
self.CancelActivity();
foreach (var ns in self.TraitsImplementing<INotifySold>())
ns.Selling(self);
var rb = self.TraitOrDefault<RenderBuilding>();
if (rb != null && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation)
self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make")));
self.QueueActivity(new Sell());
}
self.CancelActivity();
var rb = self.TraitOrDefault<RenderBuilding>();
if (rb != null && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation)
self.QueueActivity(new MakeAnimation(self, true, () => rb.PlayCustomAnim(self, "make")));
self.QueueActivity(new Sell());
}
}
}