diff --git a/OpenRA.Mods.Common/Traits/Render/WithAimAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithAimAnimation.cs index b268cf76ca..944d763a8c 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAimAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAimAnimation.cs @@ -59,11 +59,25 @@ namespace OpenRA.Mods.Common.Traits.Render void INotifyAiming.StartedAiming(Actor self, AttackBase ab) { + // Ignore any notifications from INotifyAiming while this trait is disabled + // otherwise we replace the current animation without being active + if (IsTraitDisabled) + return; + // We know that at least one AttackBase is aiming UpdateSequence(true); } - void INotifyAiming.StoppedAiming(Actor self, AttackBase ab) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } + void INotifyAiming.StoppedAiming(Actor self, AttackBase ab) + { + // Ignore any notifications from INotifyAiming while this trait is disabled + // otherwise we replace the current animation without being active + if (IsTraitDisabled) + return; + + UpdateSequence(attackBases.Any(a => a.IsAiming)); + } + protected override void TraitEnabled(Actor self) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } protected override void TraitDisabled(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Render/WithTurretAimAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithTurretAimAnimation.cs index 1ba04389c3..2aee3c24d8 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithTurretAimAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithTurretAimAnimation.cs @@ -59,11 +59,25 @@ namespace OpenRA.Mods.Common.Traits.Render void INotifyAiming.StartedAiming(Actor self, AttackBase ab) { + // Ignore any notifications from INotifyAiming while this trait is disabled + // otherwise we replace the current animation without being active + if (IsTraitDisabled) + return; + // We know that at least one AttackBase is aiming UpdateSequence(true); } - void INotifyAiming.StoppedAiming(Actor self, AttackBase ab) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } + void INotifyAiming.StoppedAiming(Actor self, AttackBase ab) + { + // Ignore any notifications from INotifyAiming while this trait is disabled + // otherwise we replace the current animation without being active + if (IsTraitDisabled) + return; + + UpdateSequence(attackBases.Any(a => a.IsAiming)); + } + protected override void TraitEnabled(Actor self) { UpdateSequence(attackBases.Any(a => a.IsAiming)); } protected override void TraitDisabled(Actor self)