From de49ad6a797d5d1ab1f3d887f30e4de237d2df6b Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Fri, 25 Jul 2025 00:41:46 +0900 Subject: [PATCH] Notify player when an unbuildable item is cancelled. --- OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index fef175fece..1dfef57812 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -374,6 +374,7 @@ namespace OpenRA.Mods.Common.Traits // EndProduction removes the item from the queue, so we enumerate // by index in reverse to avoid issues with index reassignment + var cancelledAnItem = false; for (var i = Queue.Count - 1; i >= 0; i--) { if (buildableNames.Contains(Queue[i].Item)) @@ -389,6 +390,13 @@ namespace OpenRA.Mods.Common.Traits // Refund what's been paid so far playerResources.GiveCash(Queue[i].TotalCost - Queue[i].RemainingCost); EndProduction(Queue[i]); + cancelledAnItem = true; + } + + if (cancelledAnItem) + { + Game.Sound.PlayNotification(Actor.World.Map.Rules, Actor.Owner, "Speech", Info.CancelledAudio, Actor.Owner.Faction.InternalName); + TextNotificationsManager.AddTransientLine(Actor.Owner, Info.CancelledTextNotification); } }