diff --git a/OpenRA.Mods.Common/Orders/RepairOrderGenerator.cs b/OpenRA.Mods.Common/Orders/RepairOrderGenerator.cs index 2afda3f700..fdb04c2510 100644 --- a/OpenRA.Mods.Common/Orders/RepairOrderGenerator.cs +++ b/OpenRA.Mods.Common/Orders/RepairOrderGenerator.cs @@ -45,6 +45,10 @@ namespace OpenRA.Mods.Common.Orders if (underCursor.Info.HasTraitInfo()) yield return new Order("RepairBuilding", world.LocalPlayer.PlayerActor, false) { TargetActor = underCursor }; + // Don't command allied units + if (underCursor.Owner != world.LocalPlayer) + yield break; + // Test for generic Repairable (used on units). var repairable = underCursor.TraitOrDefault(); if (repairable == null) diff --git a/OpenRA.Mods.Common/Traits/Repairable.cs b/OpenRA.Mods.Common/Traits/Repairable.cs index f067bcf3c8..403c6cebee 100644 --- a/OpenRA.Mods.Common/Traits/Repairable.cs +++ b/OpenRA.Mods.Common/Traits/Repairable.cs @@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits { var repairBuilding = self.World.ActorsWithTrait() .Where(a => !a.Actor.IsDead && a.Actor.IsInWorld - && a.Actor.Owner == self.Owner && + && a.Actor.Owner.IsAlliedWith(self.Owner) && info.RepairBuildings.Contains(a.Actor.Info.Name)) .OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);