diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
index 30abca38f1..eab2a6ecd5 100644
--- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
+++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
@@ -291,6 +291,7 @@
+
diff --git a/OpenRA.Mods.Common/Traits/CommandBarBlacklist.cs b/OpenRA.Mods.Common/Traits/CommandBarBlacklist.cs
new file mode 100644
index 0000000000..04b8b81eef
--- /dev/null
+++ b/OpenRA.Mods.Common/Traits/CommandBarBlacklist.cs
@@ -0,0 +1,27 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2017 The OpenRA Developers (see AUTHORS)
+ * This file is part of OpenRA, which is free software. It is made
+ * available to you under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version. For more
+ * information, see COPYING.
+ */
+#endregion
+
+using OpenRA.Traits;
+
+namespace OpenRA.Mods.Common.Traits
+{
+ [Desc("Blacklist certain order types to disable on the command bar when this unit is selected.")]
+ public class CommandBarBlacklistInfo : TraitInfo
+ {
+ [Desc("Disable the 'Stop' button for this actor.")]
+ public readonly bool DisableStop = true;
+
+ [Desc("Disable the 'Waypoint Mode' button for this actor.")]
+ public readonly bool DisableWaypointMode = true;
+ }
+
+ public class CommandBarBlacklist { }
+}
diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs
index 6e87a20844..5df118e579 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/CommandBarLogic.cs
@@ -33,6 +33,8 @@ namespace OpenRA.Mods.Common.Widgets
bool forceAttackDisabled = true;
bool guardDisabled = true;
bool scatterDisabled = true;
+ bool stopDisabled = true;
+ bool waypointModeDisabled = true;
int deployHighlighted;
int scatterHighlighted;
@@ -148,7 +150,7 @@ namespace OpenRA.Mods.Common.Widgets
BindButtonIcon(stopButton);
stopButton.GetKey = _ => ks.StopKey;
- stopButton.IsDisabled = () => { UpdateStateIfNecessary(); return !selectedActors.Any(); };
+ stopButton.IsDisabled = () => { UpdateStateIfNecessary(); return stopDisabled; };
stopButton.IsHighlighted = () => stopHighlighted > 0;
stopButton.OnClick = () => PerformKeyboardOrderOnSelection(a => new Order("Stop", a, false));
stopButton.OnKeyPress = ki => { stopHighlighted = 2; stopButton.OnClick(); };
@@ -159,7 +161,7 @@ namespace OpenRA.Mods.Common.Widgets
{
BindButtonIcon(queueOrdersButton);
- queueOrdersButton.IsDisabled = () => { UpdateStateIfNecessary(); return !selectedActors.Any(); };
+ queueOrdersButton.IsDisabled = () => { UpdateStateIfNecessary(); return waypointModeDisabled; };
queueOrdersButton.IsHighlighted = () => !queueOrdersButton.IsDisabled() && IsForceModifiersActive(Modifiers.Shift);
queueOrdersButton.OnClick = () =>
{
@@ -224,6 +226,10 @@ namespace OpenRA.Mods.Common.Widgets
.Select(d => new TraitPair(a, d)))
.ToArray();
+ var cbbInfos = selectedActors.Select(a => a.Info.TraitInfoOrDefault()).ToArray();
+ stopDisabled = !cbbInfos.Any(i => i == null || !i.DisableStop);
+ waypointModeDisabled = !cbbInfos.Any(i => i == null || !i.DisableWaypointMode);
+
selectionHash = world.Selection.Hash;
}
diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml
index f249ad2059..85b781e1e1 100644
--- a/mods/cnc/rules/defaults.yaml
+++ b/mods/cnc/rules/defaults.yaml
@@ -669,6 +669,7 @@
Demolishable:
EditorTilesetFilter:
Categories: Building
+ CommandBarBlacklist:
^BaseBuilding:
Inherits: ^Building
@@ -1000,6 +1001,7 @@
TargetTypes: Ground, C4, Structure, Defense
EditorTilesetFilter:
Categories: Defense
+ -CommandBarBlacklist:
^DisabledOverlay:
WithColoredOverlay@IDISABLE:
diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml
index e7f8efca15..de50abb5e2 100644
--- a/mods/d2k/rules/defaults.yaml
+++ b/mods/d2k/rules/defaults.yaml
@@ -424,6 +424,7 @@
Radius: 4c768
EditorTilesetFilter:
Categories: Building
+ CommandBarBlacklist:
^Defense:
Inherits: ^Building
@@ -450,6 +451,7 @@
TargetTypes: Ground, C4, Structure, Defense
EditorTilesetFilter:
Categories: Defense
+ -CommandBarBlacklist:
^DisabledOverlay:
WithColoredOverlay@IDISABLE:
diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml
index ba720c419a..7adc1a73e4 100644
--- a/mods/ra/rules/defaults.yaml
+++ b/mods/ra/rules/defaults.yaml
@@ -592,6 +592,7 @@
Demolishable:
EditorTilesetFilter:
Categories: Building
+ CommandBarBlacklist:
^Building:
Inherits: ^BasicBuilding
@@ -634,6 +635,7 @@
EmptyWeapon: SmallBuildingExplode
EditorTilesetFilter:
Categories: Defense
+ -CommandBarBlacklist:
^Wall:
Inherits@1: ^ExistsInWorld