Add ability to override CannotPlaceNotification per queue.

This commit is contained in:
Mustafa Alperen Seki
2022-03-04 17:50:36 +03:00
committed by abcdefg30
parent a6cb20a4ec
commit b54a724aea
2 changed files with 9 additions and 2 deletions

View File

@@ -166,6 +166,7 @@ namespace OpenRA.Mods.Common.Orders
var owner = Queue.Actor.Owner;
var ai = variants[variant].ActorInfo;
var bi = variants[variant].BuildingInfo;
var notification = Queue.Info.CannotPlaceAudio ?? placeBuildingInfo.CannotPlaceNotification;
if (mi.Button == MouseButton.Left)
{
@@ -178,7 +179,7 @@ namespace OpenRA.Mods.Common.Orders
orderType = "PlacePlug";
if (!AcceptsPlug(topLeft, plugInfo))
{
Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", placeBuildingInfo.CannotPlaceNotification, owner.Faction.InternalName);
Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", notification, owner.Faction.InternalName);
yield break;
}
}
@@ -190,7 +191,7 @@ namespace OpenRA.Mods.Common.Orders
foreach (var order in ClearBlockersOrders(world, topLeft))
yield return order;
Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", placeBuildingInfo.CannotPlaceNotification, owner.Faction.InternalName);
Game.Sound.PlayNotification(world.Map.Rules, owner, "Speech", notification, owner.Faction.InternalName);
yield break;
}

View File

@@ -73,6 +73,12 @@ namespace OpenRA.Mods.Common.Traits
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string LimitedAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when you can't place a building.",
"Overrides PlaceBuilding.CannotPlaceNotification for this queue.",
"The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string CannotPlaceAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when user clicks on the build palette icon.",
"The filename of the audio is defined per faction in notifications.yaml.")]