Require explicit ISpeedModifier implementation

Plus misc "collateral" explicit interfaces.
This commit is contained in:
reaperrr
2016-10-22 20:10:49 +02:00
parent 97c2c24e8d
commit 4af7134115
4 changed files with 10 additions and 8 deletions

View File

@@ -447,9 +447,9 @@ namespace OpenRA.Mods.Common.Traits
yield return GetPipAt(i);
}
public bool ShouldExplode(Actor self) { return !IsEmpty; }
bool IExplodeModifier.ShouldExplode(Actor self) { return !IsEmpty; }
public int GetSpeedModifier()
int ISpeedModifier.GetSpeedModifier()
{
return 100 - (100 - Info.FullyLoadedSpeed) * contents.Values.Sum() / Info.Capacity;
}

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
mobile = self.Trait<Mobile>();
}
public void Panic()
void Panic()
{
if (!Panicking)
self.CancelActivity();
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
panicStartedTick = self.World.WorldTick;
}
public void Tick(Actor self)
void ITick.Tick(Actor self)
{
if (!Panicking)
return;
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Traits
}
}
public void TickIdle(Actor self)
void INotifyIdle.TickIdle(Actor self)
{
if (!Panicking)
return;
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
mobile.Nudge(self, self, true);
}
public void Damaged(Actor self, AttackInfo e)
void INotifyDamage.Damaged(Actor self, AttackInfo e)
{
if (e.Damage.Value > 0)
Panic();
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Traits
void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel) { }
public int GetSpeedModifier()
int ISpeedModifier.GetSpeedModifier()
{
return Panicking ? info.PanicSpeedModifier : 100;
}

View File

@@ -24,6 +24,6 @@ namespace OpenRA.Mods.Common.Traits
public SpeedMultiplier(SpeedMultiplierInfo info, string actorType)
: base(info, "SpeedMultiplier", actorType) { }
public int GetSpeedModifier() { return GetModifier(); }
int ISpeedModifier.GetSpeedModifier() { return GetModifier(); }
}
}

View File

@@ -205,6 +205,8 @@ namespace OpenRA.Mods.Common.Traits
[RequireExplicitImplementation]
public interface IDamageModifier { int GetDamageModifier(Actor attacker, Damage damage); }
[RequireExplicitImplementation]
public interface ISpeedModifier { int GetSpeedModifier(); }
public interface IFirepowerModifier { int GetFirepowerModifier(); }
public interface IReloadModifier { int GetReloadModifier(); }