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

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