Rename Faction trait members

Rename Faction.Race to Faction.InternalName
This commit is contained in:
penev92
2015-07-06 02:28:48 +03:00
parent a1af5386e0
commit 2e04fb5ddd
53 changed files with 85 additions and 85 deletions

View File

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

View File

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

View File

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

View File

@@ -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(() =>
{

View File

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

View File

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

View File

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

View File

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

View File

@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Cnc.Traits
cargo.Delivered(self);
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)));

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Activities
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;
}
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
if (!played)
{
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))

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Activities
foreach (var s in Sounds)
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
{

View File

@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint
var worldActor = map.Rules.Actors["world"];
var races = worldActor.Traits.WithInterface<FactionInfo>().Select(c => c.Race);
var races = worldActor.Traits.WithInterface<FactionInfo>().Select(f => f.InternalName);
foreach (var player in players.Values)
if (!string.IsNullOrWhiteSpace(player.Race) && !races.Contains(player.Race))
emitError("Invalid race {0} chosen for player {1}.".F(player.Race, player.Name));

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Lint
sequenceDefinitions = MiniYaml.MergeLiberal(map.SequenceDefinitions,
Game.ModData.Manifest.Sequences.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));
var races = map.Rules.Actors["world"].Traits.WithInterface<FactionInfo>().Select(c => c.Race);
var races = map.Rules.Actors["world"].Traits.WithInterface<FactionInfo>().Select(c => c.InternalName);
foreach (var actorInfo in map.Rules.Actors)
{

View File

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Orders
var buildableInfo = info.Traits.Get<BuildableInfo>();
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);
buildBlocked = map.SequenceProvider.GetSequence("overlay", "build-invalid").GetSprite(0);
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Orders
orderType = "PlacePlug";
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;
}
}
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.Common.Orders
if (!world.CanPlaceBuilding(building, buildingInfo, topLeft, null)
|| !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;
}

View File

@@ -38,13 +38,13 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Play an announcer voice listed in notifications.yaml")]
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")]
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")]

View File

@@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits
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)
{
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 =>
{

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
if (captor.World.LocalPlayer != captor.Owner)
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);
}
}

View File

@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits
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;
var targetable = collector.Info.Traits.GetOrDefault<ITargetableInfo>();

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
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;
foreach (string unit in info.Units)

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
{
this.info = info;
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) { }

View File

@@ -99,7 +99,7 @@ namespace OpenRA.Mods.Common.Traits
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)));
}
}

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits
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)
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, () =>
{
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);
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) { }

View File

@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Traits
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)
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))
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)
{

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
return;
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 buildableInfo = unit.Traits.GetOrDefault<BuildableInfo>();
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits
if (GetNumBuildables(self.Owner) > prevItems)
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>();
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);
CacheProduceables(playerActor);
@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
if (!Info.Sticky)
{
Race = self.Owner.Country.Race;
Race = self.Owner.Country.InternalName;
Enabled = !Info.Race.Any() || Info.Race.Contains(Race);
}
@@ -277,13 +277,13 @@ namespace OpenRA.Mods.Common.Traits
var isBuilding = unit.Traits.Contains<BuildingInfo>();
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)
{
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)
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))
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);
}
@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits
public void OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{
if (info.ResetOnOwnerChange)
Update(newOwner, newOwner.Country.Race);
Update(newOwner, newOwner.Country.InternalName);
}
void Update(Player owner, string race)

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
Game.RunAfterDelay(info.NotificationDelay, () =>
{
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);
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) { }

View File

@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
if (!IsTraitDisabled && order.OrderString == "PowerDown")
{
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);
if (disabled)
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
if (!disabled || !Info.CancelWhenDisabled)
return;
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);
}
}

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Traits
if (--nextPowerAdviceTime <= 0)
{
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;
}

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Traits
{
Info = info;
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)

View File

@@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common.Traits
public RenderSprites(ActorInitializer init, RenderSpritesInfo 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)

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Traits
public void Killed(Actor self, AttackInfo e)
{
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
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
if (Info.PingRadar && radarPings.Value != null)

View File

@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits
self = init.Self;
this.info = info;
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)
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var s in info.NoTransformSounds)
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;
}

View File

@@ -31,11 +31,11 @@ namespace OpenRA.Mods.Common.Traits
{
var spawnClass = p.PlayerReference.StartingUnitsClass ?? w.LobbyInfo.GlobalSettings.StartingUnitsClass;
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);
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)
{

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Traits
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

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

View File

@@ -62,12 +62,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic
flag.GetImageCollection = () => "flags";
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;
}
else
{
flag.GetImageName = () => pp.DisplayCountry.Race;
flag.GetImageName = () => pp.DisplayCountry.InternalName;
item.Get<LabelWidget>("FACTION").GetText = () => pp.DisplayCountry.Name;
}

View File

@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Action onQuit = () =>
{
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;

View File

@@ -104,7 +104,7 @@ namespace OpenRA.Mods.Common.Widgets
if (world.Type == WorldType.Regular)
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;
if (mpe != null)

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
Player = p;
Label = p.PlayerName;
Color = p.Color.RGB;
Race = p.Country.Race;
Race = p.Country.InternalName;
IsSelected = () => p.World.RenderPlayer == p;
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)
{
flagRace = o.Country.Race;
flagRace = o.Country.InternalName;
ownerName = o.PlayerName;
ownerColor = o.Color.RGB;
widget.Bounds.Height = doubleHeight;

View File

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

View File

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

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets
if (current == null)
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);
if (actor == null)
continue;

View File

@@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Widgets
{
// Queue a new item
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,
handleMultiple ? 5 : 1));
return true;
@@ -245,14 +245,14 @@ namespace OpenRA.Mods.Common.Widgets
if (item.Paused || item.Done || item.TotalCost == item.RemainingCost)
{
// 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,
handleMultiple ? 5 : 1));
}
else
{
// 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));
}

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.D2k.Activities
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)
radarPings.Add(() => true, location, Color.Red, 50);

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA.Traits
{
this.info = info;
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)

View File

@@ -168,7 +168,7 @@ namespace OpenRA.Mods.RA.Traits
var oldEffectiveOwner = AsPlayer;
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;
AsTooltipInfo = actorInfo.Traits.WithInterface<TooltipInfo>().FirstOrDefault();

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Traits
{
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)