Merge pull request #10891 from abcdefg30/repairCursorExploit

Fix players being able to command allied units to the service depot
This commit is contained in:
Paul Chote
2016-03-12 13:38:44 +00:00
2 changed files with 5 additions and 1 deletions

View File

@@ -45,6 +45,10 @@ namespace OpenRA.Mods.Common.Orders
if (underCursor.Info.HasTraitInfo<RepairableBuildingInfo>())
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<Repairable>();
if (repairable == null)

View File

@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
{
var repairBuilding = self.World.ActorsWithTrait<RepairsUnits>()
.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);