Rename EmitInfantryOnSellInfo.Races to Factions
Also rename the rest of "race" in that file.
This commit is contained in:
@@ -24,9 +24,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Be sure to use lowercase. Default value is \"e1\".")]
|
[Desc("Be sure to use lowercase. Default value is \"e1\".")]
|
||||||
public readonly string[] ActorTypes = { "e1" };
|
public readonly string[] ActorTypes = { "e1" };
|
||||||
|
|
||||||
[Desc("Spawns actors only if the selling player's race is in this list." +
|
[Desc("Spawns actors only if the selling player's faction is in this list." +
|
||||||
"Leave empty to allow all races by default.")]
|
"Leave empty to allow all factions by default.")]
|
||||||
public readonly string[] Races = { };
|
public readonly string[] Factions = { };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new EmitInfantryOnSell(init.Self, this); }
|
public object Create(ActorInitializer init) { return new EmitInfantryOnSell(init.Self, this); }
|
||||||
}
|
}
|
||||||
@@ -34,20 +34,20 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public class EmitInfantryOnSell : INotifySold
|
public class EmitInfantryOnSell : INotifySold
|
||||||
{
|
{
|
||||||
readonly EmitInfantryOnSellInfo info;
|
readonly EmitInfantryOnSellInfo info;
|
||||||
readonly bool correctRace = false;
|
readonly bool correctFaction;
|
||||||
|
|
||||||
public EmitInfantryOnSell(Actor self, EmitInfantryOnSellInfo info)
|
public EmitInfantryOnSell(Actor self, EmitInfantryOnSellInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
var raceList = info.Races;
|
var factionsList = info.Factions;
|
||||||
correctRace = raceList.Length == 0 || raceList.Contains(self.Owner.Faction.InternalName);
|
correctFaction = factionsList.Length == 0 || factionsList.Contains(self.Owner.Faction.InternalName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Selling(Actor self) { }
|
public void Selling(Actor self) { }
|
||||||
|
|
||||||
void Emit(Actor self)
|
void Emit(Actor self)
|
||||||
{
|
{
|
||||||
if (!correctRace)
|
if (!correctFaction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
var csv = self.Info.Traits.GetOrDefault<CustomSellValueInfo>();
|
||||||
|
|||||||
@@ -1744,6 +1744,13 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
if (race != null)
|
if (race != null)
|
||||||
race.Key = "Factions";
|
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);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
|
|||||||
@@ -88,10 +88,10 @@
|
|||||||
UseDeathTypeSuffix: false
|
UseDeathTypeSuffix: false
|
||||||
EmitInfantryOnSell@gdi:
|
EmitInfantryOnSell@gdi:
|
||||||
ActorTypes: e1, e1, e2, medic
|
ActorTypes: e1, e1, e2, medic
|
||||||
Races: gdi
|
Factions: gdi
|
||||||
EmitInfantryOnSell@nod:
|
EmitInfantryOnSell@nod:
|
||||||
ActorTypes: e1, e1, e1, e3, e3
|
ActorTypes: e1, e1, e1, e3, e3
|
||||||
Races: nod
|
Factions: nod
|
||||||
MustBeDestroyed:
|
MustBeDestroyed:
|
||||||
RequiredForShortGame: true
|
RequiredForShortGame: true
|
||||||
CaptureNotification:
|
CaptureNotification:
|
||||||
|
|||||||
Reference in New Issue
Block a user