Add a "structure sold" notification.

This commit is contained in:
Matthias Mailänder
2021-01-12 22:46:03 +01:00
committed by abcdefg30
parent 3b768dacf5
commit 8f06b0a836
5 changed files with 10 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ namespace OpenRA.Mods.Common.Activities
if (showTicks && refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer)) if (showTicks && refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer))
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color, FloatingText.FormatCashTick(refund), 30))); self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color, FloatingText.FormatCashTick(refund), 30)));
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", sellableInfo.Notification, self.Owner.Faction.InternalName);
self.Dispose(); self.Dispose();
return false; return false;
} }

View File

@@ -26,6 +26,10 @@ namespace OpenRA.Mods.Common.Traits
[Desc("List of audio clips to play when the actor is being sold.")] [Desc("List of audio clips to play when the actor is being sold.")]
public readonly string[] SellSounds = { }; public readonly string[] SellSounds = { };
[NotificationReference("Speech")]
[Desc("The audio notification type to play.")]
public string Notification = null;
[Desc("Whether to show the cash tick indicators rising from the actor.")] [Desc("Whether to show the cash tick indicators rising from the actor.")]
public readonly bool ShowTicks = true; public readonly bool ShowTicks = true;

View File

@@ -456,6 +456,7 @@
Sellable: Sellable:
RequiresCondition: !build-incomplete && !being-demolished RequiresCondition: !build-incomplete && !being-demolished
SellSounds: BUILD1.WAV SellSounds: BUILD1.WAV
Notification: StructureSold
Guardable: Guardable:
Range: 3c0 Range: 3c0
ThrowsShrapnel: ThrowsShrapnel:
@@ -499,6 +500,7 @@
Sequence: invisible Sequence: invisible
Sellable: Sellable:
RequiresCondition: !being-demolished RequiresCondition: !being-demolished
Notification: StructureSold
WithWallSpriteBody: WithWallSpriteBody:
RequiresCondition: !build-incomplete RequiresCondition: !build-incomplete
LineBuildNode: LineBuildNode:

View File

@@ -712,6 +712,7 @@
Sellable: Sellable:
RequiresCondition: !build-incomplete && !being-captured && !being-demolished RequiresCondition: !build-incomplete && !being-captured && !being-demolished
SellSounds: cashturn.aud SellSounds: cashturn.aud
Notification: StructureSold
WithBuildingRepairDecoration: WithBuildingRepairDecoration:
Image: allyrepair Image: allyrepair
Sequence: repair Sequence: repair

View File

@@ -390,6 +390,7 @@
Sellable: Sellable:
RequiresCondition: !build-incomplete && !being-demolished RequiresCondition: !build-incomplete && !being-demolished
SellSounds: cashturn.aud SellSounds: cashturn.aud
Notification: StructureSold
WithMakeAnimation: WithMakeAnimation:
Condition: build-incomplete Condition: build-incomplete
ThrowsShrapnel@SMALL: ThrowsShrapnel@SMALL: