diff --git a/OpenRA.Mods.Common/Activities/Transform.cs b/OpenRA.Mods.Common/Activities/Transform.cs index cbe0e146e5..961ae74892 100644 --- a/OpenRA.Mods.Common/Activities/Transform.cs +++ b/OpenRA.Mods.Common/Activities/Transform.cs @@ -22,6 +22,7 @@ namespace OpenRA.Mods.Common.Activities public CVec Offset = CVec.Zero; public int Facing = 96; public string[] Sounds = { }; + public string Notification = null; public int ForceHealthPercentage = 0; public bool SkipMakeAnims = false; public string Race = null; @@ -51,6 +52,8 @@ namespace OpenRA.Mods.Common.Activities foreach (var s in Sounds) Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); + Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Country.Race); + var init = new TypeDictionary { new LocationInit(self.Location + Offset), diff --git a/OpenRA.Mods.Common/Traits/Transforms.cs b/OpenRA.Mods.Common/Traits/Transforms.cs index f30ed50368..7a2e205884 100644 --- a/OpenRA.Mods.Common/Traits/Transforms.cs +++ b/OpenRA.Mods.Common/Traits/Transforms.cs @@ -24,6 +24,12 @@ namespace OpenRA.Mods.Common.Traits public readonly string[] TransformSounds = { }; public readonly string[] NoTransformSounds = { }; + [Desc("Notification to play when transforming.")] + public readonly string TransformNotification = null; + + [Desc("Notification to play when the transformation is blocked.")] + public readonly string NoTransformNotification = null; + public virtual object Create(ActorInitializer init) { return new Transforms(init, this); } } @@ -78,6 +84,8 @@ namespace OpenRA.Mods.Common.Traits foreach (var s in info.NoTransformSounds) Sound.PlayToPlayer(self.Owner, s); + Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NoTransformNotification, self.Owner.Country.Race); + return; } @@ -90,7 +98,15 @@ namespace OpenRA.Mods.Common.Traits foreach (var nt in self.TraitsImplementing()) nt.BeforeTransform(self); - var transform = new Transform(self, info.IntoActor) { Offset = info.Offset, Facing = info.Facing, Sounds = info.TransformSounds, Race = race }; + var transform = new Transform(self, info.IntoActor) + { + Offset = info.Offset, + Facing = info.Facing, + Sounds = info.TransformSounds, + Notification = info.TransformNotification, + Race = race + }; + var makeAnimation = self.TraitOrDefault(); if (makeAnimation != null) makeAnimation.Reverse(self, transform); diff --git a/mods/cnc/rules/vehicles.yaml b/mods/cnc/rules/vehicles.yaml index 26a9a9e4ca..9b66b860b8 100644 --- a/mods/cnc/rules/vehicles.yaml +++ b/mods/cnc/rules/vehicles.yaml @@ -25,7 +25,7 @@ MCV: Offset: -1,-1 Facing: 108 TransformSounds: constru2.aud, hvydoor1.aud - NoTransformSounds: deploy1.aud + NoTransformNotification: BuildingCannotPlaceAudio RenderUnit: MustBeDestroyed: RequiredForShortGame: true diff --git a/mods/d2k/audio/notifications.yaml b/mods/d2k/audio/notifications.yaml index 4fec334269..0a30b8e89e 100644 --- a/mods/d2k/audio/notifications.yaml +++ b/mods/d2k/audio/notifications.yaml @@ -35,6 +35,7 @@ Speech: WormAttack: WATTK EnemyUnitsApproaching: ENEMY UnitRepaired: GANEW + CannotDeploy: DPLOY Sounds: DefaultVariant: .WAV diff --git a/mods/d2k/rules/atreides.yaml b/mods/d2k/rules/atreides.yaml index 65503c77e3..2a496cadc7 100644 --- a/mods/d2k/rules/atreides.yaml +++ b/mods/d2k/rules/atreides.yaml @@ -104,10 +104,7 @@ MCVA: Buildable: Prerequisites: ~heavya, repair Transforms: - Facing: 16 IntoActor: conyarda - Offset: -1,-1 - NoTransformSounds: AI_DPLOY.AUD RenderUnit: Image: DMCV diff --git a/mods/d2k/rules/harkonnen.yaml b/mods/d2k/rules/harkonnen.yaml index 1345418b10..02be8709bb 100644 --- a/mods/d2k/rules/harkonnen.yaml +++ b/mods/d2k/rules/harkonnen.yaml @@ -107,10 +107,7 @@ MCVH: Buildable: Prerequisites: ~heavyh, repair Transforms: - Facing: 16 IntoActor: conyardh - Offset: -1,-1 - NoTransformSounds: HI_DPLOY.AUD RenderUnit: Image: DMCV diff --git a/mods/d2k/rules/ordos.yaml b/mods/d2k/rules/ordos.yaml index 180742093a..1a2fb0e8c5 100644 --- a/mods/d2k/rules/ordos.yaml +++ b/mods/d2k/rules/ordos.yaml @@ -100,10 +100,7 @@ MCVO: Buildable: Prerequisites: ~heavyo, repair Transforms: - Facing: 16 IntoActor: conyardo - Offset: -1,-1 - NoTransformSounds: OI_DPLOY.AUD RenderUnit: Image: DMCV diff --git a/mods/d2k/rules/vehicles.yaml b/mods/d2k/rules/vehicles.yaml index 58b1c67755..99bbed13dd 100644 --- a/mods/d2k/rules/vehicles.yaml +++ b/mods/d2k/rules/vehicles.yaml @@ -28,7 +28,10 @@ Weapon: UnitExplodeScale EmptyWeapon: UnitExplodeScale Transforms: + Facing: 16 + Offset: -1,-1 TransformSounds: BUILD1.WAV + NoTransformNotification: CannotDeploy LeavesHusk: HuskActor: MCV.Husk AttractsWorms: diff --git a/mods/ra/rules/vehicles.yaml b/mods/ra/rules/vehicles.yaml index 51344d9fef..5f4132dc20 100644 --- a/mods/ra/rules/vehicles.yaml +++ b/mods/ra/rules/vehicles.yaml @@ -308,7 +308,7 @@ MCV: Offset: -1,-1 Facing: 96 TransformSounds: placbldg.aud, build5.aud - NoTransformSounds: nodeply1.aud + NoTransformNotification: BuildingCannotPlaceAudio RenderUnit: MustBeDestroyed: RequiredForShortGame: true