From 6e9b5ed2c997c88441a851a99d36442c8f474d59 Mon Sep 17 00:00:00 2001 From: Pavel Penev Date: Tue, 11 Aug 2015 03:27:12 +0300 Subject: [PATCH] Rename ProductionQueueInfo.Race to Factions Also add an upgrade rule. --- OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs | 8 ++++---- OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs | 10 ++++++++++ mods/cnc/rules/structures.yaml | 12 ++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index b688cabee2..23f52f2184 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -27,8 +27,8 @@ namespace OpenRA.Mods.Common.Traits [Desc("Group queues from separate buildings together into the same tab.")] public readonly string Group = null; - [Desc("Only enable this queue for certain factions")] - public readonly string[] Race = { }; + [Desc("Only enable this queue for certain factions.")] + public readonly string[] Factions = { }; [Desc("Should the prerequisite remain enabled if the owner changes?")] public readonly bool Sticky = true; @@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits developerMode = playerActor.Trait(); Race = init.Contains() ? init.Get() : self.Owner.Faction.InternalName; - Enabled = !info.Race.Any() || info.Race.Contains(Race); + Enabled = !info.Factions.Any() || info.Factions.Contains(Race); CacheProduceables(playerActor); } @@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits if (!Info.Sticky) { Race = self.Owner.Faction.InternalName; - Enabled = !Info.Race.Any() || Info.Race.Contains(Race); + Enabled = !Info.Factions.Any() || Info.Factions.Contains(Race); } // Regenerate the produceables and tech tree state diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index 249c854709..1acce27b00 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -1736,6 +1736,16 @@ namespace OpenRA.Mods.Common.UtilityCommands node.Key = "Offset"; } + if (engineVersion < 20150811) + { + if (node.Key.StartsWith("ProductionQueue")) + { + var race = node.Value.Nodes.FirstOrDefault(x => x.Key == "Race"); + if (race != null) + race.Key = "Factions"; + } + } + UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); } } diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 21753d330a..4d92ad6cc0 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -23,7 +23,7 @@ FACT: Facing: 108 ProductionQueue@GDIBuilding: Type: Building.GDI - Race: gdi + Factions: gdi Group: Building BuildSpeed: .4 LowPowerSlowdown: 2 @@ -31,7 +31,7 @@ FACT: ReadyAudio: ConstructionComplete ProductionQueue@NodBuilding: Type: Building.Nod - Race: nod + Factions: nod Group: Building BuildSpeed: .4 LowPowerSlowdown: 2 @@ -39,7 +39,7 @@ FACT: ReadyAudio: ConstructionComplete ProductionQueue@GDIDefense: Type: Defence.GDI - Race: gdi + Factions: gdi Group: Defence BuildSpeed: .4 LowPowerSlowdown: 3 @@ -47,7 +47,7 @@ FACT: ReadyAudio: ConstructionComplete ProductionQueue@NodDefense: Type: Defence.Nod - Race: nod + Factions: nod Group: Defence BuildSpeed: .4 LowPowerSlowdown: 3 @@ -420,13 +420,13 @@ HPAD: RallyPoint: ProductionQueue@GDI: Type: Aircraft.GDI - Race: gdi + Factions: gdi Group: Aircraft BuildSpeed: .4 LowPowerSlowdown: 3 ProductionQueue@Nod: Type: Aircraft.Nod - Race: nod + Factions: nod Group: Aircraft BuildSpeed: .4 LowPowerSlowdown: 3