diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 7be8a2cad8..fc09205ed1 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Traits return new WDist(Util.ApplyPercentageModifiers(Weapon.Range.Length, rangeModifiers)); } - public virtual void Created(Actor self) + protected virtual void Created(Actor self) { turret = self.TraitsImplementing().FirstOrDefault(t => t.Name == Info.Turret); ammoPool = self.TraitsImplementing().FirstOrDefault(la => la.Info.Name == Info.AmmoPoolName); @@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits rangeModifiers = self.TraitsImplementing().ToArray().Select(m => m.GetRangeModifier()); } - public virtual void Tick(Actor self) + protected virtual void Tick(Actor self) { if (IsTraitDisabled) return; @@ -168,6 +168,18 @@ namespace OpenRA.Mods.Common.Traits delayedActions.RemoveAll(a => a.First <= 0); } + void INotifyCreated.Created(Actor self) + { + // Split into a protected method to allow subclassing + Created(self); + } + + void ITick.Tick(Actor self) + { + // Split into a protected method to allow subclassing + Tick(self); + } + protected void ScheduleDelayedAction(int t, Action a) { if (t > 0)