Expose player names to localization.
This commit is contained in:
committed by
Gustas
parent
9a46f3053a
commit
4e5556dccc
@@ -83,14 +83,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (powerDecision == null)
|
||||
{
|
||||
AIUtils.BotDebug("{0} couldn't find powerDecision for {1}", player.PlayerName, sp.Info.OrderName);
|
||||
AIUtils.BotDebug($"{player.ResolvedPlayerName} couldn't find powerDecision for {sp.Info.OrderName}");
|
||||
continue;
|
||||
}
|
||||
|
||||
var attackLocation = FindCoarseAttackLocationToSupportPower(sp);
|
||||
if (attackLocation == null)
|
||||
{
|
||||
AIUtils.BotDebug("{0} can't find suitable coarse attack location for support power {1}. Delaying rescan.", player.PlayerName, sp.Info.OrderName);
|
||||
AIUtils.BotDebug($"{player.ResolvedPlayerName} can't find suitable coarse attack location for support power {sp.Info.OrderName}. Delaying rescan.");
|
||||
waitingPowers[sp] += powerDecision.GetNextScanTime(world);
|
||||
|
||||
continue;
|
||||
@@ -100,14 +100,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
attackLocation = FindFineAttackLocationToSupportPower(sp, (CPos)attackLocation);
|
||||
if (attackLocation == null)
|
||||
{
|
||||
AIUtils.BotDebug("{0} can't find suitable final attack location for support power {1}. Delaying rescan.", player.PlayerName, sp.Info.OrderName);
|
||||
AIUtils.BotDebug($"{player.ResolvedPlayerName} can't find suitable final attack location for support power {sp.Info.OrderName}. Delaying rescan.");
|
||||
waitingPowers[sp] += powerDecision.GetNextScanTime(world);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Valid target found, delay by a few ticks to avoid rescanning before power fires via order
|
||||
AIUtils.BotDebug("{0} found new target location {1} for support power {2}.", player.PlayerName, attackLocation, sp.Info.OrderName);
|
||||
AIUtils.BotDebug($"{player.ResolvedPlayerName} found new target location {attackLocation} for support power {sp.Info.OrderName}.");
|
||||
waitingPowers[sp] += 10;
|
||||
|
||||
// Note: SelectDirectionalTarget uses uint.MaxValue in ExtraData to indicate that the player did not pick a direction.
|
||||
@@ -131,7 +131,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var powerDecision = powerDecisions[readyPower.Info.OrderName];
|
||||
if (powerDecision == null)
|
||||
{
|
||||
AIUtils.BotDebug("{0} couldn't find powerDecision for {1}", player.PlayerName, readyPower.Info.OrderName);
|
||||
AIUtils.BotDebug($"{player.ResolvedPlayerName} couldn't find powerDecision for {readyPower.Info.OrderName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var powerDecision = powerDecisions[readyPower.Info.OrderName];
|
||||
if (powerDecision == null)
|
||||
{
|
||||
AIUtils.BotDebug("{0} couldn't find powerDecision for {1}", player.PlayerName, readyPower.Info.OrderName);
|
||||
AIUtils.BotDebug($"{player.ResolvedPlayerName} couldn't find powerDecision for {readyPower.Info.OrderName}");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (info.SuppressNotifications)
|
||||
return;
|
||||
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsDefeated, Translation.Arguments("player", player.PlayerName));
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsDefeated, Translation.Arguments("player", player.ResolvedPlayerName));
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (info.SuppressNotifications)
|
||||
return;
|
||||
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsVictorious, Translation.Arguments("player", player.PlayerName));
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsVictorious, Translation.Arguments("player", player.ResolvedPlayerName));
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return;
|
||||
}
|
||||
|
||||
var arguments = Translation.Arguments("cheat", order.OrderString, "player", self.Owner.PlayerName, "suffix", debugSuffix);
|
||||
var arguments = Translation.Arguments("cheat", order.OrderString, "player", self.Owner.ResolvedPlayerName, "suffix", debugSuffix);
|
||||
TextNotificationsManager.Debug(TranslationProvider.GetString(CheatUsed, arguments));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Internal id for this bot.")]
|
||||
public readonly string Type = null;
|
||||
|
||||
[TranslationReference]
|
||||
[Desc("Human-readable name this bot uses.")]
|
||||
public readonly string Name = "Unnamed Bot";
|
||||
public readonly string Name = null;
|
||||
|
||||
[Desc("Minimum portion of pending orders to issue each tick (e.g. 5 issues at least 1/5th of all pending orders). " +
|
||||
"Excess orders remain queued for subsequent ticks.")]
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (info.SuppressNotifications)
|
||||
return;
|
||||
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsDefeated, Translation.Arguments("player", player.PlayerName));
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsDefeated, Translation.Arguments("player", player.ResolvedPlayerName));
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
@@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (info.SuppressNotifications)
|
||||
return;
|
||||
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsVictorious, Translation.Arguments("player", player.PlayerName));
|
||||
TextNotificationsManager.AddSystemLine(PlayerIsVictorious, Translation.Arguments("player", player.ResolvedPlayerName));
|
||||
Game.RunAfterDelay(info.NotificationDelay, () =>
|
||||
{
|
||||
if (Game.IsCurrentWorld(player.World) && player == player.World.LocalPlayer)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
font = Game.Renderer.Fonts[info.Font];
|
||||
this.info = info;
|
||||
|
||||
name = self.Owner.PlayerName;
|
||||
name = self.Owner.ResolvedPlayerName;
|
||||
if (name.Length > info.MaxLength)
|
||||
name = name[..info.MaxLength];
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
|
||||
{
|
||||
name = self.Owner.PlayerName;
|
||||
name = self.Owner.ResolvedPlayerName;
|
||||
if (name.Length > Info.MaxLength)
|
||||
name = name[..Info.MaxLength];
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var player = new GameInformation.Player
|
||||
{
|
||||
ClientIndex = client.Index,
|
||||
Name = Player.ResolvePlayerName(client, lobbyInfo.Clients, bots),
|
||||
Name = client.Name,
|
||||
IsHuman = client.Bot == null,
|
||||
IsBot = client.Bot != null,
|
||||
FactionName = resolvedFaction.Name,
|
||||
|
||||
@@ -30,7 +30,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
if (subjectClient == null)
|
||||
{
|
||||
Log.Write("debug", $"Tick {world.WorldTick}: Order sent to {order.Subject.Owner.PlayerName}: resolved ClientIndex `{subjectClientId}` doesn't exist");
|
||||
Log.Write("debug", $"Tick {world.WorldTick}: " +
|
||||
$"Order sent to {order.Subject.Owner.ResolvedPlayerName}: " +
|
||||
$"resolved ClientIndex `{subjectClientId}` doesn't exist");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user