Rename the Country trait to Faction
This commit is contained in:
@@ -29,7 +29,7 @@ namespace OpenRA
|
||||
public MapPlayers(Ruleset rules, int playerCount)
|
||||
{
|
||||
var firstRace = rules.Actors["world"].Traits
|
||||
.WithInterface<CountryInfo>().First(c => c.Selectable).Race;
|
||||
.WithInterface<FactionInfo>().First(f => f.Selectable).Race;
|
||||
|
||||
Players = new Dictionary<string, PlayerReference>
|
||||
{
|
||||
|
||||
@@ -181,8 +181,8 @@
|
||||
<Compile Include="Traits\TraitsInterfaces.cs" />
|
||||
<Compile Include="Traits\Util.cs" />
|
||||
<Compile Include="Traits\ValidateOrder.cs" />
|
||||
<Compile Include="Traits\World\Country.cs" />
|
||||
<Compile Include="Traits\World\MusicPlaylist.cs" />
|
||||
<Compile Include="Traits\World\Faction.cs" />
|
||||
<Compile Include="Traits\World\ResourceType.cs" />
|
||||
<Compile Include="Traits\World\ScreenShaker.cs" />
|
||||
<Compile Include="Traits\World\Shroud.cs" />
|
||||
|
||||
@@ -31,14 +31,14 @@ namespace OpenRA
|
||||
|
||||
public readonly string PlayerName;
|
||||
public readonly string InternalName;
|
||||
public readonly CountryInfo Country;
|
||||
public readonly FactionInfo Country;
|
||||
public readonly bool NonCombatant = false;
|
||||
public readonly bool Playable = true;
|
||||
public readonly int ClientIndex;
|
||||
public readonly PlayerReference PlayerReference;
|
||||
|
||||
// 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 bool IsBot;
|
||||
@@ -51,20 +51,20 @@ namespace OpenRA
|
||||
|
||||
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
|
||||
.WithInterface<CountryInfo>().Where(c => !requireSelectable || c.Selectable)
|
||||
.WithInterface<FactionInfo>().Where(f => !requireSelectable || f.Selectable)
|
||||
.ToList();
|
||||
|
||||
var selected = selectableCountries.FirstOrDefault(c => c.Race == name)
|
||||
var selected = selectableCountries.FirstOrDefault(f => f.Race == name)
|
||||
?? selectableCountries.Random(world.SharedRandom);
|
||||
|
||||
// Don't loop infinite
|
||||
for (var i = 0; i <= 10 && selected.RandomRaceMembers.Any(); i++)
|
||||
{
|
||||
var race = selected.RandomRaceMembers.Random(world.SharedRandom);
|
||||
selected = selectableCountries.FirstOrDefault(c => c.Race == race);
|
||||
selected = selectableCountries.FirstOrDefault(f => f.Race == race);
|
||||
|
||||
if (selected == null)
|
||||
throw new YamlException("Unknown race: {0}".F(race));
|
||||
@@ -73,12 +73,12 @@ namespace OpenRA
|
||||
return selected;
|
||||
}
|
||||
|
||||
CountryInfo ChooseDisplayCountry(World world, string race)
|
||||
FactionInfo ChooseDisplayCountry(World world, string race)
|
||||
{
|
||||
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.Race == race) ?? countries.First();
|
||||
}
|
||||
|
||||
public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
[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.")]
|
||||
public readonly string Name = null;
|
||||
@@ -31,5 +31,5 @@ namespace OpenRA.Traits
|
||||
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 */ }
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
var worldActor = map.Rules.Actors["world"];
|
||||
|
||||
var races = worldActor.Traits.WithInterface<CountryInfo>().Select(c => c.Race);
|
||||
var races = worldActor.Traits.WithInterface<FactionInfo>().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));
|
||||
|
||||
@@ -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<CountryInfo>().Select(c => c.Race);
|
||||
var races = map.Rules.Actors["world"].Traits.WithInterface<FactionInfo>().Select(c => c.Race);
|
||||
|
||||
foreach (var actorInfo in map.Rules.Actors)
|
||||
{
|
||||
|
||||
@@ -144,8 +144,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
colorPreview = lobby.Get<ColorPreviewManagerWidget>("COLOR_MANAGER");
|
||||
colorPreview.Color = Game.Settings.Player.Color;
|
||||
|
||||
foreach (var c in modRules.Actors["world"].Traits.WithInterface<CountryInfo>())
|
||||
countries.Add(c.Race, new LobbyCountry { Selectable = c.Selectable, Name = c.Name, Side = c.Side, Description = c.Description });
|
||||
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 });
|
||||
|
||||
var gameStarting = false;
|
||||
Func<bool> configurationDisabled = () => !Game.IsHost || gameStarting ||
|
||||
|
||||
Reference in New Issue
Block a user