Added ReloadSound and ReloadSoundDelay to weapon declarations.

This commit is contained in:
Andre Mohren
2017-04-28 10:56:08 +02:00
parent 60bc114e39
commit d68bc48ba5
2 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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<INotifyBurstComplete>())
nbc.FiredBurst(self, target, this);
}