Rename PlayerReference.Race and LockRace to Faction and LockFaction

This commit is contained in:
penev92
2015-07-05 23:08:49 +03:00
parent b4c1625f1c
commit 1d49c23af0
14 changed files with 26 additions and 26 deletions

View File

@@ -37,7 +37,7 @@ namespace OpenRA
"Neutral", new PlayerReference "Neutral", new PlayerReference
{ {
Name = "Neutral", Name = "Neutral",
Race = firstRace, Faction = firstRace,
OwnsWorld = true, OwnsWorld = true,
NonCombatant = true NonCombatant = true
} }
@@ -46,7 +46,7 @@ namespace OpenRA
"Creeps", new PlayerReference "Creeps", new PlayerReference
{ {
Name = "Creeps", Name = "Creeps",
Race = firstRace, Faction = firstRace,
NonCombatant = true, NonCombatant = true,
Enemies = Exts.MakeArray(playerCount, i => "Multi{0}".F(i)) Enemies = Exts.MakeArray(playerCount, i => "Multi{0}".F(i))
} }
@@ -58,7 +58,7 @@ namespace OpenRA
var p = new PlayerReference var p = new PlayerReference
{ {
Name = "Multi{0}".F(index), Name = "Multi{0}".F(index),
Race = "Random", Faction = "Random",
Playable = true, Playable = true,
Enemies = new[] { "Creeps" } Enemies = new[] { "Creeps" }
}; };

View File

@@ -16,17 +16,17 @@ namespace OpenRA
{ {
public string Name; public string Name;
public string Palette; public string Palette;
public bool OwnsWorld = false;
public bool NonCombatant = false;
public bool Playable = false;
public bool Spectating = false;
public string Bot = null; public string Bot = null;
public string StartingUnitsClass = null; public string StartingUnitsClass = null;
public bool AllowBots = true; public bool AllowBots = true;
public bool Playable = false;
public bool Required = false; public bool Required = false;
public bool OwnsWorld = false;
public bool Spectating = false;
public bool NonCombatant = false;
public bool LockRace = false; public bool LockFaction = false;
public string Race; public string Faction;
// ColorRamp naming retained for backward compatibility // ColorRamp naming retained for backward compatibility
public bool LockColor = false; public bool LockColor = false;

View File

@@ -95,7 +95,7 @@ namespace OpenRA
Color = client.Color; Color = client.Color;
PlayerName = client.Name; PlayerName = client.Name;
botType = client.Bot; botType = client.Bot;
Country = ChooseCountry(world, client.Race, !pr.LockRace); Country = ChooseCountry(world, client.Race, !pr.LockFaction);
DisplayCountry = ChooseDisplayCountry(world, client.Race); DisplayCountry = ChooseDisplayCountry(world, client.Race);
} }
else else
@@ -108,8 +108,8 @@ namespace OpenRA
Playable = pr.Playable; Playable = pr.Playable;
Spectating = pr.Spectating; Spectating = pr.Spectating;
botType = pr.Bot; botType = pr.Bot;
Country = ChooseCountry(world, pr.Race, false); Country = ChooseCountry(world, pr.Faction, false);
DisplayCountry = ChooseDisplayCountry(world, pr.Race); DisplayCountry = ChooseDisplayCountry(world, pr.Faction);
} }
PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) }); PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) });

View File

@@ -72,8 +72,8 @@ namespace OpenRA.Server
if (pr == null) if (pr == null)
return; return;
if (pr.LockRace) if (pr.LockFaction)
c.Race = pr.Race; c.Race = pr.Faction;
if (pr.LockSpawn) if (pr.LockSpawn)
c.SpawnPoint = pr.Spawn; c.SpawnPoint = pr.Spawn;
if (pr.LockTeam) if (pr.LockTeam)

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Widgets
td.Add(new FacingInit(facing)); td.Add(new FacingInit(facing));
td.Add(new TurretFacingInit(facing)); td.Add(new TurretFacingInit(facing));
td.Add(new OwnerInit(owner.Name)); td.Add(new OwnerInit(owner.Name));
td.Add(new RaceInit(owner.Race)); td.Add(new RaceInit(owner.Faction));
preview.SetPreview(actor, td); preview.SetPreview(actor, td);
var ios = actor.Traits.GetOrDefault<IOccupySpaceInfo>(); var ios = actor.Traits.GetOrDefault<IOccupySpaceInfo>();

View File

@@ -40,8 +40,8 @@ namespace OpenRA.Mods.Common.Lint
var races = worldActor.Traits.WithInterface<CountryInfo>().Select(c => c.Race); var races = worldActor.Traits.WithInterface<CountryInfo>().Select(c => c.Race);
foreach (var player in players.Values) foreach (var player in players.Values)
if (!string.IsNullOrWhiteSpace(player.Race) && !races.Contains(player.Race)) if (!string.IsNullOrWhiteSpace(player.Faction) && !races.Contains(player.Faction))
emitError("Invalid race {0} chosen for player {1}.".F(player.Race, 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>())
{ {

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
public HSLColor Color { get { return Player.Color; } } public HSLColor Color { get { return Player.Color; } }
[Desc("The player's race.")] [Desc("The player's race.")]
public string Race { get { return Player.PlayerReference.Race; } } public string Race { get { return Player.PlayerReference.Faction; } }
[Desc("The player's spawnpoint ID.")] [Desc("The player's spawnpoint ID.")]
public int Spawn { get { return Player.SpawnPoint; } } public int Spawn { get { return Player.SpawnPoint; } }

View File

@@ -897,7 +897,7 @@ namespace OpenRA.Mods.Common.Server
PlayerReference = pr.Name, PlayerReference = pr.Name,
Closed = false, Closed = false,
AllowBots = pr.AllowBots, AllowBots = pr.AllowBots,
LockRace = pr.LockRace, LockRace = pr.LockFaction,
LockColor = pr.LockColor, LockColor = pr.LockColor,
LockTeam = pr.LockTeam, LockTeam = pr.LockTeam,
LockSpawn = pr.LockSpawn, LockSpawn = pr.LockSpawn,

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
Name = "Everyone", Name = "Everyone",
NonCombatant = true, NonCombatant = true,
Spectating = true, Spectating = true,
Race = "Random", Faction = "Random",
Allies = w.Players.Where(p => !p.NonCombatant && p.Playable).Select(p => p.InternalName).ToArray() Allies = w.Players.Where(p => !p.NonCombatant && p.Playable).Select(p => p.InternalName).ToArray()
})); }));

View File

@@ -178,7 +178,7 @@ namespace OpenRA.Mods.Common.Traits
var pr = new PlayerReference var pr = new PlayerReference
{ {
Name = "Multi{0}".F(index), Name = "Multi{0}".F(index),
Race = "Random", Faction = "Random",
Playable = true, Playable = true,
Enemies = new[] { "Creeps" } Enemies = new[] { "Creeps" }
}; };

View File

@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Traits
this.worldRenderer = worldRenderer; this.worldRenderer = worldRenderer;
if (!actor.InitDict.Contains<RaceInit>()) if (!actor.InitDict.Contains<RaceInit>())
actor.InitDict.Add(new RaceInit(owner.Race)); actor.InitDict.Add(new RaceInit(owner.Faction));
if (!actor.InitDict.Contains<OwnerInit>()) if (!actor.InitDict.Contains<OwnerInit>())
actor.InitDict.Add(new OwnerInit(owner.Name)); actor.InitDict.Add(new OwnerInit(owner.Name));
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
Func<object, bool> saveInit = init => Func<object, bool> saveInit = init =>
{ {
var race = init as RaceInit; var race = init as RaceInit;
if (race != null && race.Race == Owner.Race) if (race != null && race.Race == Owner.Faction)
return false; return false;
// TODO: Other default values will need to be filtered // TODO: Other default values will need to be filtered

View File

@@ -500,7 +500,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Name = section, Name = section,
OwnsWorld = section == "Neutral", OwnsWorld = section == "Neutral",
NonCombatant = section == "Neutral", NonCombatant = section == "Neutral",
Race = race, Faction = race,
Color = namedColorMapping[c] Color = namedColorMapping[c]
}; };

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var td = new TypeDictionary(); var td = new TypeDictionary();
td.Add(new HideBibPreviewInit()); td.Add(new HideBibPreviewInit());
td.Add(new OwnerInit(world.WorldActor.Owner)); td.Add(new OwnerInit(world.WorldActor.Owner));
td.Add(new RaceInit(world.WorldActor.Owner.PlayerReference.Race)); td.Add(new RaceInit(world.WorldActor.Owner.PlayerReference.Faction));
if (preview != null) if (preview != null)
preview.SetPreview(actor, td); preview.SetPreview(actor, td);

View File

@@ -112,7 +112,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
td.Add(new TurretFacingInit(92)); td.Add(new TurretFacingInit(92));
td.Add(new HideBibPreviewInit()); td.Add(new HideBibPreviewInit());
td.Add(new OwnerInit(selectedOwner.Name)); td.Add(new OwnerInit(selectedOwner.Name));
td.Add(new RaceInit(selectedOwner.Race)); td.Add(new RaceInit(selectedOwner.Faction));
try try
{ {