Merge pull request #8975 from penev92/bleed_rename
Some more renaming from "country" and "race" to "faction"
This commit is contained in:
@@ -37,7 +37,7 @@ namespace OpenRA
|
|||||||
public IEnumerable<Player> HumanPlayers { get { return Players.Where(p => p.IsHuman); } }
|
public IEnumerable<Player> HumanPlayers { get { return Players.Where(p => p.IsHuman); } }
|
||||||
public bool IsSinglePlayer { get { return HumanPlayers.Count() == 1; } }
|
public bool IsSinglePlayer { get { return HumanPlayers.Count() == 1; } }
|
||||||
|
|
||||||
Dictionary<OpenRA.Player, Player> playersByRuntime;
|
readonly Dictionary<OpenRA.Player, Player> playersByRuntime;
|
||||||
|
|
||||||
public GameInformation()
|
public GameInformation()
|
||||||
{
|
{
|
||||||
@@ -79,9 +79,10 @@ namespace OpenRA
|
|||||||
|
|
||||||
public string Serialize()
|
public string Serialize()
|
||||||
{
|
{
|
||||||
var nodes = new List<MiniYamlNode>();
|
var nodes = new List<MiniYamlNode>
|
||||||
|
{
|
||||||
nodes.Add(new MiniYamlNode("Root", FieldSaver.Save(this)));
|
new MiniYamlNode("Root", FieldSaver.Save(this))
|
||||||
|
};
|
||||||
|
|
||||||
for (var i = 0; i < Players.Count; i++)
|
for (var i = 0; i < Players.Count; i++)
|
||||||
nodes.Add(new MiniYamlNode("Player@{0}".F(i), FieldSaver.Save(Players[i])));
|
nodes.Add(new MiniYamlNode("Player@{0}".F(i), FieldSaver.Save(Players[i])));
|
||||||
@@ -118,7 +119,7 @@ namespace OpenRA
|
|||||||
Color = runtimePlayer.Color,
|
Color = runtimePlayer.Color,
|
||||||
Team = client.Team,
|
Team = client.Team,
|
||||||
SpawnPoint = runtimePlayer.SpawnPoint,
|
SpawnPoint = runtimePlayer.SpawnPoint,
|
||||||
IsRandomFaction = runtimePlayer.Faction.InternalName != client.Race,
|
IsRandomFaction = runtimePlayer.Faction.InternalName != client.Faction,
|
||||||
IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint
|
IsRandomSpawnPoint = runtimePlayer.SpawnPoint != client.SpawnPoint
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -102,13 +102,13 @@ namespace OpenRA.Network
|
|||||||
public int Index;
|
public int Index;
|
||||||
public HSLColor PreferredColor; // Color that the client normally uses from settings.yaml.
|
public HSLColor PreferredColor; // Color that the client normally uses from settings.yaml.
|
||||||
public HSLColor Color; // Actual color that the client is using. Usually the same as PreferredColor but can be different on maps with locked colors.
|
public HSLColor Color; // Actual color that the client is using. Usually the same as PreferredColor but can be different on maps with locked colors.
|
||||||
public string Race;
|
public string Faction;
|
||||||
public int SpawnPoint;
|
public int SpawnPoint;
|
||||||
public string Name;
|
public string Name;
|
||||||
public string IpAddress;
|
public string IpAddress;
|
||||||
public ClientState State = ClientState.Invalid;
|
public ClientState State = ClientState.Invalid;
|
||||||
public int Team;
|
public int Team;
|
||||||
public string Slot; // slot ID, or null for observer
|
public string Slot; // Slot ID, or null for observer
|
||||||
public string Bot; // Bot type, null for real clients
|
public string Bot; // Bot type, null for real clients
|
||||||
public int BotControllerClientIndex; // who added the bot to the slot
|
public int BotControllerClientIndex; // who added the bot to the slot
|
||||||
public bool IsAdmin;
|
public bool IsAdmin;
|
||||||
@@ -118,7 +118,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
public MiniYamlNode Serialize()
|
public MiniYamlNode Serialize()
|
||||||
{
|
{
|
||||||
return new MiniYamlNode("Client@{0}".F(this.Index), FieldSaver.Save(this));
|
return new MiniYamlNode("Client@{0}".F(Index), FieldSaver.Save(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,17 +141,17 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
public MiniYamlNode Serialize()
|
public MiniYamlNode Serialize()
|
||||||
{
|
{
|
||||||
return new MiniYamlNode("ClientPing@{0}".F(this.Index), FieldSaver.Save(this));
|
return new MiniYamlNode("ClientPing@{0}".F(Index), FieldSaver.Save(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Slot
|
public class Slot
|
||||||
{
|
{
|
||||||
public string PlayerReference; // playerReference to bind against.
|
public string PlayerReference; // PlayerReference to bind against.
|
||||||
public bool Closed; // host has explicitly closed this slot.
|
public bool Closed; // Host has explicitly closed this slot.
|
||||||
|
|
||||||
public bool AllowBots;
|
public bool AllowBots;
|
||||||
public bool LockRace;
|
public bool LockFaction;
|
||||||
public bool LockColor;
|
public bool LockColor;
|
||||||
public bool LockTeam;
|
public bool LockTeam;
|
||||||
public bool LockSpawn;
|
public bool LockSpawn;
|
||||||
@@ -164,7 +164,7 @@ namespace OpenRA.Network
|
|||||||
|
|
||||||
public MiniYamlNode Serialize()
|
public MiniYamlNode Serialize()
|
||||||
{
|
{
|
||||||
return new MiniYamlNode("Slot@{0}".F(this.PlayerReference), FieldSaver.Save(this));
|
return new MiniYamlNode("Slot@{0}".F(PlayerReference), FieldSaver.Save(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace OpenRA.Network
|
|||||||
Name = Game.Settings.Player.Name,
|
Name = Game.Settings.Player.Name,
|
||||||
PreferredColor = Game.Settings.Player.Color,
|
PreferredColor = Game.Settings.Player.Color,
|
||||||
Color = Game.Settings.Player.Color,
|
Color = Game.Settings.Player.Color,
|
||||||
Race = "Random",
|
Faction = "Random",
|
||||||
SpawnPoint = 0,
|
SpawnPoint = 0,
|
||||||
Team = 0,
|
Team = 0,
|
||||||
State = Session.ClientState.Invalid
|
State = Session.ClientState.Invalid
|
||||||
|
|||||||
@@ -95,8 +95,8 @@ namespace OpenRA
|
|||||||
Color = client.Color;
|
Color = client.Color;
|
||||||
PlayerName = client.Name;
|
PlayerName = client.Name;
|
||||||
botType = client.Bot;
|
botType = client.Bot;
|
||||||
Faction = ChooseFaction(world, client.Race, !pr.LockFaction);
|
Faction = ChooseFaction(world, client.Faction, !pr.LockFaction);
|
||||||
DisplayFaction = ChooseDisplayFaction(world, client.Race);
|
DisplayFaction = ChooseDisplayFaction(world, client.Faction);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace OpenRA.Server
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (pr.LockFaction)
|
if (pr.LockFaction)
|
||||||
c.Race = pr.Faction;
|
c.Faction = pr.Faction;
|
||||||
if (pr.LockSpawn)
|
if (pr.LockSpawn)
|
||||||
c.SpawnPoint = pr.Spawn;
|
c.SpawnPoint = pr.Spawn;
|
||||||
if (pr.LockTeam)
|
if (pr.LockTeam)
|
||||||
@@ -308,7 +308,7 @@ namespace OpenRA.Server
|
|||||||
Slot = LobbyInfo.FirstEmptySlot(),
|
Slot = LobbyInfo.FirstEmptySlot(),
|
||||||
PreferredColor = handshake.Client.Color,
|
PreferredColor = handshake.Client.Color,
|
||||||
Color = handshake.Client.Color,
|
Color = handshake.Client.Color,
|
||||||
Race = "Random",
|
Faction = "Random",
|
||||||
SpawnPoint = 0,
|
SpawnPoint = 0,
|
||||||
Team = 0,
|
Team = 0,
|
||||||
State = Session.ClientState.Invalid,
|
State = Session.ClientState.Invalid,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
public string Notification = null;
|
public string Notification = null;
|
||||||
public int ForceHealthPercentage = 0;
|
public int ForceHealthPercentage = 0;
|
||||||
public bool SkipMakeAnims = false;
|
public bool SkipMakeAnims = false;
|
||||||
public string Race = null;
|
public string Faction = null;
|
||||||
|
|
||||||
public Transform(Actor self, string toActor)
|
public Transform(Actor self, string toActor)
|
||||||
{
|
{
|
||||||
@@ -64,8 +64,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (SkipMakeAnims)
|
if (SkipMakeAnims)
|
||||||
init.Add(new SkipMakeAnimsInit());
|
init.Add(new SkipMakeAnimsInit());
|
||||||
|
|
||||||
if (Race != null)
|
if (Faction != null)
|
||||||
init.Add(new FactionInit(Race));
|
init.Add(new FactionInit(Faction));
|
||||||
|
|
||||||
var health = self.TraitOrDefault<Health>();
|
var health = self.TraitOrDefault<Health>();
|
||||||
if (health != null)
|
if (health != null)
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
Name = botType,
|
Name = botType,
|
||||||
Bot = botType,
|
Bot = botType,
|
||||||
Slot = parts[0],
|
Slot = parts[0],
|
||||||
Race = "Random",
|
Faction = "Random",
|
||||||
SpawnPoint = 0,
|
SpawnPoint = 0,
|
||||||
Team = 0,
|
Team = 0,
|
||||||
State = Session.ClientState.NotReady,
|
State = Session.ClientState.NotReady,
|
||||||
@@ -749,10 +749,10 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Map has disabled race changes
|
// Map has disabled race changes
|
||||||
if (server.LobbyInfo.Slots[targetClient.Slot].LockRace)
|
if (server.LobbyInfo.Slots[targetClient.Slot].LockFaction)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
targetClient.Race = parts[1];
|
targetClient.Faction = parts[1];
|
||||||
server.SyncLobbyClients();
|
server.SyncLobbyClients();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -900,7 +900,7 @@ namespace OpenRA.Mods.Common.Server
|
|||||||
PlayerReference = pr.Name,
|
PlayerReference = pr.Name,
|
||||||
Closed = false,
|
Closed = false,
|
||||||
AllowBots = pr.AllowBots,
|
AllowBots = pr.AllowBots,
|
||||||
LockRace = pr.LockFaction,
|
LockFaction = pr.LockFaction,
|
||||||
LockColor = pr.LockColor,
|
LockColor = pr.LockColor,
|
||||||
LockTeam = pr.LockTeam,
|
LockTeam = pr.LockTeam,
|
||||||
LockSpawn = pr.LockSpawn,
|
LockSpawn = pr.LockSpawn,
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
readonly TransformsInfo info;
|
readonly TransformsInfo info;
|
||||||
readonly BuildingInfo buildingInfo;
|
readonly BuildingInfo buildingInfo;
|
||||||
readonly string race;
|
readonly string faction;
|
||||||
|
|
||||||
public Transforms(ActorInitializer init, TransformsInfo info)
|
public Transforms(ActorInitializer init, TransformsInfo info)
|
||||||
{
|
{
|
||||||
self = init.Self;
|
self = init.Self;
|
||||||
this.info = info;
|
this.info = info;
|
||||||
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
buildingInfo = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
|
||||||
race = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
faction = init.Contains<FactionInit>() ? init.Get<FactionInit, string>() : self.Owner.Faction.InternalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Facing = info.Facing,
|
Facing = info.Facing,
|
||||||
Sounds = info.TransformSounds,
|
Sounds = info.TransformSounds,
|
||||||
Notification = info.TransformNotification,
|
Notification = info.TransformNotification,
|
||||||
Race = race
|
Faction = faction
|
||||||
};
|
};
|
||||||
|
|
||||||
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
|
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
|
||||||
|
|||||||
@@ -104,19 +104,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
dropdown.ShowDropDown("SPAWN_DROPDOWN_TEMPLATE", 150, spawnPoints, setupItem);
|
dropdown.ShowDropDown("SPAWN_DROPDOWN_TEMPLATE", 150, spawnPoints, setupItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowRaceDropDown(DropDownButtonWidget dropdown, Session.Client client,
|
public static void ShowFactionDropDown(DropDownButtonWidget dropdown, Session.Client client,
|
||||||
OrderManager orderManager, Dictionary<string, LobbyFaction> factions)
|
OrderManager orderManager, Dictionary<string, LobbyFaction> factions)
|
||||||
{
|
{
|
||||||
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (race, itemTemplate) =>
|
Func<string, ScrollItemWidget, ScrollItemWidget> setupItem = (factionId, itemTemplate) =>
|
||||||
{
|
{
|
||||||
var item = ScrollItemWidget.Setup(itemTemplate,
|
var item = ScrollItemWidget.Setup(itemTemplate,
|
||||||
() => client.Race == race,
|
() => client.Faction == factionId,
|
||||||
() => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, race))));
|
() => orderManager.IssueOrder(Order.Command("race {0} {1}".F(client.Index, factionId))));
|
||||||
var faction = factions[race];
|
var faction = factions[factionId];
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => faction.Name;
|
item.Get<LabelWidget>("LABEL").GetText = () => faction.Name;
|
||||||
var flag = item.Get<ImageWidget>("FLAG");
|
var flag = item.Get<ImageWidget>("FLAG");
|
||||||
flag.GetImageCollection = () => "flags";
|
flag.GetImageCollection = () => "flags";
|
||||||
flag.GetImageName = () => race;
|
flag.GetImageName = () => factionId;
|
||||||
item.GetTooltipText = () => faction.Description;
|
item.GetTooltipText = () => faction.Description;
|
||||||
return item;
|
return item;
|
||||||
};
|
};
|
||||||
@@ -398,9 +398,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Dictionary<string, LobbyFaction> factions)
|
Dictionary<string, LobbyFaction> factions)
|
||||||
{
|
{
|
||||||
var dropdown = parent.Get<DropDownButtonWidget>("FACTION");
|
var dropdown = parent.Get<DropDownButtonWidget>("FACTION");
|
||||||
dropdown.IsDisabled = () => s.LockRace || orderManager.LocalClient.IsReady;
|
dropdown.IsDisabled = () => s.LockFaction || orderManager.LocalClient.IsReady;
|
||||||
dropdown.OnMouseDown = _ => ShowRaceDropDown(dropdown, c, orderManager, factions);
|
dropdown.OnMouseDown = _ => ShowFactionDropDown(dropdown, c, orderManager, factions);
|
||||||
var factionDescription = factions[c.Race].Description;
|
var factionDescription = factions[c.Faction].Description;
|
||||||
dropdown.GetTooltipText = () => factionDescription;
|
dropdown.GetTooltipText = () => factionDescription;
|
||||||
SetupFactionWidget(dropdown, s, c, factions);
|
SetupFactionWidget(dropdown, s, c, factions);
|
||||||
}
|
}
|
||||||
@@ -409,9 +409,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Dictionary<string, LobbyFaction> factions)
|
Dictionary<string, LobbyFaction> factions)
|
||||||
{
|
{
|
||||||
var factionName = parent.Get<LabelWidget>("FACTIONNAME");
|
var factionName = parent.Get<LabelWidget>("FACTIONNAME");
|
||||||
factionName.GetText = () => factions[c.Race].Name;
|
factionName.GetText = () => factions[c.Faction].Name;
|
||||||
var factionFlag = parent.Get<ImageWidget>("FACTIONFLAG");
|
var factionFlag = parent.Get<ImageWidget>("FACTIONFLAG");
|
||||||
factionFlag.GetImageName = () => c.Race;
|
factionFlag.GetImageName = () => c.Faction;
|
||||||
factionFlag.GetImageCollection = () => "flags";
|
factionFlag.GetImageCollection = () => "flags";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
var cachedWidth = 0;
|
var cachedWidth = 0;
|
||||||
var labelText = "";
|
var labelText = "";
|
||||||
string playerCountry = null;
|
string playerFaction = null;
|
||||||
var playerTeam = -1;
|
var playerTeam = -1;
|
||||||
|
|
||||||
tooltipContainer.BeforeRender = () =>
|
tooltipContainer.BeforeRender = () =>
|
||||||
@@ -44,20 +44,20 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (occupant == null)
|
if (occupant == null)
|
||||||
{
|
{
|
||||||
labelText = "Available spawn";
|
labelText = "Available spawn";
|
||||||
playerCountry = null;
|
playerFaction = null;
|
||||||
playerTeam = 0;
|
playerTeam = 0;
|
||||||
widget.Bounds.Height = singleHeight;
|
widget.Bounds.Height = singleHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
labelText = occupant.PlayerName;
|
labelText = occupant.PlayerName;
|
||||||
playerCountry = occupant.Country;
|
playerFaction = occupant.Faction;
|
||||||
playerTeam = occupant.Team;
|
playerTeam = occupant.Team;
|
||||||
widget.Bounds.Height = playerTeam > 0 ? doubleHeight : singleHeight;
|
widget.Bounds.Height = playerTeam > 0 ? doubleHeight : singleHeight;
|
||||||
teamWidth = teamFont.Measure(team.GetText()).X;
|
teamWidth = teamFont.Measure(team.GetText()).X;
|
||||||
}
|
}
|
||||||
|
|
||||||
label.Bounds.X = playerCountry != null ? flag.Bounds.Right + labelMargin : labelMargin;
|
label.Bounds.X = playerFaction != null ? flag.Bounds.Right + labelMargin : labelMargin;
|
||||||
|
|
||||||
var textWidth = ownerFont.Measure(labelText).X;
|
var textWidth = ownerFont.Measure(labelText).X;
|
||||||
if (textWidth != cachedWidth)
|
if (textWidth != cachedWidth)
|
||||||
@@ -71,9 +71,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
};
|
};
|
||||||
|
|
||||||
label.GetText = () => labelText;
|
label.GetText = () => labelText;
|
||||||
flag.IsVisible = () => playerCountry != null;
|
flag.IsVisible = () => playerFaction != null;
|
||||||
flag.GetImageCollection = () => "flags";
|
flag.GetImageCollection = () => "flags";
|
||||||
flag.GetImageName = () => playerCountry;
|
flag.GetImageName = () => playerFaction;
|
||||||
team.GetText = () => "Team {0}".F(playerTeam);
|
team.GetText = () => "Team {0}".F(playerTeam);
|
||||||
team.IsVisible = () => playerTeam > 0;
|
team.IsVisible = () => playerTeam > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public readonly int ClientIndex;
|
public readonly int ClientIndex;
|
||||||
public readonly string PlayerName;
|
public readonly string PlayerName;
|
||||||
public readonly int Team;
|
public readonly int Team;
|
||||||
public readonly string Country;
|
public readonly string Faction;
|
||||||
public readonly int SpawnPoint;
|
public readonly int SpawnPoint;
|
||||||
|
|
||||||
public SpawnOccupant(Session.Client client)
|
public SpawnOccupant(Session.Client client)
|
||||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
ClientIndex = client.Index;
|
ClientIndex = client.Index;
|
||||||
PlayerName = client.Name;
|
PlayerName = client.Name;
|
||||||
Team = client.Team;
|
Team = client.Team;
|
||||||
Country = client.Race;
|
Faction = client.Faction;
|
||||||
SpawnPoint = client.SpawnPoint;
|
SpawnPoint = client.SpawnPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
ClientIndex = player.ClientIndex;
|
ClientIndex = player.ClientIndex;
|
||||||
PlayerName = player.Name;
|
PlayerName = player.Name;
|
||||||
Team = player.Team;
|
Team = player.Team;
|
||||||
Country = player.FactionId;
|
Faction = player.FactionId;
|
||||||
SpawnPoint = player.SpawnPoint;
|
SpawnPoint = player.SpawnPoint;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user