diff --git a/OpenRA.Mods.Common/Traits/AutoCrusher.cs b/OpenRA.Mods.Common/Traits/AutoCrusher.cs index 9a2ad6e540..b4b19508a7 100644 --- a/OpenRA.Mods.Common/Traits/AutoCrusher.cs +++ b/OpenRA.Mods.Common/Traits/AutoCrusher.cs @@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Traits public override object Create(ActorInitializer init) { return new AutoCrusher(init.Self, this); } } - sealed class AutoCrusher : PausableConditionalTrait, INotifyIdle + sealed class AutoCrusher : ConditionalTrait, INotifyIdle { int nextScanTime; readonly IMoveInfo moveInfo; @@ -49,14 +49,13 @@ namespace OpenRA.Mods.Common.Traits { move = self.Trait(); moveInfo = self.Info.TraitInfo(); - nextScanTime = self.World.SharedRandom.Next(Info.MinimumScanTimeInterval, Info.MaximumScanTimeInterval); isAircraft = move is Aircraft; ignoresDisguise = self.Info.HasTraitInfo(); } void INotifyIdle.TickIdle(Actor self) { - if (nextScanTime-- > 0) + if (IsTraitDisabled || nextScanTime-- > 0) return; var crushableActor = self.World.FindActorsInCircle(self.CenterPosition, Info.ScanRadius) @@ -95,5 +94,10 @@ namespace OpenRA.Mods.Common.Traits return target.TraitsImplementing().Any(c => c.CrushableBy(target, self, Info.CrushClasses)); } + + protected override void TraitEnabled(Actor self) + { + nextScanTime = self.World.SharedRandom.Next(Info.MinimumScanTimeInterval, Info.MaximumScanTimeInterval); + } } }