Split Burst updating to separate method
This commit is contained in:
@@ -238,25 +238,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
FireBarrel(self, facing, target, barrel);
|
FireBarrel(self, facing, target, barrel);
|
||||||
|
|
||||||
if (--Burst > 0)
|
UpdateBurst(self, target);
|
||||||
FireDelay = Weapon.BurstDelay;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var modifiers = reloadModifiers.ToArray();
|
|
||||||
FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers);
|
|
||||||
Burst = Weapon.Burst;
|
|
||||||
|
|
||||||
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Any())
|
|
||||||
{
|
|
||||||
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, () =>
|
|
||||||
{
|
|
||||||
Game.Sound.Play(SoundType.World, Weapon.AfterFireSound.Random(self.World.SharedRandom), self.CenterPosition);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var nbc in notifyBurstComplete)
|
|
||||||
nbc.FiredBurst(self, target, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return barrel;
|
return barrel;
|
||||||
}
|
}
|
||||||
@@ -326,6 +308,29 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateBurst(Actor self, Target target)
|
||||||
|
{
|
||||||
|
if (--Burst > 0)
|
||||||
|
FireDelay = Weapon.BurstDelay;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var modifiers = reloadModifiers.ToArray();
|
||||||
|
FireDelay = Util.ApplyPercentageModifiers(Weapon.ReloadDelay, modifiers);
|
||||||
|
Burst = Weapon.Burst;
|
||||||
|
|
||||||
|
if (Weapon.AfterFireSound != null && Weapon.AfterFireSound.Any())
|
||||||
|
{
|
||||||
|
ScheduleDelayedAction(Weapon.AfterFireSoundDelay, () =>
|
||||||
|
{
|
||||||
|
Game.Sound.Play(SoundType.World, Weapon.AfterFireSound.Random(self.World.SharedRandom), self.CenterPosition);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var nbc in notifyBurstComplete)
|
||||||
|
nbc.FiredBurst(self, target, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool OutOfAmmo { get { return ammoPool != null && !ammoPool.Info.SelfReloads && !ammoPool.HasAmmo(); } }
|
public virtual bool OutOfAmmo { get { return ammoPool != null && !ammoPool.Info.SelfReloads && !ammoPool.HasAmmo(); } }
|
||||||
public virtual bool IsReloading { get { return FireDelay > 0 || IsTraitDisabled; } }
|
public virtual bool IsReloading { get { return FireDelay > 0 || IsTraitDisabled; } }
|
||||||
public virtual bool AllowExplode { get { return !IsReloading; } }
|
public virtual bool AllowExplode { get { return !IsReloading; } }
|
||||||
|
|||||||
Reference in New Issue
Block a user