diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index c5a8fd46f3..575b753d6e 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -42,6 +42,12 @@ namespace OpenRA.GameRules [Desc("The sound played when the weapon is fired.")] public readonly string[] Report = null; + [Desc("The sound played when the weapon is reloaded.")] + public readonly string[] AfterFireSound = null; + + [Desc("Delay in ticks to play reloading sound.")] + public readonly int AfterFireSoundDelay = 0; + [Desc("Delay in ticks between reloading ammo magazines.")] public readonly int ReloadDelay = 1; diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 6e9c55463f..373fc03d83 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -263,6 +263,14 @@ namespace OpenRA.Mods.Common.Traits FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers); Burst = Weapon.Burst; + if (args.Weapon.AfterFireSound != null && args.Weapon.AfterFireSound.Any()) + { + ScheduleDelayedAction(Weapon.AfterFireSoundDelay, () => + { + Game.Sound.Play(SoundType.World, Weapon.AfterFireSound.Random(self.World.SharedRandom), self.CenterPosition); + }); + } + foreach (var nbc in self.TraitsImplementing()) nbc.FiredBurst(self, target, this); }