From 4432c071cc629e0c31d7fe2446d1ce040cc85324 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 13 Oct 2015 21:48:25 +0200 Subject: [PATCH] Fix aircraft repulsing other aircraft when not being repulsable themselves --- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 620d732280..333a6de747 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -199,8 +199,14 @@ namespace OpenRA.Mods.Common.Traits return WVec.Zero; var repulsionForce = self.World.FindActorsInCircle(self.CenterPosition, Info.IdealSeparation) - .Where(a => !a.IsDead && a.Info.HasTraitInfo() - && a.Info.TraitInfo().CruiseAltitude == Info.CruiseAltitude) + .Where(a => + { + if (a.IsDead) + return false; + + var ai = a.Info.TraitInfoOrDefault(); + return ai != null && ai.Repulsable && ai.CruiseAltitude == Info.CruiseAltitude; + }) .Select(GetRepulsionForce) .Aggregate(WVec.Zero, (a, b) => a + b);