hack in stop order support to various classes. not happy with this.

This commit is contained in:
Chris Forbes
2010-12-06 21:00:06 +13:00
parent 8b82df8298
commit 25ebdea758
5 changed files with 30 additions and 1 deletions

View File

@@ -109,6 +109,17 @@ namespace OpenRA.Mods.RA.Air
self.QueueActivity(Info.RearmBuildings.Contains(order.TargetActor.Info.Name) self.QueueActivity(Info.RearmBuildings.Contains(order.TargetActor.Info.Name)
? (IActivity)new Rearm() : new Repair(order.TargetActor)); ? (IActivity)new Rearm() : new Repair(order.TargetActor));
} }
if (order.OrderString == "Stop")
{
self.CancelActivity();
if (Info.LandWhenIdle)
{
self.QueueActivity(new Turn(Info.InitialFacing));
self.QueueActivity(new HeliLand(true));
}
}
} }
int offsetTicks = 0; int offsetTicks = 0;

View File

@@ -112,6 +112,11 @@ namespace OpenRA.Mods.RA.Air
info.RearmBuildings.Contains(order.TargetActor.Info.Name) info.RearmBuildings.Contains(order.TargetActor.Info.Name)
? (IActivity)new Rearm() : new Repair(order.TargetActor)); ? (IActivity)new Rearm() : new Repair(order.TargetActor));
} }
else if (order.OrderString == "Stop")
{
UnReserve();
self.CancelActivity();
}
else else
{ {
// Game.Debug("Unreserve due to unhandled order: {0}".F(order.OrderString)); // Game.Debug("Unreserve due to unhandled order: {0}".F(order.OrderString));

View File

@@ -149,7 +149,7 @@ namespace OpenRA.Mods.RA
return null; return null;
} }
public void ResolveOrder(Actor self, Order order) public virtual void ResolveOrder(Actor self, Order order)
{ {
if (order.OrderString == "Attack" || order.OrderString == "AttackHold") if (order.OrderString == "Attack" || order.OrderString == "AttackHold")
{ {

View File

@@ -53,6 +53,14 @@ namespace OpenRA.Mods.RA
return new AttackActivity( newTarget ); return new AttackActivity( newTarget );
} }
public override void ResolveOrder(Actor self, Order order)
{
base.ResolveOrder(self, order);
if (order.OrderString == "Stop")
target = Target.None;
}
bool buildComplete = false; bool buildComplete = false;
public void BuildingComplete(Actor self) { buildComplete = true; } public void BuildingComplete(Actor self) { buildComplete = true; }

View File

@@ -205,6 +205,11 @@ namespace OpenRA.Mods.RA.Move
var target = order.TargetLocation.Clamp(self.World.Map.Bounds); var target = order.TargetLocation.Clamp(self.World.Map.Bounds);
PerformMove(self, target, order.Queued && !self.IsIdle); PerformMove(self, target, order.Queued && !self.IsIdle);
} }
if (order.OrderString == "Stop")
{
self.CancelActivity();
}
} }
public string VoicePhraseForOrder(Actor self, Order order) public string VoicePhraseForOrder(Actor self, Order order)