Remove PPos overload of ClosestTo.
This commit is contained in:
@@ -55,11 +55,6 @@ namespace OpenRA
|
|||||||
return actors.OrderBy(a => (a.CenterPosition - pos).LengthSquared).FirstOrDefault();
|
return actors.OrderBy(a => (a.CenterPosition - pos).LengthSquared).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Actor ClosestTo(this IEnumerable<Actor> actors, PPos px)
|
|
||||||
{
|
|
||||||
return actors.OrderBy( a => (a.CenterLocation - px).LengthSquared ).FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IEnumerable<Actor> FindUnitsInCircle(this World world, WPos a, WRange r)
|
public static IEnumerable<Actor> FindUnitsInCircle(this World world, WPos a, WRange r)
|
||||||
{
|
{
|
||||||
return world.FindUnitsInCircle(PPos.FromWPos(a), r.Range * Game.CellSize / 1024);
|
return world.FindUnitsInCircle(PPos.FromWPos(a), r.Range * Game.CellSize / 1024);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
var buildings = self.Info.Traits.Get<MinelayerInfo>().RearmBuildings;
|
var buildings = self.Info.Traits.Get<MinelayerInfo>().RearmBuildings;
|
||||||
var rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally
|
var rearmTarget = self.World.Actors.Where(a => self.Owner.Stances[a.Owner] == Stance.Ally
|
||||||
&& buildings.Contains(a.Info.Name))
|
&& buildings.Contains(a.Info.Name))
|
||||||
.ClosestTo( self.CenterLocation );
|
.ClosestTo(self);
|
||||||
|
|
||||||
if (rearmTarget == null)
|
if (rearmTarget == null)
|
||||||
return new Wait(20);
|
return new Wait(20);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
var nearestHpad = self.World.ActorsWithTrait<Reservable>()
|
var nearestHpad = self.World.ActorsWithTrait<Reservable>()
|
||||||
.Where(a => a.Actor.Owner == self.Owner && rearmBuildings.Contains(a.Actor.Info.Name))
|
.Where(a => a.Actor.Owner == self.Owner && rearmBuildings.Contains(a.Actor.Info.Name))
|
||||||
.Select(a => a.Actor)
|
.Select(a => a.Actor)
|
||||||
.ClosestTo(self.CenterLocation);
|
.ClosestTo(self);
|
||||||
|
|
||||||
if (nearestHpad == null)
|
if (nearestHpad == null)
|
||||||
return Util.SequenceActivities(new Turn(initialFacing), new HeliLand(true, 0), NextActivity);
|
return Util.SequenceActivities(new Turn(initialFacing), new HeliLand(true, 0), NextActivity);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
.Where(a => rearmBuildings.Contains(a.Actor.Info.Name)
|
.Where(a => rearmBuildings.Contains(a.Actor.Info.Name)
|
||||||
&& (!unreservedOnly || !Reservable.IsReserved(a.Actor)))
|
&& (!unreservedOnly || !Reservable.IsReserved(a.Actor)))
|
||||||
.Select(a => a.Actor)
|
.Select(a => a.Actor)
|
||||||
.ClosestTo( self.CenterLocation );
|
.ClosestTo(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Calculate(Actor self)
|
void Calculate(Actor self)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA
|
|||||||
.Where(a => a.IsInWorld && !a.IsDead())
|
.Where(a => a.IsInWorld && !a.IsDead())
|
||||||
.Where(a => a.GetDamageState() > DamageState.Undamaged)
|
.Where(a => a.GetDamageState() > DamageState.Undamaged)
|
||||||
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
||||||
.ClosestTo( self.CenterLocation );
|
.ClosestTo(self);
|
||||||
|
|
||||||
if (target != null)
|
if (target != null)
|
||||||
self.QueueActivity(attack.GetAttackActivity(self, Target.FromActor(target), false));
|
self.QueueActivity(attack.GetAttackActivity(self, Target.FromActor(target), false));
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace OpenRA.Mods.RA
|
|||||||
.Where(a => a.AppearsHostileTo(self))
|
.Where(a => a.AppearsHostileTo(self))
|
||||||
.Where(a => !a.HasTrait<AutoTargetIgnore>())
|
.Where(a => !a.HasTrait<AutoTargetIgnore>())
|
||||||
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
||||||
.ClosestTo(self.CenterLocation);
|
.ClosestTo(self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.RA
|
|||||||
.Where(a => !a.HasTrait<AutoTargetIgnore>())
|
.Where(a => !a.HasTrait<AutoTargetIgnore>())
|
||||||
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
.Where(a => attack.HasAnyValidWeapons(Target.FromActor(a)))
|
||||||
.Where(a => self.Owner.Shroud.IsTargetable(a))
|
.Where(a => self.Owner.Shroud.IsTargetable(a))
|
||||||
.ClosestTo(self.CenterLocation);
|
.ClosestTo(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace OpenRA.Mods.RA
|
|||||||
// TODO exclude other NeutralActor that arent permanent
|
// TODO exclude other NeutralActor that arent permanent
|
||||||
Actor GetInRange(Actor self)
|
Actor GetInRange(Actor self)
|
||||||
{
|
{
|
||||||
return CaptorsInRange(self).ClosestTo( self.CenterLocation );
|
return CaptorsInRange(self).ClosestTo(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CountPlayersNear(Actor self, Player ignoreMe)
|
int CountPlayersNear(Actor self, Player ignoreMe)
|
||||||
|
|||||||
Reference in New Issue
Block a user