Remove PPos overload of FindUnitsInCircle.
This commit is contained in:
@@ -52,21 +52,13 @@ namespace OpenRA.Mods.RA.Activities
|
||||
int searchRadiusSquared = searchRadius * searchRadius;
|
||||
|
||||
// Find harvestable resources nearby:
|
||||
// Avoid enemy territory:
|
||||
// TODO: calculate weapons ranges of units and factor those in instead of hard-coding 8.
|
||||
var path = self.World.WorldActor.Trait<PathFinder>().FindPath(
|
||||
PathSearch.Search(self.World, mobileInfo, self, true)
|
||||
.WithCustomCost(loc =>
|
||||
{
|
||||
// Avoid enemy territory:
|
||||
int safetycost = (
|
||||
// TODO: calculate weapons ranges of units and factor those in instead of hard-coding 8.
|
||||
from u in self.World.FindUnitsInCircle(loc.ToPPos(), Game.CellSize * 8)
|
||||
where !u.Destroyed
|
||||
where self.Owner.Stances[u.Owner] == Stance.Enemy
|
||||
select Math.Max(0, 64 - (loc - u.Location).LengthSquared)
|
||||
).Sum();
|
||||
|
||||
return safetycost;
|
||||
})
|
||||
.WithCustomCost(loc => self.World.FindUnitsInCircle(loc.CenterPosition, WRange.FromCells(8))
|
||||
.Where (u => !u.Destroyed && self.Owner.Stances[u.Owner] == Stance.Enemy)
|
||||
.Sum(u => Math.Max(0, 64 - (loc - u.Location).LengthSquared)))
|
||||
.WithHeuristic(loc =>
|
||||
{
|
||||
// Avoid this cell:
|
||||
|
||||
@@ -113,7 +113,8 @@ namespace OpenRA.Mods.RA.Air
|
||||
/* repulsion only applies when we're flying */
|
||||
if (Altitude <= 0) return;
|
||||
|
||||
var otherHelis = self.World.FindUnitsInCircle(self.CenterLocation, Info.IdealSeparation)
|
||||
var separation = new WRange(Info.IdealSeparation * 1024 / Game.CellSize);
|
||||
var otherHelis = self.World.FindUnitsInCircle(self.CenterPosition, separation)
|
||||
.Where(a => a.HasTrait<Helicopter>());
|
||||
|
||||
var f = otherHelis
|
||||
|
||||
@@ -105,7 +105,8 @@ namespace OpenRA.Mods.RA
|
||||
case DamageModel.Normal:
|
||||
{
|
||||
var maxSpread = warhead.Spread * (float)Math.Log(Math.Abs(warhead.Damage), 2);
|
||||
var hitActors = world.FindUnitsInCircle(args.dest, (int)maxSpread);
|
||||
var range = new WRange((int)maxSpread * 1024 / Game.CellSize);
|
||||
var hitActors = world.FindUnitsInCircle(args.dest.ToWPos(0), range);
|
||||
|
||||
foreach (var victim in hitActors)
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
IEnumerable<Actor> UnitsInRange()
|
||||
{
|
||||
return Self.World.FindUnitsInCircle(Self.CenterLocation, Game.CellSize * Info.Range)
|
||||
return Self.World.FindUnitsInCircle(Self.CenterPosition, WRange.FromCells(Info.Range))
|
||||
.Where(a => a.IsInWorld && a != Self && !a.Destroyed)
|
||||
.Where(a => !a.Owner.NonCombatant);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user