When changing rally point also make primary building #12855

This commit is contained in:
rob-v
2017-03-17 12:36:32 +01:00
parent b6810f3dd3
commit bfcb37e1b7
2 changed files with 30 additions and 7 deletions

View File

@@ -40,6 +40,8 @@ namespace OpenRA.Mods.Common.Traits
public class PrimaryBuilding : INotifyCreated, IIssueOrder, IResolveOrder
{
const string OrderID = "PrimaryProducer";
readonly PrimaryBuildingInfo info;
ConditionManager conditionManager;
int primaryToken = ConditionManager.InvalidConditionToken;
@@ -58,12 +60,12 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<IOrderTargeter> IIssueOrder.Orders
{
get { yield return new DeployOrderTargeter("PrimaryProducer", 1); }
get { yield return new DeployOrderTargeter(OrderID, 1); }
}
Order IIssueOrder.IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
{
if (order.OrderID == "PrimaryProducer")
if (order.OrderID == OrderID)
return new Order(order.OrderID, self, false);
return null;
@@ -71,8 +73,9 @@ namespace OpenRA.Mods.Common.Traits
void IResolveOrder.ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "PrimaryProducer")
SetPrimaryProducer(self, !IsPrimary);
var forceRallyPoint = RallyPoint.IsForceSet(order);
if (order.OrderString == OrderID || forceRallyPoint)
SetPrimaryProducer(self, !IsPrimary || forceRallyPoint);
}
public void SetPrimaryProducer(Actor self, bool isPrimary)