This commit is contained in:
Matthias Mailänder
2014-04-18 12:32:48 +02:00
parent 048289e6a9
commit fcca5a7683

View File

@@ -203,9 +203,9 @@ namespace OpenRA.Mods.RA
Queue[ 0 ].Tick(playerResources); Queue[ 0 ].Tick(playerResources);
} }
public void ResolveOrder( Actor self, Order order ) public void ResolveOrder(Actor self, Order order)
{ {
switch( order.OrderString ) switch(order.OrderString)
{ {
case "StartProduction": case "StartProduction":
{ {
@@ -233,11 +233,9 @@ namespace OpenRA.Mods.RA
{ {
bool hasPlayedSound = false; bool hasPlayedSound = false;
BeginProduction(new ProductionItem(this, order.TargetString, cost, PlayerPower, BeginProduction(new ProductionItem(this, order.TargetString, cost, PlayerPower,
() => self.World.AddFrameEndTask( () => self.World.AddFrameEndTask(_ =>
_ =>
{ {
var isBuilding = unit.Traits.Contains<BuildingInfo>(); var isBuilding = unit.Traits.Contains<BuildingInfo>();
if (isBuilding && !hasPlayedSound) if (isBuilding && !hasPlayedSound)
{ {
hasPlayedSound = Sound.PlayNotification(self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); hasPlayedSound = Sound.PlayNotification(self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race);
@@ -257,13 +255,13 @@ namespace OpenRA.Mods.RA
} }
case "PauseProduction": case "PauseProduction":
{ {
if( Queue.Count > 0 && Queue[0].Item == order.TargetString ) if (Queue.Count > 0 && Queue[0].Item == order.TargetString)
Queue[0].Paused = ( order.TargetLocation.X != 0 ); Queue[0].Paused = ( order.TargetLocation.X != 0 );
break; break;
} }
case "CancelProduction": case "CancelProduction":
{ {
CancelProduction(order.TargetString,order.TargetLocation.X); CancelProduction(order.TargetString, order.TargetLocation.X);
break; break;
} }
} }
@@ -309,14 +307,14 @@ namespace OpenRA.Mods.RA
Queue.RemoveAt(0); Queue.RemoveAt(0);
} }
protected void BeginProduction( ProductionItem item ) protected void BeginProduction(ProductionItem item)
{ {
Queue.Add(item); Queue.Add(item);
} }
// Builds a unit from the actor that holds this queue (1 queue per building) // Builds a unit from the actor that holds this queue (1 queue per building)
// Returns false if the unit can't be built // Returns false if the unit can't be built
protected virtual bool BuildUnit( string name ) protected virtual bool BuildUnit(string name)
{ {
// Cannot produce if i'm dead // Cannot produce if i'm dead
if (!self.IsInWorld || self.IsDead()) if (!self.IsInWorld || self.IsDead())
@@ -326,7 +324,7 @@ namespace OpenRA.Mods.RA
} }
var sp = self.TraitsImplementing<Production>().FirstOrDefault(p => p.Info.Produces.Contains(Info.Type)); var sp = self.TraitsImplementing<Production>().FirstOrDefault(p => p.Info.Produces.Contains(Info.Type));
if (sp != null && !self.IsDisabled() && sp.Produce(self, Rules.Info[ name ])) if (sp != null && !self.IsDisabled() && sp.Produce(self, Rules.Info[name]))
{ {
FinishProduction(); FinishProduction();
return true; return true;