Prefer own service depots over allies.
This commit is contained in:
@@ -155,7 +155,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.Where(a => !a.Actor.IsDead && a.Actor.IsInWorld
|
||||
&& a.Actor.Owner.IsAlliedWith(self.Owner) &&
|
||||
Info.RepairActors.Contains(a.Actor.Info.Name))
|
||||
.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
||||
.OrderBy(a => a.Actor.Owner == self.Owner ? 0 : 1)
|
||||
.ThenBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
||||
|
||||
// Worst case FirstOrDefault() will return a TraitPair<null, null>, which is OK.
|
||||
return repairBuilding.FirstOrDefault().Actor;
|
||||
|
||||
@@ -99,7 +99,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.Where(a => !a.Actor.IsDead && a.Actor.IsInWorld
|
||||
&& a.Actor.Owner.IsAlliedWith(self.Owner) &&
|
||||
Info.RepairActors.Contains(a.Actor.Info.Name))
|
||||
.OrderBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
||||
.OrderBy(a => a.Actor.Owner == self.Owner ? 0 : 1)
|
||||
.ThenBy(p => (self.Location - p.Actor.Location).LengthSquared);
|
||||
|
||||
// Worst case FirstOrDefault() will return a TraitPair<null, null>, which is OK.
|
||||
return repairBuilding.FirstOrDefault().Actor;
|
||||
|
||||
Reference in New Issue
Block a user