Rename EmitInfantryOnSellInfo.Races to Factions

Also rename the rest of "race" in that file.
This commit is contained in:
Pavel Penev
2015-08-11 03:46:12 +03:00
parent 8b58f3a1d8
commit fd01e95d6c
3 changed files with 16 additions and 9 deletions

View File

@@ -24,9 +24,9 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Be sure to use lowercase. Default value is \"e1\".")]
public readonly string[] ActorTypes = { "e1" };
[Desc("Spawns actors only if the selling player's race is in this list." +
"Leave empty to allow all races by default.")]
public readonly string[] Races = { };
[Desc("Spawns actors only if the selling player's faction is in this list." +
"Leave empty to allow all factions by default.")]
public readonly string[] Factions = { };
public object Create(ActorInitializer init) { return new EmitInfantryOnSell(init.Self, this); }
}
@@ -34,20 +34,20 @@ namespace OpenRA.Mods.Common.Traits
public class EmitInfantryOnSell : INotifySold
{
readonly EmitInfantryOnSellInfo info;
readonly bool correctRace = false;
readonly bool correctFaction;
public EmitInfantryOnSell(Actor self, EmitInfantryOnSellInfo info)
{
this.info = info;
var raceList = info.Races;
correctRace = raceList.Length == 0 || raceList.Contains(self.Owner.Faction.InternalName);
var factionsList = info.Factions;
correctFaction = factionsList.Length == 0 || factionsList.Contains(self.Owner.Faction.InternalName);
}
public void Selling(Actor self) { }
void Emit(Actor self)
{
if (!correctRace)
if (!correctFaction)
return;
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();

View File

@@ -1744,6 +1744,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (race != null)
race.Key = "Factions";
}
if (node.Key.StartsWith("EmitInfantryOnSell"))
{
var race = node.Value.Nodes.FirstOrDefault(x => x.Key == "Races");
if (race != null)
race.Key = "Factions";
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);

View File

@@ -88,10 +88,10 @@
UseDeathTypeSuffix: false
EmitInfantryOnSell@gdi:
ActorTypes: e1, e1, e2, medic
Races: gdi
Factions: gdi
EmitInfantryOnSell@nod:
ActorTypes: e1, e1, e1, e3, e3
Races: nod
Factions: nod
MustBeDestroyed:
RequiredForShortGame: true
CaptureNotification: