diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index 64371e4803..4f219adc3f 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -8,6 +8,7 @@ */ #endregion +using System.Collections.Generic; using System.Drawing; using System.Linq; using OpenRA.Activities; @@ -89,21 +90,28 @@ namespace OpenRA.Mods.D2k.Activities } positionable.SetPosition(worm, targetLocation); - foreach (var notify in worm.TraitsImplementing()) - notify.Attacking(worm, target, null, null); - PlayAttackAnimation(worm); var attackPosition = worm.CenterPosition; - var affectedPlayers = lunch.Select(x => x.Owner).Distinct(); - foreach (var affectedPlayer in affectedPlayers) - NotifyPlayer(affectedPlayer, attackPosition); + var affectedPlayers = lunch.Select(x => x.Owner).Distinct().ToList(); + + PlayAttack(worm, attackPosition, affectedPlayers); + foreach (var notify in worm.TraitsImplementing()) + notify.Attacking(worm, target, null, null); return true; } - void PlayAttackAnimation(Actor self) + // List because IEnumerable gets evaluated too late. + void PlayAttack(Actor self, WPos attackPosition, List affectedPlayers) { renderUnit.PlayCustomAnim(self, "mouth"); + Sound.Play(swallow.Info.WormAttackSound, self.CenterPosition); + + Game.RunAfterDelay(1000, () => + { + foreach (var affectedPlayer in affectedPlayers) + NotifyPlayer(affectedPlayer, attackPosition); + }); } void NotifyPlayer(Player player, WPos location) diff --git a/OpenRA.Mods.D2k/Traits/AttackSwallow.cs b/OpenRA.Mods.D2k/Traits/AttackSwallow.cs index 3eea5404f2..a6e8600f1e 100644 --- a/OpenRA.Mods.D2k/Traits/AttackSwallow.cs +++ b/OpenRA.Mods.D2k/Traits/AttackSwallow.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.D2k.Traits [Desc("The number of ticks it takes to get in place under the target to attack.")] public readonly int AttackTime = 30; + public readonly string WormAttackSound = "Worm.wav"; public readonly string WormAttackNotification = "WormAttack"; public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); } diff --git a/mods/d2k/audio/voices.yaml b/mods/d2k/audio/voices.yaml index 320957599c..1768b2e5f1 100644 --- a/mods/d2k/audio/voices.yaml +++ b/mods/d2k/audio/voices.yaml @@ -99,10 +99,4 @@ SaboteurVoice: Die: KILLGUY1,KILLGUY2,KILLGUY3,KILLGUY4,KILLGUY5,KILLGUY6,KILLGUY7,KILLGUY8,KILLGUY9 Guard: I_GUARD DisablePrefixes: Select, Move, Die - DisableVariants: Select, Move, Guard - -WormVoice: - DefaultVariant: .WAV - Voices: - Select: WRMSIGN1 - Move: WORM \ No newline at end of file + DisableVariants: Select, Move, Guard \ No newline at end of file diff --git a/mods/d2k/weapons.yaml b/mods/d2k/weapons.yaml index 50759c9334..f041ede50a 100644 --- a/mods/d2k/weapons.yaml +++ b/mods/d2k/weapons.yaml @@ -506,7 +506,6 @@ Heal: WormJaw: ReloadDelay: 10 Range: 3c0 - Report: WORM.WAV Warhead@1Dam: SpreadDamage Spread: 160 Damage: 100