Merge pull request #10891 from abcdefg30/repairCursorExploit
Fix players being able to command allied units to the service depot
This commit is contained in:
@@ -45,6 +45,10 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
if (underCursor.Info.HasTraitInfo<RepairableBuildingInfo>())
|
if (underCursor.Info.HasTraitInfo<RepairableBuildingInfo>())
|
||||||
yield return new Order("RepairBuilding", world.LocalPlayer.PlayerActor, false) { TargetActor = underCursor };
|
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).
|
// Test for generic Repairable (used on units).
|
||||||
var repairable = underCursor.TraitOrDefault<Repairable>();
|
var repairable = underCursor.TraitOrDefault<Repairable>();
|
||||||
if (repairable == null)
|
if (repairable == null)
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var repairBuilding = self.World.ActorsWithTrait<RepairsUnits>()
|
var repairBuilding = self.World.ActorsWithTrait<RepairsUnits>()
|
||||||
.Where(a => !a.Actor.IsDead && a.Actor.IsInWorld
|
.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))
|
info.RepairBuildings.Contains(a.Actor.Info.Name))
|
||||||
.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user