Rename ProductionQueueInfo.Race to Factions

Also add an upgrade rule.
This commit is contained in:
Pavel Penev
2015-08-11 03:27:12 +03:00
parent 923c5405d2
commit 6e9b5ed2c9
3 changed files with 20 additions and 10 deletions

View File

@@ -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<DeveloperMode>();
Race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : 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

View File

@@ -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);
}
}

View File

@@ -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