rename WRange to WDist

This commit is contained in:
Matthias Mailänder
2015-07-06 16:35:15 +02:00
parent 54e1cf866c
commit 7447e0bf93
100 changed files with 244 additions and 244 deletions

View File

@@ -485,7 +485,7 @@ namespace OpenRA.Mods.Common.AI
return allEnemyUnits.ClosestTo(pos);
}
internal Actor FindClosestEnemy(WPos pos, WRange radius)
internal Actor FindClosestEnemy(WPos pos, WDist radius)
{
var enemyUnits = World.FindActorsInCircle(pos, radius)
.Where(unit => Player.Stances[unit.Owner] == Stance.Enemy &&
@@ -643,7 +643,7 @@ namespace OpenRA.Mods.Common.AI
foreach (var b in allEnemyBaseBuilder)
{
var enemies = World.FindActorsInCircle(b.CenterPosition, WRange.FromCells(Info.RushAttackScanRadius))
var enemies = World.FindActorsInCircle(b.CenterPosition, WDist.FromCells(Info.RushAttackScanRadius))
.Where(unit => Player.Stances[unit.Owner] == Stance.Enemy && unit.HasTrait<AttackBase>()).ToList();
if (rushFuzzy.CanAttack(ownUnits, enemies))
@@ -672,7 +672,7 @@ namespace OpenRA.Mods.Common.AI
if (!protectSq.IsValid)
{
var ownUnits = World.FindActorsInCircle(World.Map.CenterOfCell(GetRandomBaseCenter()), WRange.FromCells(Info.ProtectUnitScanRadius))
var ownUnits = World.FindActorsInCircle(World.Map.CenterOfCell(GetRandomBaseCenter()), WDist.FromCells(Info.ProtectUnitScanRadius))
.Where(unit => unit.Owner == Player && !unit.HasTrait<Building>()
&& unit.HasTrait<AttackBase>());

View File

@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.AI
protected static bool NearToPosSafely(Squad owner, WPos loc, out Actor detectedEnemyTarget)
{
detectedEnemyTarget = null;
var unitsAroundPos = owner.World.FindActorsInCircle(loc, WRange.FromCells(DangerRadius))
var unitsAroundPos = owner.World.FindActorsInCircle(loc, WDist.FromCells(DangerRadius))
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
if (!unitsAroundPos.Any())

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.AI
owner.TargetActor = t;
}
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WRange.FromCells(10))
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WDist.FromCells(10))
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
if (enemyUnits.Any())
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.AI
var leader = owner.Units.ClosestTo(owner.TargetActor.CenterPosition);
if (leader == null)
return;
var ownUnits = owner.World.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(owner.Units.Count) / 3)
var ownUnits = owner.World.FindActorsInCircle(leader.CenterPosition, WDist.FromCells(owner.Units.Count) / 3)
.Where(a => a.Owner == owner.Units.FirstOrDefault().Owner && owner.Units.Contains(a)).ToHashSet();
if (ownUnits.Count < owner.Units.Count)
{
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.AI
}
else
{
var enemies = owner.World.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(12))
var enemies = owner.World.FindActorsInCircle(leader.CenterPosition, WDist.FromCells(12))
.Where(a1 => !a1.Disposed && !a1.IsDead);
var enemynearby = enemies.Where(a1 => a1.HasTrait<ITargetable>() && leader.Owner.Stances[a1.Owner] == Stance.Enemy);
var target = enemynearby.ClosestTo(leader.CenterPosition);

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.AI
if (!owner.IsTargetValid)
{
owner.TargetActor = owner.Bot.FindClosestEnemy(owner.CenterPosition, WRange.FromCells(8));
owner.TargetActor = owner.Bot.FindClosestEnemy(owner.CenterPosition, WDist.FromCells(8));
if (owner.TargetActor == null)
{

View File

@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.AI
return false;
var u = squad.Units.Random(squad.Random);
var units = squad.World.FindActorsInCircle(u.CenterPosition, WRange.FromCells(DangerRadius)).ToList();
var units = squad.World.FindActorsInCircle(u.CenterPosition, WDist.FromCells(DangerRadius)).ToList();
var ownBaseBuildingAround = units.Where(unit => unit.Owner == squad.Bot.Player && unit.HasTrait<Building>());
if (ownBaseBuildingAround.Any())
return false;

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.AI
foreach (var consideration in Considerations)
{
var radiusToUse = new WRange(consideration.CheckRadius.Range);
var radiusToUse = new WDist(consideration.CheckRadius.Range);
var checkActors = world.FindActorsInCircle(pos, radiusToUse);
foreach (var scrutinized in checkActors)
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.AI
public readonly DecisionMetric TargetMetric = DecisionMetric.None;
[Desc("What is the check radius of this decision?")]
public readonly WRange CheckRadius = WRange.FromCells(5);
public readonly WDist CheckRadius = WDist.FromCells(5);
public Consideration(MiniYaml yaml)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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>();

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common
{
// Move within sight range of the frozen actor
var sight = self.TraitOrDefault<RevealsShroud>();
var range = sight != null ? sight.Range : WRange.FromCells(2);
var range = sight != null ? sight.Range : WDist.FromCells(2);
self.QueueActivity(move.MoveWithinRange(Target.FromPos(frozen.CenterPosition), range));
}

View File

@@ -23,9 +23,9 @@ namespace OpenRA.Mods.Common.Effects
public class BulletInfo : IProjectileInfo
{
[Desc("Projectile speed in WRange / tick, two values indicate variable velocity.")]
public readonly WRange[] Speed = { new WRange(17) };
public readonly WDist[] Speed = { new WDist(17) };
[Desc("Maximum offset at the maximum range.")]
public readonly WRange Inaccuracy = WRange.Zero;
public readonly WDist Inaccuracy = WDist.Zero;
public readonly string Image = null;
[SequenceReference("Image")] public readonly string Sequence = "idle";
public readonly string Palette = "effect";
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Effects
readonly ProjectileArgs args;
readonly Animation anim;
[Sync] readonly WAngle angle;
[Sync] readonly WRange speed;
[Sync] readonly WDist speed;
ContrailRenderable contrail;
string trailPalette;
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Effects
angle = info.Angle[0];
if (info.Speed.Length > 1)
speed = new WRange(world.SharedRandom.Next(info.Speed[0].Range, info.Speed[1].Range));
speed = new WDist(world.SharedRandom.Next(info.Speed[0].Range, info.Speed[1].Range));
else
speed = info.Speed[0];

View File

@@ -25,9 +25,9 @@ namespace OpenRA.Mods.Common.Effects
public readonly string OpenSequence = null;
public readonly string Palette = "effect";
public readonly bool Shadow = false;
public readonly WRange Velocity = WRange.Zero;
public readonly WDist Velocity = WDist.Zero;
[Desc("Value added to velocity every tick.")]
public readonly WRange Acceleration = new WRange(15);
public readonly WDist Acceleration = new WDist(15);
public IEffect Create(ProjectileArgs args) { return new GravityBomb(this, args); }
}
@@ -46,8 +46,8 @@ namespace OpenRA.Mods.Common.Effects
this.info = info;
this.args = args;
pos = args.Source;
velocity = new WVec(WRange.Zero, WRange.Zero, -info.Velocity);
acceleration = new WVec(WRange.Zero, WRange.Zero, info.Acceleration);
velocity = new WVec(WDist.Zero, WDist.Zero, -info.Velocity);
acceleration = new WVec(WDist.Zero, WDist.Zero, info.Acceleration);
anim = new Animation(args.SourceActor.World, info.Image);

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Effects
public readonly string Palette = "effect";
public readonly bool Shadow = false;
[Desc("Projectile speed in WRange / tick")]
public readonly WRange Speed = new WRange(8);
public readonly WDist Speed = new WDist(8);
[Desc("Maximum vertical pitch when changing altitude.")]
public readonly WAngle MaximumPitch = WAngle.FromDegrees(30);
[Desc("How many ticks before this missile is armed and can explode.")]
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Effects
[Desc("Is the missile blocked by actors with BlocksProjectiles: trait.")]
public readonly bool Blockable = true;
[Desc("Maximum offset at the maximum range")]
public readonly WRange Inaccuracy = WRange.Zero;
public readonly WDist Inaccuracy = WDist.Zero;
[Desc("Probability of locking onto and following target.")]
public readonly int LockOnProbability = 100;
[Desc("In n/256 per tick.")]
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Effects
[Desc("Explodes when inside this proximity radius to target.",
"Note: If this value is lower than the missile speed, this check might",
"not trigger fast enough, causing the missile to fly past the target.")]
public readonly WRange CloseEnough = new WRange(298);
public readonly WDist CloseEnough = new WDist(298);
public IEffect Create(ProjectileArgs args) { return new Missile(this, args); }
}

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Effects
WPos pos;
int ticks;
public NukeLaunch(Player firedBy, string weapon, WPos launchPos, WPos targetPos, WRange velocity, int delay, bool skipAscent, string flashType)
public NukeLaunch(Player firedBy, string weapon, WPos launchPos, WPos targetPos, WDist velocity, int delay, bool skipAscent, string flashType)
{
this.firedBy = firedBy;
this.weapon = weapon;
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Effects
this.turn = delay / 2;
this.flashType = flashType;
var offset = new WVec(WRange.Zero, WRange.Zero, velocity * turn);
var offset = new WVec(WDist.Zero, WDist.Zero, velocity * turn);
ascendSource = launchPos;
ascendTarget = launchPos + offset;
descendSource = targetPos + offset;

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Graphics
public class DefaultSpriteSequence : ISpriteSequence
{
static readonly WRange DefaultShadowSpriteZOffset = new WRange(-5);
static readonly WDist DefaultShadowSpriteZOffset = new WDist(-5);
readonly Sprite[] sprites;
readonly bool reverseFacings, transpose;
@@ -104,8 +104,8 @@ namespace OpenRA.Mods.Common.Graphics
{
Start = LoadField<int>(d, "Start", 0);
ShadowStart = LoadField<int>(d, "ShadowStart", -1);
ShadowZOffset = LoadField<WRange>(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Range;
ZOffset = LoadField<WRange>(d, "ZOffset", WRange.Zero).Range;
ShadowZOffset = LoadField<WDist>(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Range;
ZOffset = LoadField<WDist>(d, "ZOffset", WDist.Zero).Range;
Tick = LoadField<int>(d, "Tick", 40);
transpose = LoadField<bool>(d, "Transpose", false);
Frames = LoadField<int[]>(d, "Frames", null);

View File

@@ -16,12 +16,12 @@ namespace OpenRA.Mods.Common.Graphics
public struct RangeCircleRenderable : IRenderable, IFinalizedRenderable
{
readonly WPos centerPosition;
readonly WRange radius;
readonly WDist radius;
readonly int zOffset;
readonly Color color;
readonly Color contrastColor;
public RangeCircleRenderable(WPos centerPosition, WRange radius, int zOffset, Color color, Color contrastColor)
public RangeCircleRenderable(WPos centerPosition, WDist radius, int zOffset, Color color, Color contrastColor)
{
this.centerPosition = centerPosition;
this.radius = radius;

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Pathfinder
}
}
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self)
{
using (new PerfSample("Pathfinder"))
{

View File

@@ -65,9 +65,9 @@ namespace OpenRA.Mods.Common.Scripting
public WRangeGlobal(ScriptContext context) : base(context) { }
[Desc("Create a new WRange.")]
public WRange New(int r) { return new WRange(r); }
public WDist New(int r) { return new WDist(r); }
[Desc("Create a new WRange by cell distance")]
public WRange FromCells(int numCells) { return WRange.FromCells(numCells); }
public WDist FromCells(int numCells) { return WDist.FromCells(numCells); }
}
}

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
}
[Desc("Returns a table of all actors within the requested region, filtered using the specified function.")]
public Actor[] ActorsInCircle(WPos location, WRange radius, LuaFunction filter = null)
public Actor[] ActorsInCircle(WPos location, WDist radius, LuaFunction filter = null)
{
var actors = Context.World.FindActorsInCircle(location, radius);

View File

@@ -344,7 +344,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Call a function when an actor enters this range." +
"Returns the trigger id for later removal using RemoveProximityTrigger(int id)." +
"The callback function will be called as func(Actor a, int id).")]
public int OnEnteredProximityTrigger(WPos pos, WRange range, LuaFunction func)
public int OnEnteredProximityTrigger(WPos pos, WDist range, LuaFunction func)
{
var triggerId = 0;
var onEntry = (LuaFunction)func.CopyReference();
@@ -370,7 +370,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Call a function when an actor leaves this range." +
"Returns the trigger id for later removal using RemoveProximityTrigger(int id)." +
"The callback function will be called as func(Actor a, int id).")]
public int OnExitedProximityTrigger(WPos pos, WRange range, LuaFunction func)
public int OnExitedProximityTrigger(WPos pos, WDist range, LuaFunction func)
{
var triggerId = 0;
var onExit = (LuaFunction)func.CopyReference();

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
"(in cells) that will be considered close enough to complete the activity.")]
public void Move(CPos cell, int closeEnough = 0)
{
Self.QueueActivity(new Move(Self, cell, WRange.FromCells(closeEnough)));
Self.QueueActivity(new Move(Self, cell, WDist.FromCells(closeEnough)));
}
[ScriptActorPropertyActivity]

View File

@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits
{
public class AircraftInfo : ITraitInfo, IFacingInfo, IOccupySpaceInfo, ICruiseAltitudeInfo, UsesInit<LocationInit>, UsesInit<FacingInit>
{
public readonly WRange CruiseAltitude = new WRange(1280);
public readonly WRange IdealSeparation = new WRange(1706);
public readonly WDist CruiseAltitude = new WDist(1280);
public readonly WDist IdealSeparation = new WDist(1706);
[Desc("Whether the aircraft can be repulsed.")]
public readonly bool Repulsable = true;
[Desc("The speed at which the aircraft is repulsed from other aircraft. Specify -1 for normal movement speed.")]
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
public virtual object Create(ActorInitializer init) { return new Aircraft(init, this); }
public int GetInitialFacing() { return InitialFacing; }
public WRange GetCruiseAltitude() { return CruiseAltitude; }
public WDist GetCruiseAltitude() { return CruiseAltitude; }
[VoiceReference] public readonly string Voice = "Action";

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly bool Spins = true;
public readonly bool Moves = false;
public readonly WRange Velocity = new WRange(43);
public readonly WDist Velocity = new WDist(43);
public object Create(ActorInitializer init) { return new FallsToEarth(init.Self, this); }
}

View File

@@ -25,10 +25,10 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Allow the helicopter turn before landing.")]
public readonly bool TurnToLand = false;
public readonly WRange LandAltitude = WRange.Zero;
public readonly WDist LandAltitude = WDist.Zero;
[Desc("How fast the helicopter ascends or descends.")]
public readonly WRange AltitudeVelocity = new WRange(43);
public readonly WDist AltitudeVelocity = new WDist(43);
public override object Create(ActorInitializer init) { return new Helicopter(init, this); }
}
@@ -145,9 +145,9 @@ namespace OpenRA.Mods.Common.Traits
public Activity MoveTo(CPos cell, int nearEnough) { return new HeliFly(self, Target.FromCell(self.World, cell)); }
public Activity MoveTo(CPos cell, Actor ignoredActor) { return new HeliFly(self, Target.FromCell(self.World, cell)); }
public Activity MoveWithinRange(Target target, WRange range) { return new HeliFly(self, target, WRange.Zero, range); }
public Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange) { return new HeliFly(self, target, minRange, maxRange); }
public Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange) { return new Follow(self, target, minRange, maxRange); }
public Activity MoveWithinRange(Target target, WDist range) { return new HeliFly(self, target, WDist.Zero, range); }
public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange) { return new HeliFly(self, target, minRange, maxRange); }
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange) { return new Follow(self, target, minRange, maxRange); }
public CPos NearestMoveableCell(CPos cell) { return cell; }
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any)

View File

@@ -128,13 +128,13 @@ namespace OpenRA.Mods.Common.Traits
public Activity MoveTo(CPos cell, int nearEnough) { return Util.SequenceActivities(new Fly(self, Target.FromCell(self.World, cell)), new FlyCircle(self)); }
public Activity MoveTo(CPos cell, Actor ignoredActor) { return Util.SequenceActivities(new Fly(self, Target.FromCell(self.World, cell)), new FlyCircle(self)); }
public Activity MoveWithinRange(Target target, WRange range) { return Util.SequenceActivities(new Fly(self, target, WRange.Zero, range), new FlyCircle(self)); }
public Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange)
public Activity MoveWithinRange(Target target, WDist range) { return Util.SequenceActivities(new Fly(self, target, WDist.Zero, range), new FlyCircle(self)); }
public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange)
{
return Util.SequenceActivities(new Fly(self, target, minRange, maxRange), new FlyCircle(self));
}
public Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange) { return new FlyFollow(self, target, minRange, maxRange); }
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange) { return new FlyFollow(self, target, minRange, maxRange); }
public CPos NearestMoveableCell(CPos cell) { return cell; }
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any) { return new Fly(self, Target.FromCell(self.World, cell)); }
@@ -143,7 +143,7 @@ namespace OpenRA.Mods.Common.Traits
return Util.SequenceActivities(new CallFunc(() => SetVisualPosition(self, fromPos)), new Fly(self, Target.FromPos(toPos)));
}
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WRange.FromCells(3), WRange.FromCells(5)); }
public Activity MoveToTarget(Actor self, Target target) { return new Fly(self, target, WDist.FromCells(3), WDist.FromCells(5)); }
public Activity MoveIntoTarget(Actor self, Target target) { return new Land(self, target); }
}
}

View File

@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Traits
public readonly WAngle[] LocalYaw = { };
[Desc("Move the turret backwards when firing.")]
public readonly WRange Recoil = WRange.Zero;
public readonly WDist Recoil = WDist.Zero;
[Desc("Recoil recovery per-frame")]
public readonly WRange RecoilRecovery = new WRange(9);
public readonly WDist RecoilRecovery = new WDist(9);
[Desc("Muzzle flash sequence to render")]
public readonly string MuzzleSequence = null;
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
Lazy<AmmoPool> ammoPool;
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
public WRange Recoil;
public WDist Recoil;
public int FireDelay { get; private set; }
public int Burst { get; private set; }
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits
if (FireDelay > 0)
--FireDelay;
Recoil = new WRange(Math.Max(0, Recoil.Range - Info.RecoilRecovery.Range));
Recoil = new WDist(Math.Max(0, Recoil.Range - Info.RecoilRecovery.Range));
for (var i = 0; i < delayedActions.Count; i++)
{
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
if (!target.IsInRange(self.CenterPosition, Weapon.Range))
return null;
if (Weapon.MinRange != WRange.Zero && target.IsInRange(self.CenterPosition, Weapon.MinRange))
if (Weapon.MinRange != WDist.Zero && target.IsInRange(self.CenterPosition, Weapon.MinRange))
return null;
if (!Weapon.IsValidAgainst(target, self.World, self))
@@ -215,7 +215,7 @@ namespace OpenRA.Mods.Common.Traits
public WVec MuzzleOffset(Actor self, Barrel b)
{
var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
var localOffset = b.Offset + new WVec(-Recoil, WRange.Zero, WRange.Zero);
var localOffset = b.Offset + new WVec(-Recoil, WDist.Zero, WDist.Zero);
if (turret.Value != null)
{
var turretOrientation = coords.Value.QuantizeOrientation(self, turret.Value.LocalOrientation(self));

View File

@@ -162,23 +162,23 @@ namespace OpenRA.Mods.Common.Traits
return Armaments.Any(a => a.Weapon.IsValidAgainst(t, self.World, self));
}
public WRange GetMinimumRange()
public WDist GetMinimumRange()
{
if (IsTraitDisabled)
return WRange.Zero;
return WDist.Zero;
return Armaments.Where(a => !a.IsTraitDisabled)
.Select(a => a.Weapon.MinRange).Min();
}
public WRange GetMaximumRange()
public WDist GetMaximumRange()
{
if (IsTraitDisabled)
return WRange.Zero;
return WDist.Zero;
return Armaments.Where(a => !a.IsTraitDisabled)
.Select(a => a.Weapon.Range)
.Append(WRange.Zero).Max();
.Append(WDist.Zero).Max();
}
public Armament ChooseArmamentForTarget(Target t) { return Armaments.FirstOrDefault(a => a.Weapon.IsValidAgainst(t, self.World, self)); }

View File

@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
|| (target.Type == TargetType.FrozenActor && target.FrozenActor.Info.Traits.Contains<IMove>());
// Try and sit at least one cell closer than the max range to give some leeway if the target starts moving.
var maxRange = targetIsMobile ? new WRange(Math.Max(weapon.Weapon.MinRange.Range, weapon.Weapon.Range.Range - 1024))
var maxRange = targetIsMobile ? new WDist(Math.Max(weapon.Weapon.MinRange.Range, weapon.Weapon.Range.Range - 1024))
: weapon.Weapon.Range;
attack.Target = target;

View File

@@ -123,7 +123,7 @@ namespace OpenRA.Mods.Common.Traits
{
if (nextScanTime <= 0)
{
var range = info.ScanRadius > 0 ? WRange.FromCells(info.ScanRadius) : attack.GetMaximumRange();
var range = info.ScanRadius > 0 ? WDist.FromCells(info.ScanRadius) : attack.GetMaximumRange();
if (self.IsIdle || currentTarget == null || !Target.FromActor(currentTarget).IsInRange(self.CenterPosition, range))
return ChooseTarget(self, range);
}
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.Common.Traits
attack.AttackTarget(target, false, info.AllowMovement && Stance != UnitStance.Defend);
}
Actor ChooseTarget(Actor self, WRange range)
Actor ChooseTarget(Actor self, WDist range)
{
nextScanTime = self.World.SharedRandom.Next(info.MinimumScanTimeInterval, info.MaximumScanTimeInterval);
var inRange = self.World.FindActorsInCircle(self.CenterPosition, range);

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
yield return new RangeCircleRenderable(
self.CenterPosition,
WRange.FromCells(Info.Range),
WDist.FromCells(Info.Range),
0,
Color.FromArgb(128, Ready() ? Color.White : Color.Red),
Color.FromArgb(96, Color.Black));

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Traits
// Range is counted from the center of the actor, not from each cell.
var target = Target.FromPos(bp.Actor.CenterPosition);
if (target.IsInRange(center, WRange.FromCells(bp.Trait.Info.Range)))
if (target.IsInRange(center, WDist.FromCells(bp.Trait.Info.Range)))
return bp.Actor;
}

View File

@@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits
return self.World.ActorsWithTrait<DetectCloaked>().Any(a => !a.Trait.IsTraitDisabled && a.Actor.Owner.IsAlliedWith(viewer)
&& Info.CloakTypes.Intersect(a.Trait.Info.CloakTypes).Any()
&& (self.CenterPosition - a.Actor.CenterPosition).Length <= WRange.FromCells(a.Trait.Info.Range).Range);
&& (self.CenterPosition - a.Actor.CenterPosition).Length <= WDist.FromCells(a.Trait.Info.Range).Range);
}
public Color RadarColorOverride(Actor self)

View File

@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Duration = 0;
[Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")]
public readonly WRange Range = new WRange(3);
public readonly WDist Range = new WDist(3);
[Desc("The maximum number of extra collectors to grant the crate action to.", "-1 = no limit")]
public readonly int MaxExtraCollectors = 4;

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int Levels = 1;
[Desc("The range to search for extra collectors in.", "Extra collectors will also be granted the crate action.")]
public readonly WRange Range = new WRange(3);
public readonly WDist Range = new WDist(3);
[Desc("The maximum number of extra collectors to grant the crate action to.")]
public readonly int MaxExtraCollectors = 4;

View File

@@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.SetTargetLine(target, Color.Yellow);
var range = WRange.FromCells(target.Actor.Info.Traits.Get<GuardableInfo>().Range);
self.QueueActivity(false, new AttackMoveActivity(self, self.Trait<IMove>().MoveFollow(self, target, WRange.Zero, range)));
var range = WDist.FromCells(target.Actor.Info.Traits.Get<GuardableInfo>().Range);
self.QueueActivity(false, new AttackMoveActivity(self, self.Trait<IMove>().MoveFollow(self, target, WDist.Zero, range)));
}
public string VoicePhraseForOrder(Actor self, Order order)

View File

@@ -717,9 +717,9 @@ namespace OpenRA.Mods.Common.Traits
public Activity ScriptedMove(CPos cell) { return new Move(self, cell); }
public Activity MoveTo(CPos cell, int nearEnough) { return new Move(self, cell, nearEnough); }
public Activity MoveTo(CPos cell, Actor ignoredActor) { return new Move(self, cell, ignoredActor); }
public Activity MoveWithinRange(Target target, WRange range) { return new MoveWithinRange(self, target, WRange.Zero, range); }
public Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange) { return new MoveWithinRange(self, target, minRange, maxRange); }
public Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange) { return new Follow(self, target, minRange, maxRange); }
public Activity MoveWithinRange(Target target, WDist range) { return new MoveWithinRange(self, target, WDist.Zero, range); }
public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange) { return new MoveWithinRange(self, target, minRange, maxRange); }
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange) { return new Follow(self, target, minRange, maxRange); }
public Activity MoveTo(Func<List<CPos>> pathFunc) { return new Move(self, pathFunc); }
public void OnNotifyBlockingMove(Actor self, Actor blocking)

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public class ParaDropInfo : ITraitInfo, Requires<CargoInfo>
{
[Desc("Distance around the drop-point to unload troops.")]
public readonly WRange DropRange = WRange.FromCells(4);
public readonly WDist DropRange = WDist.FromCells(4);
[Desc("Sound to play when dropping.")]
public readonly string ChuteSound = "chute1.aud";

View File

@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int MaxAlternateTransportAttempts = 1;
[Desc("Range from self for looking for an alternate transport (default: 5.5 cells).")]
public readonly WRange AlternateTransportScanRange = WRange.FromCells(11) / 2;
public readonly WDist AlternateTransportScanRange = WDist.FromCells(11) / 2;
[Desc("Upgrade types to grant to transport.")]
public readonly string[] GrantUpgrades = { };

View File

@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<Actor> UnitsInRange()
{
return Self.World.FindActorsInCircle(Self.CenterPosition, WRange.FromCells(Info.Range))
return Self.World.FindActorsInCircle(Self.CenterPosition, WDist.FromCells(Info.Range))
.Where(a => a.IsInWorld && a != Self && !a.Disposed && !a.Owner.NonCombatant);
}

View File

@@ -35,10 +35,10 @@ namespace OpenRA.Mods.Common.Traits
var range = self.TraitsImplementing<DetectCloaked>()
.Where(a => !a.IsTraitDisabled)
.Select(a => WRange.FromCells(a.Info.Range))
.Append(WRange.Zero).Max();
.Select(a => WDist.FromCells(a.Info.Range))
.Append(WDist.Zero).Max();
if (range == WRange.Zero)
if (range == WDist.Zero)
yield break;
yield return new RangeCircleRenderable(

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string RangeCircleType = null;
[Desc("Range to draw if no armaments are available")]
public readonly WRange FallbackRange = WRange.Zero;
public readonly WDist FallbackRange = WDist.Zero;
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
if (armaments.Any())
range = armaments.Select(a => w.Map.Rules.Weapons[a.Weapon.ToLowerInvariant()].Range).Max();
if (range == WRange.Zero)
if (range == WDist.Zero)
yield break;
yield return new RangeCircleRenderable(
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits
yield break;
var range = attack.GetMaximumRange();
if (range == WRange.Zero)
if (range == WDist.Zero)
yield break;
yield return new RangeCircleRenderable(

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits
WVec BarrelOffset()
{
var localOffset = info.LocalOffset + new WVec(-armament.Recoil, WRange.Zero, WRange.Zero);
var localOffset = info.LocalOffset + new WVec(-armament.Recoil, WDist.Zero, WDist.Zero);
var turretOffset = turreted != null ? turreted.Position(self) : WVec.Zero;
var turretOrientation = turreted != null ? turreted.LocalOrientation(self) : WRot.Zero;

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly Color Color = Color.FromArgb(128, Color.White);
[Desc("Range of the circle")]
public readonly WRange Range = WRange.Zero;
public readonly WDist Range = WDist.Zero;
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{

View File

@@ -91,8 +91,8 @@ namespace OpenRA.Mods.Common.Traits
if (!Info.Recoils)
return t.Position(self);
var recoil = arms.Aggregate(WRange.Zero, (a, b) => a + b.Recoil);
var localOffset = new WVec(-recoil, WRange.Zero, WRange.Zero);
var recoil = arms.Aggregate(WDist.Zero, (a, b) => a + b.Recoil);
var localOffset = new WVec(-recoil, WDist.Zero, WDist.Zero);
var bodyOrientation = body.QuantizeOrientation(self, self.Orientation);
var turretOrientation = body.QuantizeOrientation(self, t.LocalOrientation(self));
return t.Position(self) + body.LocalToWorld(localOffset.Rotate(turretOrientation).Rotate(bodyOrientation));

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
WVec BarrelOffset()
{
var localOffset = info.LocalOffset + new WVec(-armament.Recoil, WRange.Zero, WRange.Zero);
var localOffset = info.LocalOffset + new WVec(-armament.Recoil, WDist.Zero, WDist.Zero);
var turretOffset = turreted != null ? turreted.Position(self) : WVec.Zero;
var turretOrientation = turreted != null ? turreted.LocalOrientation(self) : WRot.Zero;

View File

@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits
var target = Target.FromOrder(self.World, order);
self.CancelActivity();
self.QueueActivity(movement.MoveWithinRange(target, new WRange(1024 * info.CloseEnough)));
self.QueueActivity(movement.MoveWithinRange(target, new WDist(1024 * info.CloseEnough)));
self.QueueActivity(new Repair(order.TargetActor));
self.SetTargetLine(target, Color.Green, false);

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class RevealsShroudInfo : ITraitInfo
{
public readonly WRange Range = WRange.Zero;
public readonly WDist Range = WDist.Zero;
[Desc("Possible values are CenterPosition (measure range from the center) and ",
"Footprint (measure range from the footprint)")]
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Traits
{
var map = self.World.Map;
var range = Range;
if (range == WRange.Zero)
if (range == WDist.Zero)
return NoCells;
if (info.Type == VisibilityType.Footprint)
@@ -101,6 +101,6 @@ namespace OpenRA.Mods.Common.Traits
removeCellsFromPlayerShroud(p);
}
public WRange Range { get { return cachedDisabled ? WRange.Zero : info.Range; } }
public WDist Range { get { return cachedDisabled ? WDist.Zero : info.Range; } }
}
}

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly WVec SquadOffset = new WVec(-1536, 1536, 0);
public readonly int QuantizedFacings = 32;
public readonly WRange Cordon = new WRange(5120);
public readonly WDist Cordon = new WDist(5120);
[ActorReference]
[Desc("Actor to spawn when the aircraft start attacking")]
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int CameraRemoveDelay = 25;
[Desc("Weapon range offset to apply during the beacon clock calculation")]
public readonly WRange BeaconDistanceOffset = WRange.FromCells(6);
public readonly WDist BeaconDistanceOffset = WDist.FromCells(6);
public override object Create(ActorInitializer init) { return new AirstrikePower(init.Self, this); }
}

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int FlightDelay = 400;
[Desc("Visual ascent velocity in WRange / tick")]
public readonly WRange FlightVelocity = new WRange(512);
public readonly WDist FlightVelocity = new WDist(512);
[Desc("Descend immediately on the target, with half the FlightDelay")]
public readonly bool SkipAscent = false;

View File

@@ -21,10 +21,10 @@ namespace OpenRA.Mods.Common.Traits
public readonly WVec Offset = WVec.Zero;
[Desc("Minimum distance to throw the particle")]
public readonly WRange MinThrowRange = new WRange(256);
public readonly WDist MinThrowRange = new WDist(256);
[Desc("Maximum distance to throw the particle")]
public readonly WRange MaxThrowRange = new WRange(768);
public readonly WDist MaxThrowRange = new WDist(768);
[Desc("Minimum angle to throw the particle")]
public readonly WAngle MinThrowAngle = WAngle.FromDegrees(30);
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
length = (finalPos - initialPos).Length / info.Velocity;
// Facing rotation
rotation = WRange.FromPDF(Game.CosmeticRandom, 2).Range * info.ROT / 1024;
rotation = WDist.FromPDF(Game.CosmeticRandom, 2).Range * info.ROT / 1024;
var anim = new Animation(init.World, rs.GetImage(self), () => (int)facing);
anim.PlayRepeating(info.Anim);

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] Upgrades = { };
[Desc("The range to search for actors to upgrade.")]
public readonly WRange Range = WRange.FromCells(3);
public readonly WDist Range = WDist.FromCells(3);
[Desc("What diplomatic stances are affected.")]
public readonly Stance ValidStances = Stance.Ally;
@@ -44,8 +44,8 @@ namespace OpenRA.Mods.Common.Traits
int proximityTrigger;
WPos cachedPosition;
WRange cachedRange;
WRange desiredRange;
WDist cachedRange;
WDist desiredRange;
bool cachedDisabled = true;
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
if (cachedDisabled != disabled)
{
Sound.Play(disabled ? info.DisableSound : info.EnableSound, self.CenterPosition);
desiredRange = disabled ? WRange.Zero : info.Range;
desiredRange = disabled ? WDist.Zero : info.Range;
cachedDisabled = disabled;
}

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int QuantizedFacings = 32;
[Desc("Spawn and remove the plane this far outside the map.")]
public readonly WRange Cordon = new WRange(5120);
public readonly WDist Cordon = new WDist(5120);
public object Create(ActorInitializer init) { return new CrateSpawner(this, init.Self); }
}

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{
public class MPStartLocationsInfo : ITraitInfo
{
public readonly WRange InitialExploreRange = WRange.FromCells(5);
public readonly WDist InitialExploreRange = WDist.FromCells(5);
public virtual object Create(ActorInitializer init) { return new MPStartLocations(this); }
}

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
/// <returns>A path from start to target</returns>
List<CPos> FindUnitPath(CPos source, CPos target, Actor self);
List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self);
List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self);
/// <summary>
/// Calculates a path given a search specification
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
return pb;
}
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self)
{
var mi = self.Info.Traits.Get<MobileInfo>();
var targetCell = world.Map.CellContaining(target);

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
public interface INotifyChat { bool OnChat(string from, string message); }
public interface INotifyParachuteLanded { void OnLanded(); }
public interface IRenderActorPreviewInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); }
public interface ICruiseAltitudeInfo { WRange GetCruiseAltitude(); }
public interface ICruiseAltitudeInfo { WDist GetCruiseAltitude(); }
public interface IUpgradable
{
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
public interface ICallForTransport
{
WRange MinimumDistance { get; }
WDist MinimumDistance { get; }
bool WantsTransport { get; set; }
void MovementCancelled(Actor self);
void RequestTransport(CPos destination, Activity afterLandActivity);

View File

@@ -149,7 +149,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (t == typeof(WPos))
return "3D World Position";
if (t == typeof(WRange))
if (t == typeof(WDist))
return "1D World Range";
if (t == typeof(WVec))

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Warheads
[Desc("Duration of the upgrade (in ticks). Set to 0 for a permanent upgrade.")]
public readonly int Duration = 0;
public readonly WRange Range = WRange.FromCells(1);
public readonly WDist Range = WDist.FromCells(1);
// TODO: This can be removed after the legacy and redundant 0% = not targetable
// assumption has been removed from the yaml definitions

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Warheads
public class HealthPercentageDamageWarhead : DamageWarhead
{
[Desc("Size of the area. Damage will be applied to this area.", "If two spreads are defined, the area of effect is a ring, where the second value is the inner radius.")]
public readonly WRange[] Spread = { new WRange(43) };
public readonly WDist[] Spread = { new WDist(43) };
public override void DoImpact(WPos pos, Actor firedBy, IEnumerable<int> damageModifiers)
{

View File

@@ -17,13 +17,13 @@ namespace OpenRA.Mods.Common.Warheads
public class SpreadDamageWarhead : DamageWarhead
{
[Desc("Range between falloff steps.")]
public readonly WRange Spread = new WRange(43);
public readonly WDist Spread = new WDist(43);
[Desc("Damage percentage at each range step")]
public readonly int[] Falloff = { 100, 37, 14, 5, 2, 1, 0 };
[Desc("Ranges at which each Falloff step is defined. Overrides Spread.")]
public WRange[] Range = null;
public WDist[] Range = null;
public void InitializeRange()
{