Remove a pile of duplication on mcv undeploy

This commit is contained in:
Paul Chote
2010-07-30 20:36:04 +12:00
parent 119f85dbf4
commit bde16e4e15
8 changed files with 52 additions and 122 deletions

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Traits
public readonly int[] SpawnOffset = null;
public readonly int[] ProductionOffset = null;
public readonly int[] ExitOffset = null;
public readonly bool EnablePrimary = true;
public readonly string[] Produces = { };
}
@@ -111,20 +112,20 @@ namespace OpenRA.Traits
}
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
if (mi.Button == MouseButton.Right && underCursor == self)
return new Order("Deploy", self);
{
if (mi.Button == MouseButton.Right && underCursor == self && self.Info.Traits.Get<ProductionInfo>().EnablePrimary)
return new Order("PrimaryProducer", self);
return null;
}
public string CursorForOrder(Actor self, Order order)
{
return (order.OrderString == "Deploy") ? "deploy" : null;
return (order.OrderString == "PrimaryProducer") ? "deploy" : null;
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "Deploy")
if (order.OrderString == "PrimaryProducer")
SetPrimaryProducer(self, !isPrimary);
}