Rename Faction trait members
Rename Faction.Race to Faction.InternalName
This commit is contained in:
@@ -114,11 +114,11 @@ namespace OpenRA
|
||||
IsHuman = !runtimePlayer.IsBot,
|
||||
IsBot = runtimePlayer.IsBot,
|
||||
FactionName = runtimePlayer.Country.Name,
|
||||
FactionId = runtimePlayer.Country.Race,
|
||||
FactionId = runtimePlayer.Country.InternalName,
|
||||
Color = runtimePlayer.Color,
|
||||
Team = client.Team,
|
||||
SpawnPoint = runtimePlayer.SpawnPoint,
|
||||
IsRandomFaction = runtimePlayer.Country.Race != client.Race,
|
||||
IsRandomFaction = runtimePlayer.Country.InternalName != client.Race,
|
||||
IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA
|
||||
public MapPlayers(Ruleset rules, int playerCount)
|
||||
{
|
||||
var firstRace = rules.Actors["world"].Traits
|
||||
.WithInterface<FactionInfo>().First(f => f.Selectable).Race;
|
||||
.WithInterface<FactionInfo>().First(f => f.Selectable).InternalName;
|
||||
|
||||
Players = new Dictionary<string, PlayerReference>
|
||||
{
|
||||
|
||||
@@ -57,14 +57,14 @@ namespace OpenRA
|
||||
.WithInterface<FactionInfo>().Where(f => !requireSelectable || f.Selectable)
|
||||
.ToList();
|
||||
|
||||
var selected = selectableCountries.FirstOrDefault(f => f.Race == name)
|
||||
var selected = selectableCountries.FirstOrDefault(f => f.InternalName == name)
|
||||
?? selectableCountries.Random(world.SharedRandom);
|
||||
|
||||
// Don't loop infinite
|
||||
for (var i = 0; i <= 10 && selected.RandomRaceMembers.Any(); i++)
|
||||
for (var i = 0; i <= 10 && selected.RandomFactionMembers.Any(); i++)
|
||||
{
|
||||
var race = selected.RandomRaceMembers.Random(world.SharedRandom);
|
||||
selected = selectableCountries.FirstOrDefault(f => f.Race == race);
|
||||
var race = selected.RandomFactionMembers.Random(world.SharedRandom);
|
||||
selected = selectableCountries.FirstOrDefault(f => f.InternalName == race);
|
||||
|
||||
if (selected == null)
|
||||
throw new YamlException("Unknown race: {0}".F(race));
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA
|
||||
var countries = world.Map.Rules.Actors["world"].Traits
|
||||
.WithInterface<FactionInfo>().ToArray();
|
||||
|
||||
return countries.FirstOrDefault(f => f.Race == race) ?? countries.First();
|
||||
return countries.FirstOrDefault(f => f.InternalName == race) ?? countries.First();
|
||||
}
|
||||
|
||||
public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
this.info = info;
|
||||
var self = init.Self;
|
||||
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
|
||||
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.InternalName;
|
||||
|
||||
quantizedFacings = Exts.Lazy(() =>
|
||||
{
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
if (Resources > 0.8 * ResourceCapacity)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, owner, "Speech", "SilosNeeded", owner.Country.Race);
|
||||
Sound.PlayNotification(self.World.Map.Rules, owner, "Speech", "SilosNeeded", owner.Country.InternalName);
|
||||
AlertSilo = true;
|
||||
}
|
||||
else
|
||||
@@ -187,14 +187,14 @@ namespace OpenRA.Traits
|
||||
public void PlayCashTickUp(Actor self)
|
||||
{
|
||||
if (Game.Settings.Sound.CashTicks)
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "CashTickUp", self.Owner.Country.Race);
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "CashTickUp", self.Owner.Country.InternalName);
|
||||
}
|
||||
|
||||
public void PlayCashTickDown(Actor self)
|
||||
{
|
||||
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0)
|
||||
{
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "CashTickDown", self.Owner.Country.Race);
|
||||
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "CashTickDown", self.Owner.Country.InternalName);
|
||||
nextCashTickTime = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace OpenRA.Traits
|
||||
public readonly string Name = null;
|
||||
|
||||
[Desc("This is the internal name for owner checks.")]
|
||||
public readonly string Race = null;
|
||||
public readonly string InternalName = null;
|
||||
|
||||
[Desc("Pick a random race as the player's race out of this list.")]
|
||||
public readonly string[] RandomRaceMembers = { };
|
||||
[Desc("Pick a random faction as the player's facton out of this list.")]
|
||||
public readonly string[] RandomFactionMembers = { };
|
||||
|
||||
[Desc("The side that the country belongs to. For example, England belongs to the 'Allies' side.")]
|
||||
[Desc("The side that the faction belongs to. For example, England belongs to the 'Allies' side.")]
|
||||
public readonly string Side = null;
|
||||
|
||||
[Translate]
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA
|
||||
if (string.IsNullOrEmpty(voiced.VoiceSet))
|
||||
return;
|
||||
|
||||
voiced.PlayVoice(self, phrase, self.Owner.Country.Race);
|
||||
voiced.PlayVoice(self, phrase, self.Owner.Country.InternalName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA
|
||||
if (string.IsNullOrEmpty(voiced.VoiceSet))
|
||||
return;
|
||||
|
||||
voiced.PlayVoiceLocal(self, phrase, self.Owner.Country.Race, volume);
|
||||
voiced.PlayVoiceLocal(self, phrase, self.Owner.Country.InternalName, volume);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRA
|
||||
foreach (var v in orderSubject.TraitsImplementing<IOrderVoice>())
|
||||
{
|
||||
if (voice.PlayVoice(orderSubject, v.VoicePhraseForOrder(orderSubject, o),
|
||||
orderSubject.Owner.Country.Race))
|
||||
orderSubject.Owner.Country.InternalName))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
public static Sprite GetChromeImage(World world, string name)
|
||||
{
|
||||
return ChromeProvider.GetImage("chrome-" + world.LocalPlayer.Country.Race, name);
|
||||
return ChromeProvider.GetImage("chrome-" + world.LocalPlayer.Country.InternalName, name);
|
||||
}
|
||||
|
||||
public static void DrawRGBA(Sprite s, float2 pos)
|
||||
|
||||
Reference in New Issue
Block a user