Merge pull request #8661 from penev92/bleed_renameCountry

Rename the Country trait to Faction
This commit is contained in:
Oliver Brakmann
2015-07-14 21:05:52 +02:00
59 changed files with 187 additions and 168 deletions

View File

@@ -114,11 +114,11 @@ namespace OpenRA
IsHuman = !runtimePlayer.IsBot, IsHuman = !runtimePlayer.IsBot,
IsBot = runtimePlayer.IsBot, IsBot = runtimePlayer.IsBot,
FactionName = runtimePlayer.Country.Name, FactionName = runtimePlayer.Country.Name,
FactionId = runtimePlayer.Country.Race, FactionId = runtimePlayer.Country.InternalName,
Color = runtimePlayer.Color, Color = runtimePlayer.Color,
Team = client.Team, Team = client.Team,
SpawnPoint = runtimePlayer.SpawnPoint, SpawnPoint = runtimePlayer.SpawnPoint,
IsRandomFaction = runtimePlayer.Country.Race != client.Race, IsRandomFaction = runtimePlayer.Country.InternalName != client.Race,
IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint
}; };

View File

@@ -29,7 +29,7 @@ namespace OpenRA
public MapPlayers(Ruleset rules, int playerCount) public MapPlayers(Ruleset rules, int playerCount)
{ {
var firstRace = rules.Actors["world"].Traits var firstRace = rules.Actors["world"].Traits
.WithInterface<CountryInfo>().First(c => c.Selectable).Race; .WithInterface<FactionInfo>().First(f => f.Selectable).InternalName;
Players = new Dictionary<string, PlayerReference> Players = new Dictionary<string, PlayerReference>
{ {

View File

@@ -181,8 +181,8 @@
<Compile Include="Traits\TraitsInterfaces.cs" /> <Compile Include="Traits\TraitsInterfaces.cs" />
<Compile Include="Traits\Util.cs" /> <Compile Include="Traits\Util.cs" />
<Compile Include="Traits\ValidateOrder.cs" /> <Compile Include="Traits\ValidateOrder.cs" />
<Compile Include="Traits\World\Country.cs" />
<Compile Include="Traits\World\MusicPlaylist.cs" /> <Compile Include="Traits\World\MusicPlaylist.cs" />
<Compile Include="Traits\World\Faction.cs" />
<Compile Include="Traits\World\ResourceType.cs" /> <Compile Include="Traits\World\ResourceType.cs" />
<Compile Include="Traits\World\ScreenShaker.cs" /> <Compile Include="Traits\World\ScreenShaker.cs" />
<Compile Include="Traits\World\Shroud.cs" /> <Compile Include="Traits\World\Shroud.cs" />

View File

@@ -31,14 +31,14 @@ namespace OpenRA
public readonly string PlayerName; public readonly string PlayerName;
public readonly string InternalName; public readonly string InternalName;
public readonly CountryInfo Country; public readonly FactionInfo Country;
public readonly bool NonCombatant = false; public readonly bool NonCombatant = false;
public readonly bool Playable = true; public readonly bool Playable = true;
public readonly int ClientIndex; public readonly int ClientIndex;
public readonly PlayerReference PlayerReference; public readonly PlayerReference PlayerReference;
// The country (including Random, etc) that was selected in the lobby // The country (including Random, etc) that was selected in the lobby
public readonly CountryInfo DisplayCountry; public readonly FactionInfo DisplayCountry;
public WinState WinState = WinState.Undefined; public WinState WinState = WinState.Undefined;
public bool IsBot; public bool IsBot;
@@ -51,20 +51,20 @@ namespace OpenRA
readonly IFogVisibilityModifier[] fogVisibilities; readonly IFogVisibilityModifier[] fogVisibilities;
CountryInfo ChooseCountry(World world, string name, bool requireSelectable = true) FactionInfo ChooseCountry(World world, string name, bool requireSelectable = true)
{ {
var selectableCountries = world.Map.Rules.Actors["world"].Traits var selectableCountries = world.Map.Rules.Actors["world"].Traits
.WithInterface<CountryInfo>().Where(c => !requireSelectable || c.Selectable) .WithInterface<FactionInfo>().Where(f => !requireSelectable || f.Selectable)
.ToList(); .ToList();
var selected = selectableCountries.FirstOrDefault(c => c.Race == name) var selected = selectableCountries.FirstOrDefault(f => f.InternalName == name)
?? selectableCountries.Random(world.SharedRandom); ?? selectableCountries.Random(world.SharedRandom);
// Don't loop infinite // 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); var race = selected.RandomFactionMembers.Random(world.SharedRandom);
selected = selectableCountries.FirstOrDefault(c => c.Race == race); selected = selectableCountries.FirstOrDefault(f => f.InternalName == race);
if (selected == null) if (selected == null)
throw new YamlException("Unknown race: {0}".F(race)); throw new YamlException("Unknown race: {0}".F(race));
@@ -73,12 +73,12 @@ namespace OpenRA
return selected; return selected;
} }
CountryInfo ChooseDisplayCountry(World world, string race) FactionInfo ChooseDisplayCountry(World world, string race)
{ {
var countries = world.Map.Rules.Actors["world"].Traits var countries = world.Map.Rules.Actors["world"].Traits
.WithInterface<CountryInfo>(); .WithInterface<FactionInfo>().ToArray();
return countries.FirstOrDefault(c => c.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) public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr)

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Traits
{ {
this.info = info; this.info = info;
var self = init.Self; 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(() => quantizedFacings = Exts.Lazy(() =>
{ {

View File

@@ -145,7 +145,7 @@ namespace OpenRA.Traits
{ {
if (Resources > 0.8 * ResourceCapacity) 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; AlertSilo = true;
} }
else else
@@ -187,14 +187,14 @@ namespace OpenRA.Traits
public void PlayCashTickUp(Actor self) public void PlayCashTickUp(Actor self)
{ {
if (Game.Settings.Sound.CashTicks) 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) public void PlayCashTickDown(Actor self)
{ {
if (Game.Settings.Sound.CashTicks && nextCashTickTime == 0) 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; nextCashTickTime = 2;
} }
} }

View File

@@ -11,18 +11,18 @@
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
[Desc("Attach this to the `World` actor.")] [Desc("Attach this to the `World` actor.")]
public class CountryInfo : TraitInfo<Country> public class FactionInfo : TraitInfo<Faction>
{ {
[Desc("This is the name exposed to the players.")] [Desc("This is the name exposed to the players.")]
public readonly string Name = null; public readonly string Name = null;
[Desc("This is the internal name for owner checks.")] [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.")] [Desc("Pick a random faction as the player's facton out of this list.")]
public readonly string[] RandomRaceMembers = { }; 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; public readonly string Side = null;
[Translate] [Translate]
@@ -31,5 +31,5 @@ namespace OpenRA.Traits
public readonly bool Selectable = true; public readonly bool Selectable = true;
} }
public class Country { /* we're only interested in the Info */ } public class Faction { /* we're only interested in the Info */ }
} }

View File

@@ -27,7 +27,7 @@ namespace OpenRA
if (string.IsNullOrEmpty(voiced.VoiceSet)) if (string.IsNullOrEmpty(voiced.VoiceSet))
return; 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)) if (string.IsNullOrEmpty(voiced.VoiceSet))
return; 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>()) foreach (var v in orderSubject.TraitsImplementing<IOrderVoice>())
{ {
if (voice.PlayVoice(orderSubject, v.VoicePhraseForOrder(orderSubject, o), if (voice.PlayVoice(orderSubject, v.VoicePhraseForOrder(orderSubject, o),
orderSubject.Owner.Country.Race)) orderSubject.Owner.Country.InternalName))
return; return;
} }
} }

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Widgets
{ {
public static Sprite GetChromeImage(World world, string name) 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) public static void DrawRGBA(Sprite s, float2 pos)

View File

@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Cnc.Traits
cargo.Delivered(self); cargo.Delivered(self);
self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, raceVariant)); self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, raceVariant));
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Country.InternalName);
})); }));
actor.QueueActivity(new Fly(actor, Target.FromCell(w, endPos))); actor.QueueActivity(new Fly(actor, Target.FromCell(w, endPos)));

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
if (health.DamageState == DamageState.Undamaged) if (health.DamageState == DamageState.Undamaged)
{ {
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.FinishRepairingNotification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.FinishRepairingNotification, self.Owner.Country.InternalName);
return NextActivity; return NextActivity;
} }
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
if (!played) if (!played)
{ {
played = true; played = true;
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.StartRepairingNotification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", repairsUnits.StartRepairingNotification, self.Owner.Country.InternalName);
} }
if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost)) if (!self.Owner.PlayerActor.Trait<PlayerResources>().TakeCash(cost))

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
foreach (var s in Sounds) foreach (var s in Sounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Country.InternalName);
var init = new TypeDictionary var init = new TypeDictionary
{ {

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
{ {
var players = new MapPlayers(map.PlayerDefinitions).Players; var players = new MapPlayers(map.PlayerDefinitions).Players;
var playerNames = players.Values.Select(p => p.Name); var playerNames = players.Values.Select(p => p.Name).ToHashSet();
foreach (var player in players.Values) foreach (var player in players.Values)
{ {
foreach (var ally in player.Allies) foreach (var ally in player.Allies)
@@ -38,14 +38,14 @@ namespace OpenRA.Mods.Common.Lint
var worldActor = map.Rules.Actors["world"]; var worldActor = map.Rules.Actors["world"];
var races = worldActor.Traits.WithInterface<CountryInfo>().Select(c => c.Race); var races = worldActor.Traits.WithInterface<FactionInfo>().Select(f => f.InternalName).ToHashSet();
foreach (var player in players.Values) foreach (var player in players.Values)
if (!string.IsNullOrWhiteSpace(player.Faction) && !races.Contains(player.Faction)) if (!string.IsNullOrWhiteSpace(player.Faction) && !races.Contains(player.Faction))
emitError("Invalid race {0} chosen for player {1}.".F(player.Faction, player.Name)); emitError("Invalid race {0} chosen for player {1}.".F(player.Faction, player.Name));
if (worldActor.Traits.Contains<MPStartLocationsInfo>()) if (worldActor.Traits.Contains<MPStartLocationsInfo>())
{ {
var multiPlayers = players.Where(p => p.Value.Playable).Count(); var multiPlayers = players.Count(p => p.Value.Playable);
var spawns = map.ActorDefinitions.Where(a => a.Value.Value == "mpspawn"); var spawns = map.ActorDefinitions.Where(a => a.Value.Value == "mpspawn");
var spawnCount = spawns.Count(); var spawnCount = spawns.Count();

View File

@@ -28,9 +28,9 @@ namespace OpenRA.Mods.Common.Lint
this.emitWarning = emitWarning; this.emitWarning = emitWarning;
sequenceDefinitions = MiniYaml.MergeLiberal(map.SequenceDefinitions, sequenceDefinitions = MiniYaml.MergeLiberal(map.SequenceDefinitions,
Game.ModData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal)); Game.ModData.Manifest.Sequences.Select(MiniYaml.FromFile).Aggregate(MiniYaml.MergeLiberal));
var races = map.Rules.Actors["world"].Traits.WithInterface<CountryInfo>().Select(c => c.Race); var races = map.Rules.Actors["world"].Traits.WithInterface<FactionInfo>().Select(f => f.InternalName).ToArray();
foreach (var actorInfo in map.Rules.Actors) foreach (var actorInfo in map.Rules.Actors)
{ {
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Lint
foreach (var race in races) foreach (var race in races)
{ {
var image = renderInfo.GetImage(actorInfo.Value, map.Rules.Sequences[map.Tileset], race); var image = renderInfo.GetImage(actorInfo.Value, map.Rules.Sequences[map.Tileset], race);
if (!sequenceDefinitions.Any(s => s.Key == image.ToLowerInvariant()) && !actorInfo.Value.Name.Contains("^")) if (sequenceDefinitions.All(s => s.Key != image.ToLowerInvariant()) && !actorInfo.Value.Name.Contains("^"))
emitWarning("Sprite image {0} from actor {1} on tileset {2} using race {3} has no sequence definition." emitWarning("Sprite image {0} from actor {1} on tileset {2} using race {3} has no sequence definition."
.F(image, actorInfo.Value.Name, map.Tileset, race)); .F(image, actorInfo.Value.Name, map.Tileset, race));
} }
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Lint
{ {
foreach (var imageOverride in LintExts.GetFieldValues(traitInfo, imageField, emitError)) foreach (var imageOverride in LintExts.GetFieldValues(traitInfo, imageField, emitError))
{ {
if (!string.IsNullOrEmpty(imageOverride) && !sequenceDefinitions.Any(s => s.Key == imageOverride.ToLowerInvariant())) if (!string.IsNullOrEmpty(imageOverride) && sequenceDefinitions.All(s => s.Key != imageOverride.ToLowerInvariant()))
emitWarning("Custom sprite image {0} from actor {1} has no sequence definition.".F(imageOverride, actorInfo.Value.Name)); emitWarning("Custom sprite image {0} from actor {1} has no sequence definition.".F(imageOverride, actorInfo.Value.Name));
else else
CheckDefintions(imageOverride, sequenceReference, actorInfo, sequence, race, field, traitInfo); CheckDefintions(imageOverride, sequenceReference, actorInfo, sequence, race, field, traitInfo);
@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Lint
emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence prefix {3} from field {4} of {5}" emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence prefix {3} from field {4} of {5}"
.F(image, actorInfo.Value.Name, race, sequence, field.Name, traitInfo)); .F(image, actorInfo.Value.Name, race, sequence, field.Name, traitInfo));
} }
else if (!definitions.Value.Nodes.Any(n => n.Key == sequence)) else if (definitions.Value.Nodes.All(n => n.Key != sequence))
{ {
emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence {3} from field {4} of {5}" emitWarning("Sprite image {0} from actor {1} of faction {2} does not define sequence {3} from field {4} of {5}"
.F(image, actorInfo.Value.Name, race, sequence, field.Name, traitInfo)); .F(image, actorInfo.Value.Name, race, sequence, field.Name, traitInfo));

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Orders
var buildableInfo = info.Traits.Get<BuildableInfo>(); var buildableInfo = info.Traits.Get<BuildableInfo>();
var mostLikelyProducer = queue.MostLikelyProducer(); var mostLikelyProducer = queue.MostLikelyProducer();
race = buildableInfo.ForceRace ?? (mostLikelyProducer.Trait != null ? mostLikelyProducer.Trait.Race : producer.Owner.Country.Race); race = buildableInfo.ForceRace ?? (mostLikelyProducer.Trait != null ? mostLikelyProducer.Trait.Race : producer.Owner.Country.InternalName);
buildOk = map.SequenceProvider.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0); buildOk = map.SequenceProvider.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
buildBlocked = map.SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0); buildBlocked = map.SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0);
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Orders
orderType = "PlacePlug"; orderType = "PlacePlug";
if (!AcceptsPlug(topLeft, plugInfo)) if (!AcceptsPlug(topLeft, plugInfo))
{ {
Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Country.Race); Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Country.InternalName);
yield break; yield break;
} }
} }
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Orders
if (!world.CanPlaceBuilding(building, buildingInfo, topLeft, null) if (!world.CanPlaceBuilding(building, buildingInfo, topLeft, null)
|| !buildingInfo.IsCloseEnoughToBase(world, producer.Owner, building, topLeft)) || !buildingInfo.IsCloseEnoughToBase(world, producer.Owner, building, topLeft))
{ {
Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Country.Race); Sound.PlayNotification(world.Map.Rules, producer.Owner, "Speech", "BuildingCannotPlaceAudio", producer.Owner.Country.InternalName);
yield break; yield break;
} }

View File

@@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Play an announcer voice listed in notifications.yaml")] [Desc("Play an announcer voice listed in notifications.yaml")]
public void PlaySpeechNotification(Player player, string notification) public void PlaySpeechNotification(Player player, string notification)
{ {
Sound.PlayNotification(world.Map.Rules, player, "Speech", notification, player != null ? player.Country.Race : null); Sound.PlayNotification(world.Map.Rules, player, "Speech", notification, player != null ? player.Country.InternalName : null);
} }
[Desc("Play a sound listed in notifications.yaml")] [Desc("Play a sound listed in notifications.yaml")]
public void PlaySoundNotification(Player player, string notification) public void PlaySoundNotification(Player player, string notification)
{ {
Sound.PlayNotification(world.Map.Rules, player, "Sounds", notification, player != null ? player.Country.Race : null); Sound.PlayNotification(world.Map.Rules, player, "Sounds", notification, player != null ? player.Country.InternalName : null);
} }
[Desc("Play a sound file")] [Desc("Play a sound file")]

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
isPrimary = true; isPrimary = true;
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "PrimaryBuildingSelected", self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "PrimaryBuildingSelected", self.Owner.Country.InternalName);
} }
} }
} }

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits
if (!Repairers.Remove(player) && Repairers.Count < Info.RepairBonuses.Length) if (!Repairers.Remove(player) && Repairers.Count < Info.RepairBonuses.Length)
{ {
Repairers.Add(player); Repairers.Add(player);
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", "Repairing", player.Country.Race); Sound.PlayNotification(self.World.Map.Rules, player, "Speech", "Repairing", player.Country.InternalName);
self.World.AddFrameEndTask(w => self.World.AddFrameEndTask(w =>
{ {

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
if (captor.World.LocalPlayer != captor.Owner) if (captor.World.LocalPlayer != captor.Owner)
return; return;
var race = info.NewOwnerVoice ? newOwner.Country.Race : oldOwner.Country.Race; var race = info.NewOwnerVoice ? newOwner.Country.InternalName : oldOwner.Country.InternalName;
Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, race); Sound.PlayNotification(self.World.Map.Rules, captor.World.LocalPlayer, "Speech", info.Notification, race);
} }
} }

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
public bool CanGiveTo(Actor collector) public bool CanGiveTo(Actor collector)
{ {
if (info.ValidRaces.Any() && !info.ValidRaces.Contains(collector.Owner.Country.Race)) if (info.ValidRaces.Any() && !info.ValidRaces.Contains(collector.Owner.Country.InternalName))
return false; return false;
var targetable = collector.Info.Traits.GetOrDefault<ITargetableInfo>(); var targetable = collector.Info.Traits.GetOrDefault<ITargetableInfo>();

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
public bool CanGiveTo(Actor collector) public bool CanGiveTo(Actor collector)
{ {
if (info.ValidRaces.Any() && !info.ValidRaces.Contains(collector.Owner.Country.Race)) if (info.ValidRaces.Any() && !info.ValidRaces.Contains(collector.Owner.Country.InternalName))
return false; return false;
foreach (string unit in info.Units) foreach (string unit in info.Units)

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
this.info = info; this.info = info;
var raceList = info.Races; var raceList = info.Races;
correctRace = raceList.Length == 0 || raceList.Contains(self.Owner.Country.Race); correctRace = raceList.Length == 0 || raceList.Contains(self.Owner.Country.InternalName);
} }
public void Selling(Actor self) { } public void Selling(Actor self) { }

View File

@@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits
if (!silent) if (!silent)
{ {
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "LevelUp", self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "LevelUp", self.Owner.Country.InternalName);
self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", info.LevelUpPalette))); self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", info.LevelUpPalette)));
} }
} }

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
{ {
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.InternalName);
if (radarPings != null) if (radarPings != null)
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits
Game.RunAfterDelay(info.NotificationDelay, () => Game.RunAfterDelay(info.NotificationDelay, () =>
{ {
if (Game.IsCurrentWorld(player.World)) if (Game.IsCurrentWorld(player.World))
Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Country.Race); Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Country.InternalName);
}); });
} }
} }
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits
Game.Debug("{0} is victorious.", player.PlayerName); Game.Debug("{0} is victorious.", player.PlayerName);
if (player == player.World.LocalPlayer) if (player == player.World.LocalPlayer)
Game.RunAfterDelay(info.NotificationDelay, () => Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Country.Race)); Game.RunAfterDelay(info.NotificationDelay, () => Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Country.InternalName));
} }
public void OnObjectiveAdded(Player player, int id) { } public void OnObjectiveAdded(Player player, int id) { }

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
{ {
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.InternalName);
if (radarPings != null) if (radarPings != null)
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification, Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification,
self.World.RenderPlayer != null ? self.World.RenderPlayer.Country.Race : null); self.World.RenderPlayer != null ? self.World.RenderPlayer.Country.InternalName : null);
if (radarPings != null) if (radarPings != null)
{ {

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
return; return;
var producer = queue.MostLikelyProducer(); var producer = queue.MostLikelyProducer();
var race = producer.Trait != null ? producer.Trait.Race : self.Owner.Country.Race; var race = producer.Trait != null ? producer.Trait.Race : self.Owner.Country.InternalName;
var buildingInfo = unit.Traits.Get<BuildingInfo>(); var buildingInfo = unit.Traits.Get<BuildingInfo>();
var buildableInfo = unit.Traits.GetOrDefault<BuildableInfo>(); var buildableInfo = unit.Traits.GetOrDefault<BuildableInfo>();
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits
if (GetNumBuildables(self.Owner) > prevItems) if (GetNumBuildables(self.Owner) > prevItems)
w.Add(new DelayedAction(info.NewOptionsNotificationDelay, w.Add(new DelayedAction(info.NewOptionsNotificationDelay,
() => Sound.PlayNotification(self.World.Map.Rules, order.Player, "Speech", info.NewOptionsNotification, order.Player.Country.Race))); () => Sound.PlayNotification(self.World.Map.Rules, order.Player, "Speech", info.NewOptionsNotification, order.Player.Country.InternalName)));
}); });
} }

View File

@@ -97,7 +97,7 @@ namespace OpenRA.Mods.Common.Traits
playerPower = playerActor.Trait<PowerManager>(); playerPower = playerActor.Trait<PowerManager>();
developerMode = playerActor.Trait<DeveloperMode>(); developerMode = playerActor.Trait<DeveloperMode>();
Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race; Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.InternalName;
Enabled = !info.Race.Any() || info.Race.Contains(Race); Enabled = !info.Race.Any() || info.Race.Contains(Race);
CacheProduceables(playerActor); CacheProduceables(playerActor);
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
if (!Info.Sticky) if (!Info.Sticky)
{ {
Race = self.Owner.Country.Race; Race = self.Owner.Country.InternalName;
Enabled = !Info.Race.Any() || Info.Race.Contains(Race); Enabled = !Info.Race.Any() || Info.Race.Contains(Race);
} }
@@ -277,13 +277,13 @@ namespace OpenRA.Mods.Common.Traits
var isBuilding = unit.Traits.Contains<BuildingInfo>(); var isBuilding = unit.Traits.Contains<BuildingInfo>();
if (isBuilding && !hasPlayedSound) if (isBuilding && !hasPlayedSound)
hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.InternalName);
else if (!isBuilding) else if (!isBuilding)
{ {
if (BuildUnit(order.TargetString)) if (BuildUnit(order.TargetString))
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Country.InternalName);
else if (!hasPlayedSound && time > 0) else if (!hasPlayedSound && time > 0)
hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.Race); hasPlayedSound = Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.InternalName);
} }
}))); })));
} }

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
if (string.IsNullOrEmpty(prerequisite)) if (string.IsNullOrEmpty(prerequisite))
prerequisite = init.Self.Info.Name; prerequisite = init.Self.Info.Name;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race; var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.InternalName;
Update(init.Self.Owner, race); Update(init.Self.Owner, race);
} }
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{ {
if (info.ResetOnOwnerChange) if (info.ResetOnOwnerChange)
Update(newOwner, newOwner.Country.Race); Update(newOwner, newOwner.Country.InternalName);
} }
void Update(Player owner, string race) void Update(Player owner, string race)

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
Game.RunAfterDelay(info.NotificationDelay, () => Game.RunAfterDelay(info.NotificationDelay, () =>
{ {
if (Game.IsCurrentWorld(player.World)) if (Game.IsCurrentWorld(player.World))
Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Country.Race); Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Lose", player.Country.InternalName);
}); });
} }
} }
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits
Game.Debug("{0} is victorious.", player.PlayerName); Game.Debug("{0} is victorious.", player.PlayerName);
if (player == player.World.LocalPlayer) if (player == player.World.LocalPlayer)
Game.RunAfterDelay(info.NotificationDelay, () => Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Country.Race)); Game.RunAfterDelay(info.NotificationDelay, () => Sound.PlayNotification(player.World.Map.Rules, player, "Speech", "Win", player.Country.InternalName));
} }
public void OnObjectiveAdded(Player player, int id) { } public void OnObjectiveAdded(Player player, int id) { }

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
if (!IsTraitDisabled && order.OrderString == "PowerDown") if (!IsTraitDisabled && order.OrderString == "PowerDown")
{ {
disabled = !disabled; disabled = !disabled;
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", disabled ? "EnablePower" : "DisablePower", self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", disabled ? "EnablePower" : "DisablePower", self.Owner.Country.InternalName);
power.UpdateActor(self); power.UpdateActor(self);
if (disabled) if (disabled)
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
if (!disabled || !Info.CancelWhenDisabled) if (!disabled || !Info.CancelWhenDisabled)
return; return;
disabled = false; disabled = false;
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "EnablePower", self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", "EnablePower", self.Owner.Country.InternalName);
power.UpdateActor(self); power.UpdateActor(self);
} }
} }

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
if (--nextPowerAdviceTime <= 0) if (--nextPowerAdviceTime <= 0)
{ {
if (lowPower) if (lowPower)
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SpeechNotification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SpeechNotification, self.Owner.Country.InternalName);
nextPowerAdviceTime = info.AdviceInterval; nextPowerAdviceTime = info.AdviceInterval;
} }

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
Info = info; Info = info;
rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>()); rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault<RallyPoint>());
Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race; Race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.InternalName;
} }
public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string raceVariant) public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo, string raceVariant)

View File

@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits
public RenderSprites(ActorInitializer init, RenderSpritesInfo info) public RenderSprites(ActorInitializer init, RenderSpritesInfo info)
{ {
this.info = info; this.info = info;
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race; race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.InternalName;
} }
public string GetImage(Actor self) public string GetImage(Actor self)

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public void Killed(Actor self, AttackInfo e) public void Killed(Actor self, AttackInfo e)
{ {
var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner; var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner;
Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Country.InternalName);
} }
} }
} }

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
// Audio notification // Audio notification
if (discoverer != null && !string.IsNullOrEmpty(Info.Notification)) if (discoverer != null && !string.IsNullOrEmpty(Info.Notification))
Sound.PlayNotification(self.World.Map.Rules, discoverer, "Speech", Info.Notification, discoverer.Country.Race); Sound.PlayNotification(self.World.Map.Rules, discoverer, "Speech", Info.Notification, discoverer.Country.InternalName);
// Radar notificaion // Radar notificaion
if (Info.PingRadar && radarPings.Value != null) if (Info.PingRadar && radarPings.Value != null)

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
self = init.Self; self = init.Self;
this.info = info; this.info = info;
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>(); buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race; race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.InternalName;
} }
public string VoicePhraseForOrder(Actor self, Order order) public string VoicePhraseForOrder(Actor self, Order order)
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var s in info.NoTransformSounds) foreach (var s in info.NoTransformSounds)
Sound.PlayToPlayer(self.Owner, s); Sound.PlayToPlayer(self.Owner, s);
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NoTransformNotification, self.Owner.Country.Race); Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NoTransformNotification, self.Owner.Country.InternalName);
return; return;
} }

View File

@@ -31,11 +31,11 @@ namespace OpenRA.Mods.Common.Traits
{ {
var spawnClass = p.PlayerReference.StartingUnitsClass ?? w.LobbyInfo.GlobalSettings.StartingUnitsClass; var spawnClass = p.PlayerReference.StartingUnitsClass ?? w.LobbyInfo.GlobalSettings.StartingUnitsClass;
var unitGroup = w.Map.Rules.Actors["world"].Traits.WithInterface<MPStartUnitsInfo>() var unitGroup = w.Map.Rules.Actors["world"].Traits.WithInterface<MPStartUnitsInfo>()
.Where(g => g.Class == spawnClass && g.Races != null && g.Races.Contains(p.Country.Race)) .Where(g => g.Class == spawnClass && g.Races != null && g.Races.Contains(p.Country.InternalName))
.RandomOrDefault(w.SharedRandom); .RandomOrDefault(w.SharedRandom);
if (unitGroup == null) if (unitGroup == null)
throw new InvalidOperationException("No starting units defined for country {0} with class {1}".F(p.Country.Race, spawnClass)); throw new InvalidOperationException("No starting units defined for country {0} with class {1}".F(p.Country.InternalName, spawnClass));
if (unitGroup.BaseActor != null) if (unitGroup.BaseActor != null)
{ {

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
public void WorldLoaded(World world, WorldRenderer wr) public void WorldLoaded(World world, WorldRenderer wr)
{ {
Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Country.Race); Sound.PlayNotification(world.Map.Rules, null, "Speech", info.Notification, world.RenderPlayer == null ? null : world.RenderPlayer.Country.InternalName);
} }
} }
} }

View File

@@ -1408,7 +1408,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
var upgradeTypes = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Upgrade"); var upgradeTypes = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Upgrade");
var modifier = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Modifier"); var modifier = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Modifier");
if (upgradeTypes == null || !string.IsNullOrEmpty(upgradeTypes.Value.Value) || modifier == null || !string.IsNullOrEmpty(modifier.Value.Value)) if (upgradeTypes == null || !string.IsNullOrEmpty(upgradeTypes.Value.Value) || modifier == null ||
!string.IsNullOrEmpty(modifier.Value.Value))
{ {
var yaml = new MiniYaml(null); var yaml = new MiniYaml(null);
if (modifier == null) if (modifier == null)
@@ -1505,6 +1506,24 @@ namespace OpenRA.Mods.Common.UtilityCommands
} }
} }
// Rename the `Country` trait to `Faction`
if (engineVersion < 20150714)
{
var split = node.Key.Split('@');
if (split.Any() && split[0] == "Country")
{
node.Key = node.Key.Replace("Country", "Faction");
var race = node.Value.Nodes.FirstOrDefault(x => x.Key == "Race");
if (race != null)
race.Key = "InternalName";
var randomRace = node.Value.Nodes.FirstOrDefault(x => x.Key == "RandomRaceMembers");
if (randomRace != null)
randomRace.Key = "RandomFactionMembers";
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
} }
} }

View File

@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public AddRaceSuffixLogic(Widget widget, World world) public AddRaceSuffixLogic(Widget widget, World world)
{ {
string race; string race;
if (!ChromeMetrics.TryGet("RaceSuffix-" + world.LocalPlayer.Country.Race, out race)) if (!ChromeMetrics.TryGet("RaceSuffix-" + world.LocalPlayer.Country.InternalName, out race))
race = world.LocalPlayer.Country.Race; race = world.LocalPlayer.Country.InternalName;
var suffix = "-" + race; var suffix = "-" + race;
if (widget is ButtonWidget) if (widget is ButtonWidget)

View File

@@ -62,12 +62,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
flag.GetImageCollection = () => "flags"; flag.GetImageCollection = () => "flags";
if (lp.Stances[pp] == Stance.Ally || lp.WinState != WinState.Undefined) if (lp.Stances[pp] == Stance.Ally || lp.WinState != WinState.Undefined)
{ {
flag.GetImageName = () => pp.Country.Race; flag.GetImageName = () => pp.Country.InternalName;
item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name; item.Get<LabelWidget>("FACTION").GetText = () => pp.Country.Name;
} }
else else
{ {
flag.GetImageName = () => pp.DisplayCountry.Race; flag.GetImageName = () => pp.DisplayCountry.InternalName;
item.Get<LabelWidget>("FACTION").GetText = () => pp.DisplayCountry.Name; item.Get<LabelWidget>("FACTION").GetText = () => pp.DisplayCountry.Name;
} }

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Action onQuit = () => Action onQuit = () =>
{ {
if (world.Type == WorldType.Regular) if (world.Type == WorldType.Regular)
Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave", world.LocalPlayer == null ? null : world.LocalPlayer.Country.Race); Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave", world.LocalPlayer == null ? null : world.LocalPlayer.Country.InternalName);
resumeDisabled = true; resumeDisabled = true;

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Widgets
if (world.Type == WorldType.Regular) if (world.Type == WorldType.Regular)
Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave", Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave",
world.LocalPlayer == null ? null : world.LocalPlayer.Country.Race); world.LocalPlayer == null ? null : world.LocalPlayer.Country.InternalName);
var exitDelay = iop != null ? iop.ExitDelay : 0; var exitDelay = iop != null ? iop.ExitDelay : 0;
if (mpe != null) if (mpe != null)

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Player = p; Player = p;
Label = p.PlayerName; Label = p.PlayerName;
Color = p.Color.RGB; Color = p.Color.RGB;
Race = p.Country.Race; Race = p.Country.InternalName;
IsSelected = () => p.World.RenderPlayer == p; IsSelected = () => p.World.RenderPlayer == p;
OnClick = () => { p.World.RenderPlayer = p; logic.selected = this; p.World.Selection.Clear(); }; OnClick = () => { p.World.RenderPlayer = p; logic.selected = this; p.World.Selection.Clear(); };
} }

View File

@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (showOwner) if (showOwner)
{ {
flagRace = o.Country.Race; flagRace = o.Country.InternalName;
ownerName = o.PlayerName; ownerName = o.PlayerName;
ownerColor = o.Color.RGB; ownerColor = o.Color.RGB;
widget.Bounds.Height = doubleHeight; widget.Bounds.Height = doubleHeight;

View File

@@ -144,8 +144,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
colorPreview = lobby.Get<ColorPreviewManagerWidget>("COLOR_MANAGER"); colorPreview = lobby.Get<ColorPreviewManagerWidget>("COLOR_MANAGER");
colorPreview.Color = Game.Settings.Player.Color; colorPreview.Color = Game.Settings.Player.Color;
foreach (var c in modRules.Actors["world"].Traits.WithInterface<CountryInfo>()) foreach (var f in modRules.Actors["world"].Traits.WithInterface<FactionInfo>())
countries.Add(c.Race, new LobbyCountry { Selectable = c.Selectable, Name = c.Name, Side = c.Side, Description = c.Description }); countries.Add(f.InternalName, new LobbyCountry { Selectable = f.Selectable, Name = f.Name, Side = f.Side, Description = f.Description });
var gameStarting = false; var gameStarting = false;
Func<bool> configurationDisabled = () => !Game.IsHost || gameStarting || Func<bool> configurationDisabled = () => !Game.IsHost || gameStarting ||

View File

@@ -456,9 +456,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var flag = template.Get<ImageWidget>("FLAG"); var flag = template.Get<ImageWidget>("FLAG");
flag.GetImageCollection = () => "flags"; flag.GetImageCollection = () => "flags";
if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally) if (player.World.RenderPlayer != null && player.World.RenderPlayer.Stances[player] != Stance.Ally)
flag.GetImageName = () => player.DisplayCountry.Race; flag.GetImageName = () => player.DisplayCountry.InternalName;
else else
flag.GetImageName = () => player.Country.Race; flag.GetImageName = () => player.Country.InternalName;
var playerName = template.Get<LabelWidget>("PLAYER"); var playerName = template.Get<LabelWidget>("PLAYER");
var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex); var client = player.World.LobbyInfo.ClientWithIndex(player.ClientIndex);

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets
if (current == null) if (current == null)
continue; continue;
var race = queue.Trait.Actor.Owner.Country.Race; var race = queue.Trait.Actor.Owner.Country.InternalName;
var actor = queue.Trait.AllItems().FirstOrDefault(a => a.Name == current.Item); var actor = queue.Trait.AllItems().FirstOrDefault(a => a.Name == current.Item);
if (actor == null) if (actor == null)
continue; continue;

View File

@@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Widgets
{ {
// Queue a new item // Queue a new item
Sound.Play(TabClick); Sound.Play(TabClick);
Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Country.Race); Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Country.InternalName);
World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name,
handleMultiple ? 5 : 1)); handleMultiple ? 5 : 1));
return true; return true;
@@ -245,14 +245,14 @@ namespace OpenRA.Mods.Common.Widgets
if (item.Paused || item.Done || item.TotalCost == item.RemainingCost) if (item.Paused || item.Done || item.TotalCost == item.RemainingCost)
{ {
// Instant cancel of things we have not started yet and things that are finished // Instant cancel of things we have not started yet and things that are finished
Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Country.Race); Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Country.InternalName);
World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name, World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name,
handleMultiple ? 5 : 1)); handleMultiple ? 5 : 1));
} }
else else
{ {
// Pause an existing item // Pause an existing item
Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.OnHoldAudio, World.LocalPlayer.Country.Race); Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.OnHoldAudio, World.LocalPlayer.Country.InternalName);
World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, true)); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, true));
} }

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.D2k.Activities
void NotifyPlayer(Player player, WPos location) void NotifyPlayer(Player player, WPos location)
{ {
Sound.PlayNotification(player.World.Map.Rules, player, "Speech", swallow.Info.WormAttackNotification, player.Country.Race); Sound.PlayNotification(player.World.Map.Rules, player, "Speech", swallow.Info.WormAttackNotification, player.Country.InternalName);
if (player == player.World.RenderPlayer) if (player == player.World.RenderPlayer)
radarPings.Add(() => true, location, Color.Red, 50); radarPings.Add(() => true, location, Color.Red, 50);

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
{ {
this.info = info; this.info = info;
production = init.Self.Trait<Production>(); production = init.Self.Trait<Production>();
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race; race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.InternalName;
} }
public void UnitProducedByOther(Actor self, Actor producer, Actor produced) public void UnitProducedByOther(Actor self, Actor producer, Actor produced)

View File

@@ -168,7 +168,7 @@ namespace OpenRA.Mods.RA.Traits
var oldEffectiveOwner = AsPlayer; var oldEffectiveOwner = AsPlayer;
var renderSprites = actorInfo.Traits.GetOrDefault<RenderSpritesInfo>(); var renderSprites = actorInfo.Traits.GetOrDefault<RenderSpritesInfo>();
AsSprite = renderSprites == null ? null : renderSprites.GetImage(actorInfo, self.World.Map.SequenceProvider, newOwner.Country.Race); AsSprite = renderSprites == null ? null : renderSprites.GetImage(actorInfo, self.World.Map.SequenceProvider, newOwner.Country.InternalName);
AsPlayer = newOwner; AsPlayer = newOwner;
AsTooltipInfo = actorInfo.Traits.WithInterface<TooltipInfo>().FirstOrDefault(); AsTooltipInfo = actorInfo.Traits.WithInterface<TooltipInfo>().FirstOrDefault();

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits
{ {
this.info = info; this.info = info;
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.Race; race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : init.Self.Owner.Country.InternalName;
} }
public void Killed(Actor self, AttackInfo e) public void Killed(Actor self, AttackInfo e)

View File

@@ -12,18 +12,18 @@
FogVariants: typea, typeb, typec, typed FogVariants: typea, typeb, typec, typed
OverrideFullShroud: full OverrideFullShroud: full
OverrideFullFog: full OverrideFullFog: full
Country@Random: Faction@Random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: gdi, nod RandomFactionMembers: gdi, nod
Description: Select a random faction. Description: Select a random faction.
Country@gdi: Faction@gdi:
Name: GDI Name: GDI
Race: gdi InternalName: gdi
Description: Global Defense Initiative\nThe GDI is an international military branch of the United Nations tasked\nwith keeping world peace. Commanding the combined forces of the world's\nmost powerful nations, they possess an unmatched arsenal of high-tech weaponry. Description: Global Defense Initiative\nThe GDI is an international military branch of the United Nations tasked\nwith keeping world peace. Commanding the combined forces of the world's\nmost powerful nations, they possess an unmatched arsenal of high-tech weaponry.
Country@nod: Faction@nod:
Name: Nod Name: Nod
Race: nod InternalName: nod
Description: Brotherhood of Nod\nThe Brotherhood is a religious cult centered around their leader Kane\nand the alien substance Tiberium. They utilize stealth technology\nand guerilla tactics to defeat those who oppose them. Description: Brotherhood of Nod\nThe Brotherhood is a religious cult centered around their leader Kane\nand the alien substance Tiberium. They utilize stealth technology\nand guerilla tactics to defeat those who oppose them.
ResourceType@green-tib: ResourceType@green-tib:
ResourceType: 1 ResourceType: 1

View File

@@ -14,26 +14,26 @@
OverrideFullShroud: full OverrideFullShroud: full
OverrideFullFog: full OverrideFullFog: full
ShroudBlend: Multiply ShroudBlend: Multiply
Country@Random: Faction@Random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: atreides, harkonnen, ordos RandomFactionMembers: atreides, harkonnen, ordos
Description: Select a random House. Description: Select a random House.
Country@Atreides: Faction@Atreides:
Name: Atreides Name: Atreides
Race: atreides InternalName: atreides
Description: House Atreides\nThe noble Atreides, from the water world of Caladan,\nrely on their ornithopters to ensure air superiority.\nThey have allied themselves with the Fremen, the fearsome\nnative warriors of Dune that can move undetected in battle. Description: House Atreides\nThe noble Atreides, from the water world of Caladan,\nrely on their ornithopters to ensure air superiority.\nThey have allied themselves with the Fremen, the fearsome\nnative warriors of Dune that can move undetected in battle.
Country@Harkonnen: Faction@Harkonnen:
Name: Harkonnen Name: Harkonnen
Race: harkonnen InternalName: harkonnen
Description: House Harkonnen\nThe evil Harkonnen will stop at nothing to gain control of the spice.\nThey rely on brute force and atomic weapons to achieve their goals:\nwealth, and the destruction of House Atreides. Description: House Harkonnen\nThe evil Harkonnen will stop at nothing to gain control of the spice.\nThey rely on brute force and atomic weapons to achieve their goals:\nwealth, and the destruction of House Atreides.
Country@Ordos: Faction@Ordos:
Name: Ordos Name: Ordos
Race: ordos InternalName: ordos
Description: House Ordos\nThe insidious Ordos of the icy planet Sigma Draconis IV\nare known for their wealth, greed and treachery.\nRelying heavily on mercenaries they often resort\nto sabotage and forbidden Ixian technologies. Description: House Ordos\nThe insidious Ordos of the icy planet Sigma Draconis IV\nare known for their wealth, greed and treachery.\nRelying heavily on mercenaries they often resort\nto sabotage and forbidden Ixian technologies.
Country@Corrino: Faction@Corrino:
Name: Corrino Name: Corrino
Race: corrino InternalName: corrino
Selectable: false Selectable: false
ResourceType@Spice: ResourceType@Spice:
ResourceType: 1 ResourceType: 1

View File

@@ -12,57 +12,57 @@
FogVariants: shroud FogVariants: shroud
Index: 255, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 20, 40, 56, 65, 97, 130, 148, 194, 24, 33, 66, 132, 28, 41, 67, 134, 1, 2, 4, 8, 3, 6, 12, 9, 7, 14, 13, 11, 5, 10, 15, 255 Index: 255, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 20, 40, 56, 65, 97, 130, 148, 194, 24, 33, 66, 132, 28, 41, 67, 134, 1, 2, 4, 8, 3, 6, 12, 9, 7, 14, 13, 11, 5, 10, 15, 255
UseExtendedIndex: true UseExtendedIndex: true
Country@0: Faction@0:
Name: Allies Name: Allies
Race: allies InternalName: allies
Side: Allies Side: Allies
Selectable: False Selectable: False
Country@1: Faction@1:
Name: England Name: England
Race: england InternalName: england
Side: Allies Side: Allies
Description: England: Espionage\nSpecial Unit: British Spy\nSpecial Unit: Phase Transport Description: England: Espionage\nSpecial Unit: British Spy\nSpecial Unit: Phase Transport
Country@2: Faction@2:
Name: France Name: France
Race: france InternalName: france
Side: Allies Side: Allies
Description: France: Deception\nSpecial Ability: Can build fake structures\nSpecial Unit: Mobile Gap Generator Description: France: Deception\nSpecial Ability: Can build fake structures\nSpecial Unit: Mobile Gap Generator
Country@3: Faction@3:
Name: Germany Name: Germany
Race: germany InternalName: germany
Side: Allies Side: Allies
Description: Germany: Technology\nSpecial Ability: Advanced Chronoshift\nSpecial Unit: Chrono Tank Description: Germany: Technology\nSpecial Ability: Advanced Chronoshift\nSpecial Unit: Chrono Tank
Country@4: Faction@4:
Name: Soviet Name: Soviet
Race: soviet InternalName: soviet
Side: Soviet Side: Soviet
Selectable: False Selectable: False
Country@5: Faction@5:
Name: Russia Name: Russia
Race: russia InternalName: russia
Side: Soviet Side: Soviet
Description: Russia: Tesla Weapons\nSpecial Unit: Tesla Tank\nSpecial Unit: Shock Trooper Description: Russia: Tesla Weapons\nSpecial Unit: Tesla Tank\nSpecial Unit: Shock Trooper
Country@6: Faction@6:
Name: Ukraine Name: Ukraine
Race: ukraine InternalName: ukraine
Side: Soviet Side: Soviet
Description: Ukraine: Demolitions\nSpecial Ability: Parabombs\nSpecial Unit: Demolition Truck Description: Ukraine: Demolitions\nSpecial Ability: Parabombs\nSpecial Unit: Demolition Truck
Country@random: Faction@random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: RandomAllies, RandomSoviet RandomFactionMembers: RandomAllies, RandomSoviet
Side: Random Side: Random
Description: A random country. Description: A random country.
Country@randomallies: Faction@randomallies:
Name: Allies Name: Allies
Race: RandomAllies InternalName: RandomAllies
RandomRaceMembers: england, france, germany RandomFactionMembers: england, france, germany
Side: Random Side: Random
Description: A random Allied country. Description: A random Allied country.
Country@randomsoviet: Faction@randomsoviet:
Name: Soviet Name: Soviet
Race: RandomSoviet InternalName: RandomSoviet
RandomRaceMembers: russia, ukraine RandomFactionMembers: russia, ukraine
Side: Random Side: Random
Description: A random Soviet country. Description: A random Soviet country.
ResourceType@ore: ResourceType@ore:

View File

@@ -12,16 +12,16 @@
UseExtendedIndex: true UseExtendedIndex: true
ShroudPalette: shroud ShroudPalette: shroud
FogPalette: shroud FogPalette: shroud
Country@Random: Faction@Random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: gdi, nod RandomFactionMembers: gdi, nod
Country@0: Faction@0:
Name: GDI Name: GDI
Race: gdi InternalName: gdi
Country@1: Faction@1:
Name: Nod Name: Nod
Race: nod InternalName: nod
ResourceType@Tiberium: ResourceType@Tiberium:
ResourceType: 1 ResourceType: 1
Palette: greentiberium Palette: greentiberium