diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
index 7d26d0e8e9..9f86250d9f 100644
--- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
+++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
@@ -71,7 +71,6 @@
-
diff --git a/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs b/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs
deleted file mode 100644
index aa4cdd1279..0000000000
--- a/OpenRA.Mods.Cnc/ProductionQueueFromSelection.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-#region Copyright & License Information
-/*
- * Copyright 2007-2011 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. For more information,
- * see COPYING.
- */
-#endregion
-
-using System;
-using System.Linq;
-using OpenRA.Mods.RA;
-using OpenRA.Mods.RA.Widgets;
-using OpenRA.Traits;
-using OpenRA.Widgets;
-
-namespace OpenRA.Mods.Cnc.Widgets
-{
- class ProductionQueueFromSelectionInfo : ITraitInfo
- {
- public string ProductionTabsWidget = null;
-
- public object Create(ActorInitializer init) { return new ProductionQueueFromSelection(init.world, this); }
- }
-
- class ProductionQueueFromSelection : INotifySelection
- {
- readonly World world;
- Lazy tabsWidget;
-
- public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info)
- {
- this.world = world;
-
- tabsWidget = Exts.Lazy(() =>
- Ui.Root.Get(info.ProductionTabsWidget));
- }
-
- public void SelectionChanged()
- {
- // Find an actor with a queue
- var producer = world.Selection.Actors.FirstOrDefault(a => a.IsInWorld
- && a.World.LocalPlayer == a.Owner
- && a.TraitsImplementing().Any(q => q.Enabled));
-
- if (producer != null)
- tabsWidget.Value.CurrentQueue = producer.TraitsImplementing().First(q => q.Enabled);
- }
- }
-}
diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
index 34b5bdb132..1af418c00c 100644
--- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
+++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj
@@ -546,6 +546,8 @@
+
+
diff --git a/OpenRA.Mods.RA/ProductionQueueFromSelection.cs b/OpenRA.Mods.RA/ProductionQueueFromSelection.cs
new file mode 100644
index 0000000000..6b7f2e70f4
--- /dev/null
+++ b/OpenRA.Mods.RA/ProductionQueueFromSelection.cs
@@ -0,0 +1,73 @@
+#region Copyright & License Information
+/*
+ * Copyright 2007-2011 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. For more information,
+ * see COPYING.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using OpenRA.Mods.RA.Widgets;
+using OpenRA.Traits;
+using OpenRA.Widgets;
+
+namespace OpenRA.Mods.RA
+{
+ class ProductionQueueFromSelectionInfo : ITraitInfo
+ {
+ public string ProductionTabsWidget = null;
+ public string ProductionPaletteWidget = null;
+
+ public object Create(ActorInitializer init) { return new ProductionQueueFromSelection(init.world, this); }
+ }
+
+ class ProductionQueueFromSelection : INotifySelection
+ {
+ readonly World world;
+ readonly Lazy tabsWidget;
+ readonly Lazy paletteWidget;
+
+ public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info)
+ {
+ this.world = world;
+
+ tabsWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionTabsWidget) as ProductionTabsWidget);
+ paletteWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionPaletteWidget) as ProductionPaletteWidget);
+ }
+
+ public void SelectionChanged()
+ {
+ // Disable for spectators
+ if (world.LocalPlayer == null)
+ return;
+
+ // Queue-per-actor
+ var queue = world.Selection.Actors
+ .Where(a => a.IsInWorld && a.World.LocalPlayer == a.Owner)
+ .SelectMany(a => a.TraitsImplementing())
+ .FirstOrDefault(q => q.Enabled);
+
+ // Queue-per-player
+ if (queue == null)
+ {
+ var types = world.Selection.Actors.Where(a => a.IsInWorld && a.World.LocalPlayer == a.Owner)
+ .SelectMany(a => a.TraitsImplementing())
+ .SelectMany(t => t.Info.Produces);
+
+ queue = world.LocalPlayer.PlayerActor.TraitsImplementing()
+ .FirstOrDefault(q => q.Enabled && types.Contains(q.Info.Type));
+ }
+
+ if (queue == null)
+ return;
+
+ if (tabsWidget.Value != null)
+ tabsWidget.Value.CurrentQueue = queue;
+ else if (paletteWidget.Value != null)
+ paletteWidget.Value.CurrentQueue = queue;
+ }
+ }
+}