Added ReloadSound and ReloadSoundDelay to weapon declarations.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user