Add ability to override CannotPlaceNotification per queue.
This commit is contained in:
committed by
abcdefg30
parent
a6cb20a4ec
commit
b54a724aea
@@ -166,6 +166,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
var owner = Queue.Actor.Owner;
|
var owner = Queue.Actor.Owner;
|
||||||
var ai = variants[variant].ActorInfo;
|
var ai = variants[variant].ActorInfo;
|
||||||
var bi = variants[variant].BuildingInfo;
|
var bi = variants[variant].BuildingInfo;
|
||||||
|
var notification = Queue.Info.CannotPlaceAudio ?? placeBuildingInfo.CannotPlaceNotification;
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Left)
|
if (mi.Button == MouseButton.Left)
|
||||||
{
|
{
|
||||||
@@ -178,7 +179,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
orderType = "PlacePlug";
|
orderType = "PlacePlug";
|
||||||
if (!AcceptsPlug(topLeft, plugInfo))
|
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;
|
yield break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,7 +191,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
foreach (var order in ClearBlockersOrders(world, topLeft))
|
foreach (var order in ClearBlockersOrders(world, topLeft))
|
||||||
yield return order;
|
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;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
"The filename of the audio is defined per faction in notifications.yaml.")]
|
"The filename of the audio is defined per faction in notifications.yaml.")]
|
||||||
public readonly string LimitedAudio = null;
|
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")]
|
[NotificationReference("Speech")]
|
||||||
[Desc("Notification played when user clicks on the build palette icon.",
|
[Desc("Notification played when user clicks on the build palette icon.",
|
||||||
"The filename of the audio is defined per faction in notifications.yaml.")]
|
"The filename of the audio is defined per faction in notifications.yaml.")]
|
||||||
|
|||||||
Reference in New Issue
Block a user