Make Armament implement interfaces explicitly

This commit is contained in:
reaperrr
2016-10-20 22:10:25 +02:00
parent ce52bc9d7b
commit 3fca63e9a2

View File

@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Traits
return new WDist(Util.ApplyPercentageModifiers(Weapon.Range.Length, rangeModifiers)); return new WDist(Util.ApplyPercentageModifiers(Weapon.Range.Length, rangeModifiers));
} }
public virtual void Created(Actor self) protected virtual void Created(Actor self)
{ {
turret = self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == Info.Turret); turret = self.TraitsImplementing<Turreted>().FirstOrDefault(t => t.Name == Info.Turret);
ammoPool = self.TraitsImplementing<AmmoPool>().FirstOrDefault(la => la.Info.Name == Info.AmmoPoolName); ammoPool = self.TraitsImplementing<AmmoPool>().FirstOrDefault(la => la.Info.Name == Info.AmmoPoolName);
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits
rangeModifiers = self.TraitsImplementing<IRangeModifier>().ToArray().Select(m => m.GetRangeModifier()); rangeModifiers = self.TraitsImplementing<IRangeModifier>().ToArray().Select(m => m.GetRangeModifier());
} }
public virtual void Tick(Actor self) protected virtual void Tick(Actor self)
{ {
if (IsTraitDisabled) if (IsTraitDisabled)
return; return;
@@ -168,6 +168,18 @@ namespace OpenRA.Mods.Common.Traits
delayedActions.RemoveAll(a => a.First <= 0); 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) protected void ScheduleDelayedAction(int t, Action a)
{ {
if (t > 0) if (t > 0)