diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs index 2563fe4e5e..7a238a3d8c 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs @@ -152,7 +152,8 @@ namespace OpenRA.Mods.Common.Traits if (!HasAnyValidWeapons(target)) return false; - var mobile = self.TraitOrDefault(); + // PERF: Mobile implements IPositionable, so we can use 'as' to save a trait look-up here. + var mobile = positionable as Mobile; if (mobile != null && !mobile.CanInteractWithGroundLayer(self)) return false;