Allow deploy orders to be queued from the command bar.
This commit is contained in:
@@ -137,9 +137,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
return new Order(order.OrderID, self, target, queued);
|
return new Order(order.OrderID, self, target, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
return new Order("Detonate", self, false);
|
return new Order("Detonate", self, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
return new Order("PlaceMine", self, Target.FromCell(self.World, self.Location), false);
|
return new Order("PlaceMine", self, Target.FromCell(self.World, self.Location), queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
||||||
|
|||||||
@@ -662,12 +662,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
if (!Info.RearmBuildings.Any())
|
if (!Info.RearmBuildings.Any())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new Order("ReturnToBase", self, false);
|
return new Order("ReturnToBase", self, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return Info.RearmBuildings.Any(); }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return Info.RearmBuildings.Any(); }
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return new Order(order.OrderID, self, target, queued);
|
return new Order(order.OrderID, self, target, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
return new Order("Detonate", self, false);
|
return new Order("Detonate", self, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
||||||
|
|||||||
@@ -174,9 +174,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
return new Order("Unload", self, false);
|
return new Order("Unload", self, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return true; }
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
return new Order("GrantConditionOnDeploy", self, false);
|
return new Order("GrantConditionOnDeploy", self, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return !IsTraitPaused && !IsTraitDisabled; }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return !IsTraitPaused && !IsTraitDisabled; }
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Order IIssueDeployOrder.IssueDeployOrder(Actor self)
|
Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued)
|
||||||
{
|
{
|
||||||
return new Order("DeployTransform", self, false);
|
return new Order("DeployTransform", self, queued);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return !IsTraitPaused && !IsTraitDisabled; }
|
bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return !IsTraitPaused && !IsTraitDisabled; }
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[RequireExplicitImplementation]
|
[RequireExplicitImplementation]
|
||||||
public interface IIssueDeployOrder
|
public interface IIssueDeployOrder
|
||||||
{
|
{
|
||||||
Order IssueDeployOrder(Actor self);
|
Order IssueDeployOrder(Actor self, bool queued);
|
||||||
bool CanIssueDeployOrder(Actor self);
|
bool CanIssueDeployOrder(Actor self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (highlightOnButtonPress)
|
if (highlightOnButtonPress)
|
||||||
deployHighlighted = 2;
|
deployHighlighted = 2;
|
||||||
|
|
||||||
PerformDeployOrderOnSelection();
|
var queued = Game.GetModifierKeys().HasModifier(Modifiers.Shift);
|
||||||
|
PerformDeployOrderOnSelection(queued);
|
||||||
};
|
};
|
||||||
|
|
||||||
deployButton.OnKeyPress = ki => { deployHighlighted = 2; deployButton.OnClick(); };
|
deployButton.OnKeyPress = ki => { deployHighlighted = 2; deployButton.OnClick(); };
|
||||||
@@ -207,14 +208,30 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
keyOverrides.AddHandler(e =>
|
keyOverrides.AddHandler(e =>
|
||||||
{
|
{
|
||||||
// HACK: enable attack move to be triggered if the ctrl key is pressed
|
// HACK: allow attack move to be triggered if the ctrl key is pressed (assault move)
|
||||||
e.Modifiers &= ~Modifiers.Ctrl;
|
var eNoCtrl = e;
|
||||||
if (!attackMoveDisabled && attackMoveButton.Key.IsActivatedBy(e))
|
eNoCtrl.Modifiers &= ~Modifiers.Ctrl;
|
||||||
|
|
||||||
|
if (attackMoveButton != null && !attackMoveDisabled && attackMoveButton.Key.IsActivatedBy(eNoCtrl))
|
||||||
{
|
{
|
||||||
attackMoveButton.OnKeyPress(e);
|
attackMoveButton.OnKeyPress(e);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HACK: allow deploy to be triggered if the shift key is pressed (queued order)
|
||||||
|
if (e.Modifiers.HasModifier(Modifiers.Shift) && e.Event == KeyInputEvent.Down)
|
||||||
|
{
|
||||||
|
var eNoShift = e;
|
||||||
|
eNoShift.Modifiers &= ~Modifiers.Shift;
|
||||||
|
|
||||||
|
if (deployButton != null && !deployButton.IsDisabled() &&
|
||||||
|
deployButton.Key.IsActivatedBy(eNoShift))
|
||||||
|
{
|
||||||
|
deployButton.OnKeyPress(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -302,13 +319,13 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
world.PlayVoiceForOrders(orders);
|
world.PlayVoiceForOrders(orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerformDeployOrderOnSelection()
|
void PerformDeployOrderOnSelection(bool queued)
|
||||||
{
|
{
|
||||||
UpdateStateIfNecessary();
|
UpdateStateIfNecessary();
|
||||||
|
|
||||||
var orders = selectedDeploys
|
var orders = selectedDeploys
|
||||||
.Where(pair => pair.Trait.CanIssueDeployOrder(pair.Actor))
|
.Where(pair => pair.Trait.CanIssueDeployOrder(pair.Actor))
|
||||||
.Select(d => d.Trait.IssueDeployOrder(d.Actor))
|
.Select(d => d.Trait.IssueDeployOrder(d.Actor, queued))
|
||||||
.Where(d => d != null)
|
.Where(d => d != null)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user