Skip to content

Commit a310411

Browse files
committed
Merge pull request OpenRA#8013 from penev92/bleed_wormSound
Add sandworm attack sound
2 parents 62b3592 + 76a3b9c commit a310411

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

OpenRA.Mods.D2k/Activities/SwallowActor.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
#endregion
1010

11+
using System.Collections.Generic;
1112
using System.Drawing;
1213
using System.Linq;
1314
using OpenRA.Activities;
@@ -89,21 +90,28 @@ bool WormAttack(Actor worm)
8990
}
9091

9192
positionable.SetPosition(worm, targetLocation);
92-
foreach (var notify in worm.TraitsImplementing<INotifyAttack>())
93-
notify.Attacking(worm, target, null, null);
94-
PlayAttackAnimation(worm);
9593

9694
var attackPosition = worm.CenterPosition;
97-
var affectedPlayers = lunch.Select(x => x.Owner).Distinct();
98-
foreach (var affectedPlayer in affectedPlayers)
99-
NotifyPlayer(affectedPlayer, attackPosition);
95+
var affectedPlayers = lunch.Select(x => x.Owner).Distinct().ToList();
96+
97+
PlayAttack(worm, attackPosition, affectedPlayers);
98+
foreach (var notify in worm.TraitsImplementing<INotifyAttack>())
99+
notify.Attacking(worm, target, null, null);
100100

101101
return true;
102102
}
103103

104-
void PlayAttackAnimation(Actor self)
104+
// List because IEnumerable gets evaluated too late.
105+
void PlayAttack(Actor self, WPos attackPosition, List<Player> affectedPlayers)
105106
{
106107
renderUnit.PlayCustomAnim(self, "mouth");
108+
Sound.Play(swallow.Info.WormAttackSound, self.CenterPosition);
109+
110+
Game.RunAfterDelay(1000, () =>
111+
{
112+
foreach (var affectedPlayer in affectedPlayers)
113+
NotifyPlayer(affectedPlayer, attackPosition);
114+
});
107115
}
108116

109117
void NotifyPlayer(Player player, WPos location)

OpenRA.Mods.D2k/Traits/AttackSwallow.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class AttackSwallowInfo : AttackFrontalInfo
2323
[Desc("The number of ticks it takes to get in place under the target to attack.")]
2424
public readonly int AttackTime = 30;
2525

26+
public readonly string WormAttackSound = "Worm.wav";
2627
public readonly string WormAttackNotification = "WormAttack";
2728

2829
public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); }

mods/d2k/audio/voices.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,4 @@ SaboteurVoice:
9999
Die: KILLGUY1,KILLGUY2,KILLGUY3,KILLGUY4,KILLGUY5,KILLGUY6,KILLGUY7,KILLGUY8,KILLGUY9
100100
Guard: I_GUARD
101101
DisablePrefixes: Select, Move, Die
102-
DisableVariants: Select, Move, Guard
103-
104-
WormVoice:
105-
DefaultVariant: .WAV
106-
Voices:
107-
Select: WRMSIGN1
108-
Move: WORM
102+
DisableVariants: Select, Move, Guard

mods/d2k/weapons.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ Heal:
506506
WormJaw:
507507
ReloadDelay: 10
508508
Range: 3c0
509-
Report: WORM.WAV
510509
Warhead@1Dam: SpreadDamage
511510
Spread: 160
512511
Damage: 100

0 commit comments

Comments
 (0)