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

View File

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

View File

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

View File

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

View File

@@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Widgets
td.Add(new FacingInit(facing));
td.Add(new TurretFacingInit(facing));
td.Add(new OwnerInit(owner.Name));
td.Add(new RaceInit(owner.Race));
td.Add(new RaceInit(owner.Faction));
preview.SetPreview(actor, td);
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);
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));
if (!string.IsNullOrWhiteSpace(player.Faction) && !races.Contains(player.Faction))
emitError("Invalid race {0} chosen for player {1}.".F(player.Faction, player.Name));
if (worldActor.Traits.Contains<MPStartLocationsInfo>())
{

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
public HSLColor Color { get { return Player.Color; } }
[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.")]
public int Spawn { get { return Player.SpawnPoint; } }

View File

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

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
Name = "Everyone",
NonCombatant = true,
Spectating = true,
Race = "Random",
Faction = "Random",
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
{
Name = "Multi{0}".F(index),
Race = "Random",
Faction = "Random",
Playable = true,
Enemies = new[] { "Creeps" }
};

View File

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

View File

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

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var td = new TypeDictionary();
td.Add(new HideBibPreviewInit());
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)
preview.SetPreview(actor, td);

View File

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