From fb47c3ac9e69abf55bb565d8804ad74b5004a242 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 11 Jul 2016 18:06:26 +0200 Subject: [PATCH 1/3] Fix the attack-move cursor appearing for units which can't attack-move --- OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs index 720e146f4e..a82c25d904 100644 --- a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Widgets bool PerformAttackMove() { var actors = world.Selection.Actors - .Where(a => a.Owner == world.LocalPlayer) + .Where(a => a.Owner == world.LocalPlayer && a.Info.HasTraitInfo()) .ToArray(); if (actors.Any()) From 756dc7c1271c7897ce2c8baee1d79d0769551cc0 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 12 Jul 2016 19:08:31 +0200 Subject: [PATCH 2/3] Disable the attack-move and guard cursor for units which can't auto-target --- OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs index a82c25d904..a4442aed3c 100644 --- a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Widgets bool PerformAttackMove() { var actors = world.Selection.Actors - .Where(a => a.Owner == world.LocalPlayer && a.Info.HasTraitInfo()) + .Where(a => a.Owner == world.LocalPlayer && a.Info.HasTraitInfo() && a.Info.HasTraitInfo()) .ToArray(); if (actors.Any()) @@ -183,7 +183,7 @@ namespace OpenRA.Mods.Common.Widgets bool PerformGuard() { var actors = world.Selection.Actors - .Where(a => !a.Disposed && a.Owner == world.LocalPlayer && a.Info.HasTraitInfo()); + .Where(a => !a.Disposed && a.Owner == world.LocalPlayer && a.Info.HasTraitInfo() && a.Info.HasTraitInfo()); if (actors.Any()) world.OrderGenerator = new GuardOrderGenerator(actors, From ba9fff3c6d50b50e9cc22e32cb4c0f9c99c17353 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 12 Jul 2016 19:15:04 +0200 Subject: [PATCH 3/3] Move the checks into the Any to prevent units in a group from doing nothing --- OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs index a4442aed3c..5be929c83a 100644 --- a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs @@ -100,10 +100,10 @@ namespace OpenRA.Mods.Common.Widgets bool PerformAttackMove() { var actors = world.Selection.Actors - .Where(a => a.Owner == world.LocalPlayer && a.Info.HasTraitInfo() && a.Info.HasTraitInfo()) + .Where(a => a.Owner == world.LocalPlayer) .ToArray(); - if (actors.Any()) + if (actors.Any(a => a.Info.HasTraitInfo() && a.Info.HasTraitInfo())) world.OrderGenerator = new GenericSelectTarget(actors, "AttackMove", "attackmove", Game.Settings.Game.MouseButtonPreference.Action); @@ -183,9 +183,9 @@ namespace OpenRA.Mods.Common.Widgets bool PerformGuard() { var actors = world.Selection.Actors - .Where(a => !a.Disposed && a.Owner == world.LocalPlayer && a.Info.HasTraitInfo() && a.Info.HasTraitInfo()); + .Where(a => !a.Disposed && a.Owner == world.LocalPlayer); - if (actors.Any()) + if (actors.Any(a => a.Info.HasTraitInfo() && a.Info.HasTraitInfo())) world.OrderGenerator = new GuardOrderGenerator(actors, "Guard", "guard", Game.Settings.Game.MouseButtonPreference.Action);