Make the ICrushable implementation explicit

This commit is contained in:
abcdefg30
2016-01-22 11:01:26 +01:00
parent 8b59ce4dc2
commit f21d1f52e7
3 changed files with 15 additions and 8 deletions

View File

@@ -61,7 +61,8 @@ namespace OpenRA.Mods.Common.Traits
void INotifyCrushed.OnCrush(Actor self, Actor crusher, HashSet<string> crushClasses)
{
if (!CrushableBy(crushClasses, crusher.Owner))
// Crate can only be crushed if it is not in the air.
if (!self.IsAtGroundLevel() || !crushClasses.Contains(info.CrushClass))
return;
OnCrushInner(crusher);
@@ -84,7 +85,8 @@ namespace OpenRA.Mods.Common.Traits
return false;
// Make sure that the actor can collect this crate type
return CrushableBy(mi.Crushes, a.Owner);
// Crate can only be crushed if it is not in the air.
return self.IsAtGroundLevel() && mi.Crushes.Contains(info.CrushClass);
});
// Destroy the crate if none of the units in the cell are valid collectors
@@ -196,7 +198,7 @@ namespace OpenRA.Mods.Common.Traits
return GetAvailableSubCell(a, SubCell.Any, ignoreActor, checkTransientActors) != SubCell.Invalid;
}
public bool CrushableBy(HashSet<string> crushClasses, Player owner)
bool ICrushable.CrushableBy(HashSet<string> crushClasses, Player owner)
{
// Crate can only be crushed if it is not in the air.
return self.IsAtGroundLevel() && crushClasses.Contains(info.CrushClass);