This commit is contained in:
Chris Forbes
2009-12-23 22:01:03 +13:00
parent 982fde6d0a
commit a6c8b234a5

View File

@@ -241,21 +241,11 @@ namespace OpenRa.Game
} }
public static bool IsActorCrushableByMovementType(Actor a, UnitMovementType umt) public static bool IsActorCrushableByMovementType(Actor a, UnitMovementType umt)
{ {
if (a != null) return a != null &&
{ a.traits.WithInterface<ICrushable>()
foreach (var crush in a.traits.WithInterface<ICrushable>()) .Any(c => c.CrushableBy(umt) &&
{ ((c.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) ||
if (((crush.IsCrushableByEnemy() && a.Owner != Game.LocalPlayer) (c.IsCrushableByFriend() && a.Owner == Game.LocalPlayer)));
|| (crush.IsCrushableByFriend() && a.Owner == Game.LocalPlayer))
&& crush.CrushableBy(umt))
{
Log.Write("{0} is crushable by MovementType {1}", a.Info.Name, umt);
return true;
}
}
Log.Write("{0} is NOT crushable by MovementType {1}", a.Info.Name, umt);
}
return false;
} }
public static bool IsWater(int2 a) public static bool IsWater(int2 a)