rename WRange to WDist
This commit is contained in:
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
var move = info.Moves ? aircraft.FlyStep(aircraft.Facing) : WVec.Zero;
|
||||
move -= new WVec(WRange.Zero, WRange.Zero, info.Velocity);
|
||||
move -= new WVec(WDist.Zero, WDist.Zero, info.Velocity);
|
||||
aircraft.SetPosition(self, aircraft.CenterPosition + move);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
readonly Plane plane;
|
||||
readonly Target target;
|
||||
readonly WRange maxRange;
|
||||
readonly WRange minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public Fly(Actor self, Target t)
|
||||
{
|
||||
@@ -28,14 +28,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
target = t;
|
||||
}
|
||||
|
||||
public Fly(Actor self, Target t, WRange minRange, WRange maxRange)
|
||||
public Fly(Actor self, Target t, WDist minRange, WDist maxRange)
|
||||
: this(self, t)
|
||||
{
|
||||
this.maxRange = maxRange;
|
||||
this.minRange = minRange;
|
||||
}
|
||||
|
||||
public static void FlyToward(Actor self, Plane plane, int desiredFacing, WRange desiredAltitude)
|
||||
public static void FlyToward(Actor self, Plane plane, int desiredFacing, WDist desiredAltitude)
|
||||
{
|
||||
var move = plane.FlyStep(plane.Facing);
|
||||
var altitude = plane.CenterPosition.Z;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class FlyCircle : Activity
|
||||
{
|
||||
readonly Plane plane;
|
||||
readonly WRange cruiseAltitude;
|
||||
readonly WDist cruiseAltitude;
|
||||
|
||||
public FlyCircle(Actor self)
|
||||
{
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
Target target;
|
||||
Plane plane;
|
||||
WRange minRange;
|
||||
WRange maxRange;
|
||||
WDist minRange;
|
||||
WDist maxRange;
|
||||
|
||||
public FlyFollow(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
{
|
||||
this.target = target;
|
||||
plane = self.Trait<Plane>();
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class FlyTimed : Activity
|
||||
{
|
||||
readonly Plane plane;
|
||||
readonly WRange cruiseAltitude;
|
||||
readonly WDist cruiseAltitude;
|
||||
int remainingTicks;
|
||||
|
||||
public FlyTimed(int ticks, Actor self)
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
readonly Helicopter helicopter;
|
||||
readonly Target target;
|
||||
readonly WRange maxRange;
|
||||
readonly WRange minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public HeliFly(Actor self, Target t)
|
||||
{
|
||||
@@ -28,14 +28,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
target = t;
|
||||
}
|
||||
|
||||
public HeliFly(Actor self, Target t, WRange minRange, WRange maxRange)
|
||||
public HeliFly(Actor self, Target t, WDist minRange, WDist maxRange)
|
||||
: this(self, t)
|
||||
{
|
||||
this.maxRange = maxRange;
|
||||
this.minRange = minRange;
|
||||
}
|
||||
|
||||
public static bool AdjustAltitude(Actor self, Helicopter helicopter, WRange targetAltitude)
|
||||
public static bool AdjustAltitude(Actor self, Helicopter helicopter, WDist targetAltitude)
|
||||
{
|
||||
var altitude = helicopter.CenterPosition.Z;
|
||||
if (altitude == targetAltitude.Range)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class HeliLand : Activity
|
||||
{
|
||||
readonly Helicopter helicopter;
|
||||
readonly WRange landAltitude;
|
||||
readonly WDist landAltitude;
|
||||
bool requireSpace;
|
||||
|
||||
public HeliLand(Actor self, bool requireSpace)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
var desiredFacing = Util.GetFacing(d, plane.Facing);
|
||||
Fly.FlyToward(self, plane, desiredFacing, WRange.Zero);
|
||||
Fly.FlyToward(self, plane, desiredFacing, WDist.Zero);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly AttackBase attack;
|
||||
readonly IMove move;
|
||||
readonly IFacing facing;
|
||||
readonly WRange minRange;
|
||||
readonly WRange maxRange;
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly IPositionable positionable;
|
||||
|
||||
public Attack(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
|
||||
public Attack(Actor self, Target target, WDist minRange, WDist maxRange, bool allowMovement)
|
||||
{
|
||||
Target = target;
|
||||
this.minRange = minRange;
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
protected virtual void OnInside(Actor self) { }
|
||||
|
||||
protected bool TryGetAlternateTargetInCircle(
|
||||
Actor self, WRange radius, Action<Target> update, Func<Actor, bool> primaryFilter, Func<Actor, bool>[] preferenceFilters = null)
|
||||
Actor self, WDist radius, Action<Target> update, Func<Actor, bool> primaryFilter, Func<Actor, bool>[] preferenceFilters = null)
|
||||
{
|
||||
var diff = new WVec(radius, radius, WRange.Zero);
|
||||
var diff = new WVec(radius, radius, WDist.Zero);
|
||||
var candidates = self.World.ActorMap.ActorsInBox(self.CenterPosition - diff, self.CenterPosition + diff)
|
||||
.Where(primaryFilter).Select(a => new { Actor = a, Ls = (self.CenterPosition - a.CenterPosition).HorizontalLengthSquared })
|
||||
.Where(p => p.Ls <= radius.RangeSquared).OrderBy(p => p.Ls).Select(p => p.Actor);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class Heal : Attack
|
||||
{
|
||||
public Heal(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
|
||||
public Heal(Actor self, Target target, WDist minRange, WDist maxRange, bool allowMovement)
|
||||
: base(self, target, minRange, maxRange, allowMovement) { }
|
||||
|
||||
protected override Activity InnerTick(Actor self, AttackBase attack)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return this;
|
||||
|
||||
return Util.SequenceActivities(
|
||||
new AttackMoveActivity(self, new Move(self, target.Location, WRange.FromCells(2))),
|
||||
new AttackMoveActivity(self, new Move(self, target.Location, WDist.FromCells(2))),
|
||||
new Wait(25),
|
||||
this);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class Follow : Activity
|
||||
{
|
||||
readonly Target target;
|
||||
readonly WRange minRange;
|
||||
readonly WRange maxRange;
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly IMove move;
|
||||
|
||||
public Follow(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
public Follow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
{
|
||||
this.target = target;
|
||||
this.minRange = minRange;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
readonly Mobile mobile;
|
||||
readonly IDisableMove[] moveDisablers;
|
||||
readonly WRange nearEnough;
|
||||
readonly WDist nearEnough;
|
||||
readonly Func<List<CPos>> getPath;
|
||||
readonly Actor ignoredActor;
|
||||
|
||||
@@ -50,14 +50,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.ToCell, destination, false)
|
||||
.WithoutLaneBias());
|
||||
this.destination = destination;
|
||||
this.nearEnough = WRange.Zero;
|
||||
this.nearEnough = WDist.Zero;
|
||||
}
|
||||
|
||||
// HACK: for legacy code
|
||||
public Move(Actor self, CPos destination, int nearEnough)
|
||||
: this(self, destination, WRange.FromCells(nearEnough)) { }
|
||||
: this(self, destination, WDist.FromCells(nearEnough)) { }
|
||||
|
||||
public Move(Actor self, CPos destination, WRange nearEnough)
|
||||
public Move(Actor self, CPos destination, WDist nearEnough)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
this.nearEnough = nearEnough;
|
||||
}
|
||||
|
||||
public Move(Actor self, CPos destination, SubCell subCell, WRange nearEnough)
|
||||
public Move(Actor self, CPos destination, SubCell subCell, WDist nearEnough)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
|
||||
@@ -90,11 +90,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
.WithIgnoredActor(ignoredActor));
|
||||
|
||||
this.destination = destination;
|
||||
this.nearEnough = WRange.Zero;
|
||||
this.nearEnough = WDist.Zero;
|
||||
this.ignoredActor = ignoredActor;
|
||||
}
|
||||
|
||||
public Move(Actor self, Target target, WRange range)
|
||||
public Move(Actor self, Target target, WDist range)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
this.getPath = getPath;
|
||||
|
||||
destination = null;
|
||||
nearEnough = WRange.Zero;
|
||||
nearEnough = WDist.Zero;
|
||||
}
|
||||
|
||||
static int HashList<T>(List<T> xs)
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class MoveWithinRange : MoveAdjacentTo
|
||||
{
|
||||
readonly WRange maxRange;
|
||||
readonly WRange minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public MoveWithinRange(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
public MoveWithinRange(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
: base(self, target)
|
||||
{
|
||||
this.minRange = minRange;
|
||||
|
||||
Reference in New Issue
Block a user