Add support for transient text notifications matching speech notifications
This commit is contained in:
committed by
Paul Chote
parent
9f723be65a
commit
24b9482cc1
@@ -44,6 +44,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Speech notification to play when the player does not have any funds.")]
|
||||
public readonly string InsufficientFundsNotification = null;
|
||||
|
||||
[Desc("Text notification to display when the player does not have any funds.")]
|
||||
public readonly string InsufficientFundsTextNotification = null;
|
||||
|
||||
[Desc("Delay (in ticks) during which warnings will be muted.")]
|
||||
public readonly int InsufficientFundsNotificationInterval = 30000;
|
||||
|
||||
@@ -179,11 +182,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
if (Cash + Resources < num)
|
||||
{
|
||||
if (notifyLowFunds && !string.IsNullOrEmpty(Info.InsufficientFundsNotification) &&
|
||||
Game.RunTime > lastNotificationTime + Info.InsufficientFundsNotificationInterval)
|
||||
if (notifyLowFunds && Game.RunTime > lastNotificationTime + Info.InsufficientFundsNotificationInterval)
|
||||
{
|
||||
lastNotificationTime = Game.RunTime;
|
||||
Game.Sound.PlayNotification(owner.World.Map.Rules, owner, "Speech", Info.InsufficientFundsNotification, owner.Faction.InternalName);
|
||||
TextNotificationsManager.AddTransientLine(Info.InsufficientFundsTextNotification, owner);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user