diff --git a/OpenRA.Mods.Cnc/Traits/MadTank.cs b/OpenRA.Mods.Cnc/Traits/MadTank.cs index be12bf5f21..c235958baf 100644 --- a/OpenRA.Mods.Cnc/Traits/MadTank.cs +++ b/OpenRA.Mods.Cnc/Traits/MadTank.cs @@ -137,9 +137,9 @@ namespace OpenRA.Mods.Cnc.Traits 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; } diff --git a/OpenRA.Mods.Cnc/Traits/Minelayer.cs b/OpenRA.Mods.Cnc/Traits/Minelayer.cs index 3bc1ef3dae..55e6316592 100644 --- a/OpenRA.Mods.Cnc/Traits/Minelayer.cs +++ b/OpenRA.Mods.Cnc/Traits/Minelayer.cs @@ -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; } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index fe2ab59821..2346e28aa9 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -662,12 +662,12 @@ namespace OpenRA.Mods.Common.Traits return null; } - Order IIssueDeployOrder.IssueDeployOrder(Actor self) + Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued) { if (!Info.RearmBuildings.Any()) return null; - return new Order("ReturnToBase", self, false); + return new Order("ReturnToBase", self, queued); } bool IIssueDeployOrder.CanIssueDeployOrder(Actor self) { return Info.RearmBuildings.Any(); } diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs b/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs index 76ed652a58..75a0c2127f 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackSuicides.cs @@ -59,9 +59,9 @@ namespace OpenRA.Mods.Common.Traits 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; } diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index 31bac2bc00..e7ca130798 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -174,9 +174,9 @@ namespace OpenRA.Mods.Common.Traits 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; } diff --git a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs index 66d197c573..ffeb7e6c48 100644 --- a/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Conditions/GrantConditionOnDeploy.cs @@ -136,9 +136,9 @@ namespace OpenRA.Mods.Common.Traits 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; } diff --git a/OpenRA.Mods.Common/Traits/Transforms.cs b/OpenRA.Mods.Common/Traits/Transforms.cs index b1cab0cd39..9317fa4c5d 100644 --- a/OpenRA.Mods.Common/Traits/Transforms.cs +++ b/OpenRA.Mods.Common/Traits/Transforms.cs @@ -102,9 +102,9 @@ namespace OpenRA.Mods.Common.Traits 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; } diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs index 37e8ed195f..88e5cd725a 100644 --- a/OpenRA.Mods.Common/TraitsInterfaces.cs +++ b/OpenRA.Mods.Common/TraitsInterfaces.cs @@ -371,7 +371,7 @@ namespace OpenRA.Mods.Common.Traits [RequireExplicitImplementation] public interface IIssueDeployOrder { - Order IssueDeployOrder(Actor self); + Order IssueDeployOrder(Actor self, bool queued); bool CanIssueDeployOrder(Actor self); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs index 8006d4e8df..35bf4bec7b 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs @@ -162,7 +162,8 @@ namespace OpenRA.Mods.Common.Widgets if (highlightOnButtonPress) deployHighlighted = 2; - PerformDeployOrderOnSelection(); + var queued = Game.GetModifierKeys().HasModifier(Modifiers.Shift); + PerformDeployOrderOnSelection(queued); }; deployButton.OnKeyPress = ki => { deployHighlighted = 2; deployButton.OnClick(); }; @@ -207,14 +208,30 @@ namespace OpenRA.Mods.Common.Widgets { keyOverrides.AddHandler(e => { - // HACK: enable attack move to be triggered if the ctrl key is pressed - e.Modifiers &= ~Modifiers.Ctrl; - if (!attackMoveDisabled && attackMoveButton.Key.IsActivatedBy(e)) + // HACK: allow attack move to be triggered if the ctrl key is pressed (assault move) + var eNoCtrl = e; + eNoCtrl.Modifiers &= ~Modifiers.Ctrl; + + if (attackMoveButton != null && !attackMoveDisabled && attackMoveButton.Key.IsActivatedBy(eNoCtrl)) { attackMoveButton.OnKeyPress(e); 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; }); } @@ -302,13 +319,13 @@ namespace OpenRA.Mods.Common.Widgets world.PlayVoiceForOrders(orders); } - void PerformDeployOrderOnSelection() + void PerformDeployOrderOnSelection(bool queued) { UpdateStateIfNecessary(); var orders = selectedDeploys .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) .ToArray();