Add Media.DisplayMessageToPlayer

This commit is contained in:
Matthias Mailänder
2022-10-21 16:10:46 +02:00
committed by abcdefg30
parent 847bbf5710
commit 867efcc6e8
2 changed files with 12 additions and 3 deletions

View File

@@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Scripting
return true;
}
[Desc("Display a text message to the player.")]
[Desc("Display a text message to all players.")]
public void DisplayMessage(string text, string prefix = "Mission", Color? color = null)
{
if (string.IsNullOrEmpty(text))
@@ -197,6 +197,15 @@ namespace OpenRA.Mods.Common.Scripting
TextNotificationsManager.AddMissionLine(prefix, text, c);
}
[Desc("Display a text message only to this player.")]
public void DisplayMessageToPlayer(Player player, string text, string prefix = "Mission", Color? color = null)
{
if (world.LocalPlayer != player)
return;
DisplayMessage(text, prefix, color);
}
[Desc("Display a system message to the player. If 'prefix' is nil the default system prefix is used.")]
public void DisplaySystemMessage(string text, string prefix = null)
{