diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index 843dcda366..9b87cd17d6 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -142,20 +142,8 @@ namespace OpenRA.Widgets handled = (t.KeyPressed(world.WorldActor, e)) ? true : handled; if (handled) return true; - - if (e.KeyChar == 'a') - { - StartAttackMoveOrder(); - return true; - } } return false; - } - - public void StartAttackMoveOrder() - { - if (world.Selection.Actors.Count() > 0) - world.OrderGenerator = new GenericSelectTarget(world.Selection.Actors, "AttackMove", "attackmove"); } IEnumerable SelectActorsInBox(World world, float2 a, float2 b) diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 07f2d1c8bd..eae4fa3fbd 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -289,6 +289,7 @@ + diff --git a/OpenRA.Mods.RA/World/AttackMoveInteraction.cs b/OpenRA.Mods.RA/World/AttackMoveInteraction.cs new file mode 100644 index 0000000000..788619dd9f --- /dev/null +++ b/OpenRA.Mods.RA/World/AttackMoveInteraction.cs @@ -0,0 +1,33 @@ +using System.Linq; +using OpenRA.Orders; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + public class AttackMoveInteractionInfo : TraitInfo + { + + } + + public class AttackMoveInteraction : INotifyKeyPress + { + public bool KeyPressed(Actor self, KeyInput e) + { + if (self.World.LocalPlayer == null) return false; + + if (e.KeyChar == 'a') + { + StartAttackMoveOrder(self.World); + return true; + } + + return false; + } + + public static void StartAttackMoveOrder(World world) + { + if (world.Selection.Actors.Count() > 0) + world.OrderGenerator = new GenericSelectTarget(world.Selection.Actors, "AttackMove", "attackmove"); + } + } +} diff --git a/mods/cnc/rules/system.yaml b/mods/cnc/rules/system.yaml index da55c0265f..611c76f418 100644 --- a/mods/cnc/rules/system.yaml +++ b/mods/cnc/rules/system.yaml @@ -184,6 +184,7 @@ World: PathFinder: ValidateOrder: GotoNextBase: + AttackMoveInteraction: CRATE: Tooltip: diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index c18c7f609e..29a745a6b7 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -228,6 +228,7 @@ World: EndMessage: The game will end in {0} seconds. ValidateOrder: GotoNextBase: + AttackMoveInteraction: MINP: Mine: