diff --git a/OpenRA.Game/FieldLoader.cs b/OpenRA.Game/FieldLoader.cs
index ebc0a4d074..21806ea98e 100644
--- a/OpenRA.Game/FieldLoader.cs
+++ b/OpenRA.Game/FieldLoader.cs
@@ -243,10 +243,10 @@ namespace OpenRA
return InvalidValueAction(value, fieldType, fieldName);
}
- else if (fieldType == typeof(WRange))
+ else if (fieldType == typeof(WDist))
{
- WRange res;
- if (WRange.TryParse(value, out res))
+ WDist res;
+ if (WDist.TryParse(value, out res))
return res;
return InvalidValueAction(value, fieldType, fieldName);
@@ -258,8 +258,8 @@ namespace OpenRA
var parts = value.Split(',');
if (parts.Length == 3)
{
- WRange rx, ry, rz;
- if (WRange.TryParse(parts[0], out rx) && WRange.TryParse(parts[1], out ry) && WRange.TryParse(parts[2], out rz))
+ WDist rx, ry, rz;
+ if (WDist.TryParse(parts[0], out rx) && WDist.TryParse(parts[1], out ry) && WDist.TryParse(parts[2], out rz))
return new WVec(rx, ry, rz);
}
}
@@ -279,8 +279,8 @@ namespace OpenRA
for (var i = 0; i < vecs.Length; ++i)
{
- WRange rx, ry, rz;
- if (WRange.TryParse(parts[3 * i], out rx) && WRange.TryParse(parts[3 * i + 1], out ry) && WRange.TryParse(parts[3 * i + 2], out rz))
+ WDist rx, ry, rz;
+ if (WDist.TryParse(parts[3 * i], out rx) && WDist.TryParse(parts[3 * i + 1], out ry) && WDist.TryParse(parts[3 * i + 2], out rz))
vecs[i] = new WVec(rx, ry, rz);
}
@@ -296,8 +296,8 @@ namespace OpenRA
var parts = value.Split(',');
if (parts.Length == 3)
{
- WRange rx, ry, rz;
- if (WRange.TryParse(parts[0], out rx) && WRange.TryParse(parts[1], out ry) && WRange.TryParse(parts[2], out rz))
+ WDist rx, ry, rz;
+ if (WDist.TryParse(parts[0], out rx) && WDist.TryParse(parts[1], out ry) && WDist.TryParse(parts[2], out rz))
return new WPos(rx, ry, rz);
}
}
diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs
index 0204db6ebf..3e5da809e0 100644
--- a/OpenRA.Game/GameRules/WeaponInfo.cs
+++ b/OpenRA.Game/GameRules/WeaponInfo.cs
@@ -33,7 +33,7 @@ namespace OpenRA.GameRules
public sealed class WeaponInfo
{
[Desc("The maximum range the weapon can fire.")]
- public readonly WRange Range = WRange.Zero;
+ public readonly WDist Range = WDist.Zero;
[Desc("The sound played when the weapon is fired.")]
public readonly string[] Report = null;
@@ -56,7 +56,7 @@ namespace OpenRA.GameRules
public readonly int BurstDelay = 5;
[Desc("The minimum range the weapon can fire.")]
- public readonly WRange MinRange = WRange.Zero;
+ public readonly WDist MinRange = WDist.Zero;
[FieldLoader.LoadUsing("LoadProjectile")]
public readonly IProjectileInfo Projectile;
diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs
index 4b256be4da..36b8710e47 100644
--- a/OpenRA.Game/Graphics/WorldRenderer.cs
+++ b/OpenRA.Game/Graphics/WorldRenderer.cs
@@ -194,7 +194,7 @@ namespace OpenRA.Graphics
new SelectionBarsRenderable(unit).Render(this);
}
- public void DrawRangeCircle(WPos pos, WRange range, Color c)
+ public void DrawRangeCircle(WPos pos, WDist range, Color c)
{
var offset = new WVec(range.Range, 0, 0);
for (var i = 0; i < 32; i++)
diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs
index d018607c7a..a61b209892 100644
--- a/OpenRA.Game/Map/Map.cs
+++ b/OpenRA.Game/Map/Map.cs
@@ -841,13 +841,13 @@ namespace OpenRA
return new MPos(x, y).ToCPos(this);
}
- public WRange DistanceToEdge(WPos pos, WVec dir)
+ public WDist DistanceToEdge(WPos pos, WVec dir)
{
var tl = CenterOfCell(CellsInsideBounds.TopLeft) - new WVec(512, 512, 0);
var br = CenterOfCell(CellsInsideBounds.BottomRight) + new WVec(511, 511, 0);
var x = dir.X == 0 ? int.MaxValue : ((dir.X < 0 ? tl.X : br.X) - pos.X) / dir.X;
var y = dir.Y == 0 ? int.MaxValue : ((dir.Y < 0 ? tl.Y : br.Y) - pos.Y) / dir.Y;
- return new WRange(Math.Min(x, y) * dir.Length);
+ return new WDist(Math.Min(x, y) * dir.Length);
}
static readonly CVec[][] TilesByDistance = InitTilesByDistance(MaxTilesInCircleRange);
diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj
index dd44c4ef27..29f7099e1d 100644
--- a/OpenRA.Game/OpenRA.Game.csproj
+++ b/OpenRA.Game/OpenRA.Game.csproj
@@ -305,8 +305,8 @@
+
-
diff --git a/OpenRA.Game/Sync.cs b/OpenRA.Game/Sync.cs
old mode 100755
new mode 100644
index df9de99955..905c2bd3ab
--- a/OpenRA.Game/Sync.cs
+++ b/OpenRA.Game/Sync.cs
@@ -36,7 +36,7 @@ namespace OpenRA
{ typeof(int2), ((Func)HashInt2).Method },
{ typeof(CPos), ((Func)HashCPos).Method },
{ typeof(CVec), ((Func)HashCVec).Method },
- { typeof(WRange), ((Func)Hash).Method },
+ { typeof(WDist), ((Func)Hash).Method },
{ typeof(WPos), ((Func)Hash).Method },
{ typeof(WVec), ((Func)Hash).Method },
{ typeof(WAngle), ((Func)Hash).Method },
diff --git a/OpenRA.Game/Traits/Health.cs b/OpenRA.Game/Traits/Health.cs
old mode 100755
new mode 100644
index 42f35781e3..2771fab657
--- a/OpenRA.Game/Traits/Health.cs
+++ b/OpenRA.Game/Traits/Health.cs
@@ -18,7 +18,7 @@ namespace OpenRA.Traits
public readonly int HP = 0;
[Desc("Physical size of the unit used for damage calculations. Impacts within this radius apply full damage.")]
- public readonly WRange Radius = new WRange(426);
+ public readonly WDist Radius = new WDist(426);
[Desc("Trigger interfaces such as AnnounceOnKill?")]
public readonly bool NotifyAppliedDamage = true;
diff --git a/OpenRA.Game/Traits/Target.cs b/OpenRA.Game/Traits/Target.cs
index 7ab4337e38..ecb11793ae 100644
--- a/OpenRA.Game/Traits/Target.cs
+++ b/OpenRA.Game/Traits/Target.cs
@@ -140,7 +140,7 @@ namespace OpenRA.Traits
}
}
- public bool IsInRange(WPos origin, WRange range)
+ public bool IsInRange(WPos origin, WDist range)
{
if (Type == TargetType.Invalid)
return false;
diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs
index 5e76697ac1..f6845d7187 100644
--- a/OpenRA.Game/Traits/TraitsInterfaces.cs
+++ b/OpenRA.Game/Traits/TraitsInterfaces.cs
@@ -234,9 +234,9 @@ namespace OpenRA.Traits
{
Activity MoveTo(CPos cell, int nearEnough);
Activity MoveTo(CPos cell, Actor ignoredActor);
- Activity MoveWithinRange(Target target, WRange range);
- Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange);
- Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange);
+ Activity MoveWithinRange(Target target, WDist range);
+ Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange);
+ Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange);
Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any);
Activity MoveToTarget(Actor self, Target target);
Activity MoveIntoTarget(Actor self, Target target);
diff --git a/OpenRA.Game/Traits/World/ActorMap.cs b/OpenRA.Game/Traits/World/ActorMap.cs
index 5d8791073c..c5ef9b9b1a 100644
--- a/OpenRA.Game/Traits/World/ActorMap.cs
+++ b/OpenRA.Game/Traits/World/ActorMap.cs
@@ -90,7 +90,7 @@ namespace OpenRA.Traits
{
public readonly int Id;
public WPos Position { get; private set; }
- public WRange Range { get; private set; }
+ public WDist Range { get; private set; }
public WPos TopLeft { get; private set; }
public WPos BottomRight { get; private set; }
@@ -102,7 +102,7 @@ namespace OpenRA.Traits
IEnumerable currentActors = Enumerable.Empty();
- public ProximityTrigger(int id, WPos pos, WRange range, Action onActorEntered, Action onActorExited)
+ public ProximityTrigger(int id, WPos pos, WDist range, Action onActorEntered, Action onActorExited)
{
Id = id;
@@ -112,12 +112,12 @@ namespace OpenRA.Traits
Update(pos, range);
}
- public void Update(WPos newPos, WRange newRange)
+ public void Update(WPos newPos, WDist newRange)
{
Position = newPos;
Range = newRange;
- var offset = new WVec(newRange, newRange, WRange.Zero);
+ var offset = new WVec(newRange, newRange, WDist.Zero);
TopLeft = newPos - offset;
BottomRight = newPos + offset;
@@ -130,7 +130,7 @@ namespace OpenRA.Traits
return;
var oldActors = currentActors;
- var delta = new WVec(Range, Range, WRange.Zero);
+ var delta = new WVec(Range, Range, WDist.Zero);
currentActors = am.ActorsInBox(Position - delta, Position + delta)
.Where(a => (a.CenterPosition - Position).HorizontalLengthSquared < Range.RangeSquared)
.ToList();
@@ -407,7 +407,7 @@ namespace OpenRA.Traits
}
}
- public int AddProximityTrigger(WPos pos, WRange range, Action onEntry, Action onExit)
+ public int AddProximityTrigger(WPos pos, WDist range, Action onEntry, Action onExit)
{
var id = nextTriggerId++;
var t = new ProximityTrigger(id, pos, range, onEntry, onExit);
@@ -431,7 +431,7 @@ namespace OpenRA.Traits
t.Dispose();
}
- public void UpdateProximityTrigger(int id, WPos newPos, WRange newRange)
+ public void UpdateProximityTrigger(int id, WPos newPos, WDist newRange)
{
ProximityTrigger t;
if (!proximityTriggers.TryGetValue(id, out t))
diff --git a/OpenRA.Game/Traits/World/Shroud.cs b/OpenRA.Game/Traits/World/Shroud.cs
index b9abb70567..4eed4b12fd 100644
--- a/OpenRA.Game/Traits/World/Shroud.cs
+++ b/OpenRA.Game/Traits/World/Shroud.cs
@@ -72,7 +72,7 @@ namespace OpenRA.Traits
Hash += 1;
}
- public static IEnumerable CellsInRange(Map map, WPos pos, WRange range)
+ public static IEnumerable CellsInRange(Map map, WPos pos, WDist range)
{
var r = (range.Range + 1023) / 1024;
var limit = range.RangeSquared;
@@ -83,7 +83,7 @@ namespace OpenRA.Traits
yield return c;
}
- public static IEnumerable CellsInRange(Map map, CPos cell, WRange range)
+ public static IEnumerable CellsInRange(Map map, CPos cell, WDist range)
{
return CellsInRange(map, map.CenterOfCell(cell), range);
}
diff --git a/OpenRA.Game/WRange.cs b/OpenRA.Game/WDist.cs
similarity index 55%
rename from OpenRA.Game/WRange.cs
rename to OpenRA.Game/WDist.cs
index 5255930c47..a2c91bc85d 100644
--- a/OpenRA.Game/WRange.cs
+++ b/OpenRA.Game/WDist.cs
@@ -20,43 +20,43 @@ namespace OpenRA
///
/// 1d world distance - 1024 units = 1 cell.
///
- public struct WRange : IComparable, IComparable, IEquatable, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding
+ public struct WDist : IComparable, IComparable, IEquatable, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding
{
public readonly int Range;
public long RangeSquared { get { return (long)Range * (long)Range; } }
- public WRange(int r) { Range = r; }
- public static readonly WRange Zero = new WRange(0);
- public static WRange FromCells(int cells) { return new WRange(1024 * cells); }
+ public WDist(int r) { Range = r; }
+ public static readonly WDist Zero = new WDist(0);
+ public static WDist FromCells(int cells) { return new WDist(1024 * cells); }
- public static WRange operator +(WRange a, WRange b) { return new WRange(a.Range + b.Range); }
- public static WRange operator -(WRange a, WRange b) { return new WRange(a.Range - b.Range); }
- public static WRange operator -(WRange a) { return new WRange(-a.Range); }
- public static WRange operator /(WRange a, int b) { return new WRange(a.Range / b); }
- public static WRange operator *(WRange a, int b) { return new WRange(a.Range * b); }
- public static WRange operator *(int a, WRange b) { return new WRange(a * b.Range); }
- public static bool operator <(WRange a, WRange b) { return a.Range < b.Range; }
- public static bool operator >(WRange a, WRange b) { return a.Range > b.Range; }
- public static bool operator <=(WRange a, WRange b) { return a.Range <= b.Range; }
- public static bool operator >=(WRange a, WRange b) { return a.Range >= b.Range; }
+ public static WDist operator +(WDist a, WDist b) { return new WDist(a.Range + b.Range); }
+ public static WDist operator -(WDist a, WDist b) { return new WDist(a.Range - b.Range); }
+ public static WDist operator -(WDist a) { return new WDist(-a.Range); }
+ public static WDist operator /(WDist a, int b) { return new WDist(a.Range / b); }
+ public static WDist operator *(WDist a, int b) { return new WDist(a.Range * b); }
+ public static WDist operator *(int a, WDist b) { return new WDist(a * b.Range); }
+ public static bool operator <(WDist a, WDist b) { return a.Range < b.Range; }
+ public static bool operator >(WDist a, WDist b) { return a.Range > b.Range; }
+ public static bool operator <=(WDist a, WDist b) { return a.Range <= b.Range; }
+ public static bool operator >=(WDist a, WDist b) { return a.Range >= b.Range; }
- public static bool operator ==(WRange me, WRange other) { return me.Range == other.Range; }
- public static bool operator !=(WRange me, WRange other) { return !(me == other); }
+ public static bool operator ==(WDist me, WDist other) { return me.Range == other.Range; }
+ public static bool operator !=(WDist me, WDist other) { return !(me == other); }
// Sampled a N-sample probability density function in the range [-1024..1024]
// 1 sample produces a rectangular probability
// 2 samples produces a triangular probability
// ...
// N samples approximates a true gaussian
- public static WRange FromPDF(MersenneTwister r, int samples)
+ public static WDist FromPDF(MersenneTwister r, int samples)
{
- return new WRange(Exts.MakeArray(samples, _ => r.Next(-1024, 1024))
+ return new WDist(Exts.MakeArray(samples, _ => r.Next(-1024, 1024))
.Sum() / samples);
}
- public static bool TryParse(string s, out WRange result)
+ public static bool TryParse(string s, out WDist result)
{
- result = WRange.Zero;
+ result = WDist.Zero;
if (string.IsNullOrEmpty(s))
return false;
@@ -84,32 +84,32 @@ namespace OpenRA
if (cell < 0)
subcell = -subcell;
- result = new WRange(1024 * cell + subcell);
+ result = new WDist(1024 * cell + subcell);
return true;
}
public override int GetHashCode() { return Range.GetHashCode(); }
- public bool Equals(WRange other) { return other == this; }
- public override bool Equals(object obj) { return obj is WRange && Equals((WRange)obj); }
+ public bool Equals(WDist other) { return other == this; }
+ public override bool Equals(object obj) { return obj is WDist && Equals((WDist)obj); }
public int CompareTo(object obj)
{
- if (!(obj is WRange))
+ if (!(obj is WDist))
return 1;
- return Range.CompareTo(((WRange)obj).Range);
+ return Range.CompareTo(((WDist)obj).Range);
}
- public int CompareTo(WRange other) { return Range.CompareTo(other.Range); }
+ public int CompareTo(WDist other) { return Range.CompareTo(other.Range); }
public override string ToString() { return Range.ToString(); }
#region Scripting interface
public LuaValue Add(LuaRuntime runtime, LuaValue left, LuaValue right)
{
- WRange a;
- WRange b;
- if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
+ WDist a;
+ WDist b;
+ if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
throw new LuaException("Attempted to call WRange.Add(WRange, WRange) with invalid arguments.");
return new LuaCustomClrObject(a + b);
@@ -117,9 +117,9 @@ namespace OpenRA
public LuaValue Subtract(LuaRuntime runtime, LuaValue left, LuaValue right)
{
- WRange a;
- WRange b;
- if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
+ WDist a;
+ WDist b;
+ if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
throw new LuaException("Attempted to call WRange.Subtract(WRange, WRange) with invalid arguments.");
return new LuaCustomClrObject(a - b);
@@ -127,9 +127,9 @@ namespace OpenRA
public LuaValue Equals(LuaRuntime runtime, LuaValue left, LuaValue right)
{
- WRange a;
- WRange b;
- if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
+ WDist a;
+ WDist b;
+ if (!left.TryGetClrValue(out a) || !right.TryGetClrValue(out b))
throw new LuaException("Attempted to call WRange.Equals(WRange, WRange) with invalid arguments.");
return a == b;
diff --git a/OpenRA.Game/WPos.cs b/OpenRA.Game/WPos.cs
index 96da5f12e3..619aebb9e2 100644
--- a/OpenRA.Game/WPos.cs
+++ b/OpenRA.Game/WPos.cs
@@ -22,7 +22,7 @@ namespace OpenRA
public readonly int X, Y, Z;
public WPos(int x, int y, int z) { X = x; Y = y; Z = z; }
- public WPos(WRange x, WRange y, WRange z) { X = x.Range; Y = y.Range; Z = z.Range; }
+ public WPos(WDist x, WDist y, WDist z) { X = x.Range; Y = y.Range; Z = z.Range; }
public static readonly WPos Zero = new WPos(0, 0, 0);
diff --git a/OpenRA.Game/WVec.cs b/OpenRA.Game/WVec.cs
index f44c03e34b..70d8aa221b 100644
--- a/OpenRA.Game/WVec.cs
+++ b/OpenRA.Game/WVec.cs
@@ -21,7 +21,7 @@ namespace OpenRA
public readonly int X, Y, Z;
public WVec(int x, int y, int z) { X = x; Y = y; Z = z; }
- public WVec(WRange x, WRange y, WRange z) { X = x.Range; Y = y.Range; Z = z.Range; }
+ public WVec(WDist x, WDist y, WDist z) { X = x.Range; Y = y.Range; Z = z.Range; }
public static readonly WVec Zero = new WVec(0, 0, 0);
@@ -76,7 +76,7 @@ namespace OpenRA
// N samples approximates a true gaussian
public static WVec FromPDF(MersenneTwister r, int samples)
{
- return new WVec(WRange.FromPDF(r, samples), WRange.FromPDF(r, samples), WRange.Zero);
+ return new WVec(WDist.FromPDF(r, samples), WDist.FromPDF(r, samples), WDist.Zero);
}
public override int GetHashCode() { return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); }
diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs
index 84caa4b046..e251dc9258 100644
--- a/OpenRA.Game/WorldUtils.cs
+++ b/OpenRA.Game/WorldUtils.cs
@@ -30,12 +30,12 @@ namespace OpenRA
return actors.MinByOrDefault(a => (a.CenterPosition - pos).LengthSquared);
}
- public static IEnumerable FindActorsInCircle(this World world, WPos origin, WRange r)
+ public static IEnumerable FindActorsInCircle(this World world, WPos origin, WDist r)
{
using (new PerfSample("FindUnitsInCircle"))
{
// Target ranges are calculated in 2D, so ignore height differences
- var vec = new WVec(r, r, WRange.Zero);
+ var vec = new WVec(r, r, WDist.Zero);
return world.ActorMap.ActorsInBox(origin - vec, origin + vec).Where(
a => (a.CenterPosition - origin).HorizontalLengthSquared <= r.RangeSquared);
}
diff --git a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs
index e44633e7d9..94d6ed8d96 100644
--- a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs
+++ b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Cnc.Traits
var altitude = self.World.Map.Rules.Actors[actorType].Traits.Get().CruiseAltitude;
var actor = w.CreateActor(actorType, new TypeDictionary
{
- new CenterPositionInit(w.Map.CenterOfCell(startPos) + new WVec(WRange.Zero, WRange.Zero, altitude)),
+ new CenterPositionInit(w.Map.CenterOfCell(startPos) + new WVec(WDist.Zero, WDist.Zero, altitude)),
new OwnerInit(owner),
new FacingInit(64)
});
diff --git a/OpenRA.Mods.Common/AI/HackyAI.cs b/OpenRA.Mods.Common/AI/HackyAI.cs
index 188c1cc5d2..f0cc8edc88 100644
--- a/OpenRA.Mods.Common/AI/HackyAI.cs
+++ b/OpenRA.Mods.Common/AI/HackyAI.cs
@@ -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()).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()
&& unit.HasTrait());
diff --git a/OpenRA.Mods.Common/AI/States/AirStates.cs b/OpenRA.Mods.Common/AI/States/AirStates.cs
index 880ea20253..62432e90ed 100644
--- a/OpenRA.Mods.Common/AI/States/AirStates.cs
+++ b/OpenRA.Mods.Common/AI/States/AirStates.cs
@@ -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())
diff --git a/OpenRA.Mods.Common/AI/States/GroundStates.cs b/OpenRA.Mods.Common/AI/States/GroundStates.cs
index 4d59540678..ea8fc18297 100644
--- a/OpenRA.Mods.Common/AI/States/GroundStates.cs
+++ b/OpenRA.Mods.Common/AI/States/GroundStates.cs
@@ -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() && leader.Owner.Stances[a1.Owner] == Stance.Enemy);
var target = enemynearby.ClosestTo(leader.CenterPosition);
diff --git a/OpenRA.Mods.Common/AI/States/ProtectionStates.cs b/OpenRA.Mods.Common/AI/States/ProtectionStates.cs
index a6ebb0771c..cf1a99035c 100644
--- a/OpenRA.Mods.Common/AI/States/ProtectionStates.cs
+++ b/OpenRA.Mods.Common/AI/States/ProtectionStates.cs
@@ -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)
{
diff --git a/OpenRA.Mods.Common/AI/States/StateBase.cs b/OpenRA.Mods.Common/AI/States/StateBase.cs
index a7fe882429..868f9a1727 100644
--- a/OpenRA.Mods.Common/AI/States/StateBase.cs
+++ b/OpenRA.Mods.Common/AI/States/StateBase.cs
@@ -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());
if (ownBaseBuildingAround.Any())
return false;
diff --git a/OpenRA.Mods.Common/AI/SupportPowerDecision.cs b/OpenRA.Mods.Common/AI/SupportPowerDecision.cs
index ad74c2e402..7a47fb60bd 100644
--- a/OpenRA.Mods.Common/AI/SupportPowerDecision.cs
+++ b/OpenRA.Mods.Common/AI/SupportPowerDecision.cs
@@ -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)
{
diff --git a/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs b/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs
index b5d0811458..9aa00efdf4 100644
--- a/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs
+++ b/OpenRA.Mods.Common/Activities/Air/FallToEarth.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Activities/Air/Fly.cs b/OpenRA.Mods.Common/Activities/Air/Fly.cs
index a8460e1c08..addc6ae2b3 100644
--- a/OpenRA.Mods.Common/Activities/Air/Fly.cs
+++ b/OpenRA.Mods.Common/Activities/Air/Fly.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Activities/Air/FlyCircle.cs b/OpenRA.Mods.Common/Activities/Air/FlyCircle.cs
index 600cf2d63b..abd86f5bd9 100644
--- a/OpenRA.Mods.Common/Activities/Air/FlyCircle.cs
+++ b/OpenRA.Mods.Common/Activities/Air/FlyCircle.cs
@@ -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)
{
diff --git a/OpenRA.Mods.Common/Activities/Air/FlyFollow.cs b/OpenRA.Mods.Common/Activities/Air/FlyFollow.cs
index 7da1c5c1dc..42a360a0c4 100644
--- a/OpenRA.Mods.Common/Activities/Air/FlyFollow.cs
+++ b/OpenRA.Mods.Common/Activities/Air/FlyFollow.cs
@@ -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();
diff --git a/OpenRA.Mods.Common/Activities/Air/FlyTimed.cs b/OpenRA.Mods.Common/Activities/Air/FlyTimed.cs
index ef226696bb..0b5dc020be 100644
--- a/OpenRA.Mods.Common/Activities/Air/FlyTimed.cs
+++ b/OpenRA.Mods.Common/Activities/Air/FlyTimed.cs
@@ -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)
diff --git a/OpenRA.Mods.Common/Activities/Air/HeliFly.cs b/OpenRA.Mods.Common/Activities/Air/HeliFly.cs
index bcd23f19e9..1af4b677d6 100644
--- a/OpenRA.Mods.Common/Activities/Air/HeliFly.cs
+++ b/OpenRA.Mods.Common/Activities/Air/HeliFly.cs
@@ -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)
diff --git a/OpenRA.Mods.Common/Activities/Air/HeliLand.cs b/OpenRA.Mods.Common/Activities/Air/HeliLand.cs
index a0ca4756cc..9f191f539d 100644
--- a/OpenRA.Mods.Common/Activities/Air/HeliLand.cs
+++ b/OpenRA.Mods.Common/Activities/Air/HeliLand.cs
@@ -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)
diff --git a/OpenRA.Mods.Common/Activities/Air/Land.cs b/OpenRA.Mods.Common/Activities/Air/Land.cs
index 9f5abb4f5e..762c61a73f 100644
--- a/OpenRA.Mods.Common/Activities/Air/Land.cs
+++ b/OpenRA.Mods.Common/Activities/Air/Land.cs
@@ -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;
}
diff --git a/OpenRA.Mods.Common/Activities/Attack.cs b/OpenRA.Mods.Common/Activities/Attack.cs
index cae126458a..cfad985837 100644
--- a/OpenRA.Mods.Common/Activities/Attack.cs
+++ b/OpenRA.Mods.Common/Activities/Attack.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Activities/Enter.cs b/OpenRA.Mods.Common/Activities/Enter.cs
index cccbb2c7ea..b17e5e7d6e 100644
--- a/OpenRA.Mods.Common/Activities/Enter.cs
+++ b/OpenRA.Mods.Common/Activities/Enter.cs
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Activities
protected virtual void OnInside(Actor self) { }
protected bool TryGetAlternateTargetInCircle(
- Actor self, WRange radius, Action update, Func primaryFilter, Func[] preferenceFilters = null)
+ Actor self, WDist radius, Action update, Func primaryFilter, Func[] 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);
diff --git a/OpenRA.Mods.Common/Activities/Heal.cs b/OpenRA.Mods.Common/Activities/Heal.cs
index aede270e80..d50b485ef8 100644
--- a/OpenRA.Mods.Common/Activities/Heal.cs
+++ b/OpenRA.Mods.Common/Activities/Heal.cs
@@ -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)
diff --git a/OpenRA.Mods.Common/Activities/Hunt.cs b/OpenRA.Mods.Common/Activities/Hunt.cs
index b092ace352..af520042c6 100644
--- a/OpenRA.Mods.Common/Activities/Hunt.cs
+++ b/OpenRA.Mods.Common/Activities/Hunt.cs
@@ -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);
}
diff --git a/OpenRA.Mods.Common/Activities/Move/Follow.cs b/OpenRA.Mods.Common/Activities/Move/Follow.cs
index 4b3c516602..ba43d65562 100644
--- a/OpenRA.Mods.Common/Activities/Move/Follow.cs
+++ b/OpenRA.Mods.Common/Activities/Move/Follow.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Activities/Move/Move.cs b/OpenRA.Mods.Common/Activities/Move/Move.cs
index f0f754be4b..77d0a08974 100644
--- a/OpenRA.Mods.Common/Activities/Move/Move.cs
+++ b/OpenRA.Mods.Common/Activities/Move/Move.cs
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Activities
readonly Mobile mobile;
readonly IDisableMove[] moveDisablers;
- readonly WRange nearEnough;
+ readonly WDist nearEnough;
readonly Func> 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();
moveDisablers = self.TraitsImplementing().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();
moveDisablers = self.TraitsImplementing().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();
moveDisablers = self.TraitsImplementing().ToArray();
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Activities
this.getPath = getPath;
destination = null;
- nearEnough = WRange.Zero;
+ nearEnough = WDist.Zero;
}
static int HashList(List xs)
diff --git a/OpenRA.Mods.Common/Activities/Move/MoveWithinRange.cs b/OpenRA.Mods.Common/Activities/Move/MoveWithinRange.cs
index 7b6e99fac4..3aca24b03e 100644
--- a/OpenRA.Mods.Common/Activities/Move/MoveWithinRange.cs
+++ b/OpenRA.Mods.Common/Activities/Move/MoveWithinRange.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/ActorExts.cs b/OpenRA.Mods.Common/ActorExts.cs
index 4cbe893c74..4d20e87e23 100644
--- a/OpenRA.Mods.Common/ActorExts.cs
+++ b/OpenRA.Mods.Common/ActorExts.cs
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common
{
// Move within sight range of the frozen actor
var sight = self.TraitOrDefault();
- 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));
}
diff --git a/OpenRA.Mods.Common/Effects/Bullet.cs b/OpenRA.Mods.Common/Effects/Bullet.cs
index 8ba7ae0186..b6203bc487 100644
--- a/OpenRA.Mods.Common/Effects/Bullet.cs
+++ b/OpenRA.Mods.Common/Effects/Bullet.cs
@@ -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];
diff --git a/OpenRA.Mods.Common/Effects/GravityBomb.cs b/OpenRA.Mods.Common/Effects/GravityBomb.cs
index 19dc15f7ba..b41438b0d3 100644
--- a/OpenRA.Mods.Common/Effects/GravityBomb.cs
+++ b/OpenRA.Mods.Common/Effects/GravityBomb.cs
@@ -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);
diff --git a/OpenRA.Mods.Common/Effects/Missile.cs b/OpenRA.Mods.Common/Effects/Missile.cs
index cde08689ac..278fd7e333 100644
--- a/OpenRA.Mods.Common/Effects/Missile.cs
+++ b/OpenRA.Mods.Common/Effects/Missile.cs
@@ -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); }
}
diff --git a/OpenRA.Mods.Common/Effects/NukeLaunch.cs b/OpenRA.Mods.Common/Effects/NukeLaunch.cs
index 3d7ca5abfc..8e1018ba26 100644
--- a/OpenRA.Mods.Common/Effects/NukeLaunch.cs
+++ b/OpenRA.Mods.Common/Effects/NukeLaunch.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
index 89cbdcdad2..657636da8f 100644
--- a/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
+++ b/OpenRA.Mods.Common/Graphics/DefaultSpriteSequence.cs
@@ -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(d, "Start", 0);
ShadowStart = LoadField(d, "ShadowStart", -1);
- ShadowZOffset = LoadField(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Range;
- ZOffset = LoadField(d, "ZOffset", WRange.Zero).Range;
+ ShadowZOffset = LoadField(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Range;
+ ZOffset = LoadField(d, "ZOffset", WDist.Zero).Range;
Tick = LoadField(d, "Tick", 40);
transpose = LoadField(d, "Transpose", false);
Frames = LoadField(d, "Frames", null);
diff --git a/OpenRA.Mods.Common/Graphics/RangeCircleRenderable.cs b/OpenRA.Mods.Common/Graphics/RangeCircleRenderable.cs
index 82cb05e07f..d179f508bf 100644
--- a/OpenRA.Mods.Common/Graphics/RangeCircleRenderable.cs
+++ b/OpenRA.Mods.Common/Graphics/RangeCircleRenderable.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Pathfinder/PathFinderCacheDecorator.cs b/OpenRA.Mods.Common/Pathfinder/PathFinderCacheDecorator.cs
index 96b7bde3f6..f4fad6cf99 100644
--- a/OpenRA.Mods.Common/Pathfinder/PathFinderCacheDecorator.cs
+++ b/OpenRA.Mods.Common/Pathfinder/PathFinderCacheDecorator.cs
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Pathfinder
}
}
- public List FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
+ public List FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self)
{
using (new PerfSample("Pathfinder"))
{
diff --git a/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs b/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
index c2fb097ad6..c75bda6eee 100644
--- a/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
@@ -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); }
}
}
diff --git a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs
index 3fcf1d0336..aa0f794968 100644
--- a/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/MapGlobal.cs
@@ -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);
diff --git a/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs
index 5085a319d5..ce59eb99fc 100644
--- a/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs
+++ b/OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs
@@ -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();
diff --git a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs
index 2445c215ab..6a66db7787 100644
--- a/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs
+++ b/OpenRA.Mods.Common/Scripting/Properties/MobileProperties.cs
@@ -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]
diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs
index 3cdc4ed4bc..4a1bf55d1f 100644
--- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs
+++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs
@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits
{
public class AircraftInfo : ITraitInfo, IFacingInfo, IOccupySpaceInfo, ICruiseAltitudeInfo, UsesInit, UsesInit
{
- 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";
diff --git a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs
index a2eb3c3908..ab1d1b8352 100644
--- a/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs
+++ b/OpenRA.Mods.Common/Traits/Air/FallsToEarth.cs
@@ -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); }
}
diff --git a/OpenRA.Mods.Common/Traits/Air/Helicopter.cs b/OpenRA.Mods.Common/Traits/Air/Helicopter.cs
index be611b586d..bcea3cbba0 100644
--- a/OpenRA.Mods.Common/Traits/Air/Helicopter.cs
+++ b/OpenRA.Mods.Common/Traits/Air/Helicopter.cs
@@ -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)
diff --git a/OpenRA.Mods.Common/Traits/Air/Plane.cs b/OpenRA.Mods.Common/Traits/Air/Plane.cs
index 8e18c49e9d..b993cefe03 100644
--- a/OpenRA.Mods.Common/Traits/Air/Plane.cs
+++ b/OpenRA.Mods.Common/Traits/Air/Plane.cs
@@ -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); }
}
}
diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs
index 6068aa29d5..7fd83d028f 100644
--- a/OpenRA.Mods.Common/Traits/Armament.cs
+++ b/OpenRA.Mods.Common/Traits/Armament.cs
@@ -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;
List> delayedActions = new List>();
- 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));
diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
index 7f60c9e0bd..74e6b7b610 100644
--- a/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
+++ b/OpenRA.Mods.Common/Traits/Attack/AttackBase.cs
@@ -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)); }
diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs
index 1ab859ea67..789688cff7 100644
--- a/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs
+++ b/OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
|| (target.Type == TargetType.FrozenActor && target.FrozenActor.Info.Traits.Contains());
// 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;
diff --git a/OpenRA.Mods.Common/Traits/AutoTarget.cs b/OpenRA.Mods.Common/Traits/AutoTarget.cs
index 436be5f80b..a256358d89 100644
--- a/OpenRA.Mods.Common/Traits/AutoTarget.cs
+++ b/OpenRA.Mods.Common/Traits/AutoTarget.cs
@@ -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);
diff --git a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs
index 6f38370526..c0521f4f2d 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/BaseProvider.cs
@@ -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));
diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs
index 59984719ce..ab0cdca8f5 100644
--- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs
+++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs
@@ -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;
}
diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs
index 1c03974653..2d1d4c65cc 100644
--- a/OpenRA.Mods.Common/Traits/Cloak.cs
+++ b/OpenRA.Mods.Common/Traits/Cloak.cs
@@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits
return self.World.ActorsWithTrait().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)
diff --git a/OpenRA.Mods.Common/Traits/Crates/GrantUpgradeCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/GrantUpgradeCrateAction.cs
index 52737ec4e1..9c04991d86 100644
--- a/OpenRA.Mods.Common/Traits/Crates/GrantUpgradeCrateAction.cs
+++ b/OpenRA.Mods.Common/Traits/Crates/GrantUpgradeCrateAction.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs
index 0b620fcd66..e50d1166bf 100644
--- a/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs
+++ b/OpenRA.Mods.Common/Traits/Crates/LevelUpCrateAction.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Traits/Guard.cs b/OpenRA.Mods.Common/Traits/Guard.cs
index 9ff2113b1d..61a41bfb2d 100644
--- a/OpenRA.Mods.Common/Traits/Guard.cs
+++ b/OpenRA.Mods.Common/Traits/Guard.cs
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.SetTargetLine(target, Color.Yellow);
- var range = WRange.FromCells(target.Actor.Info.Traits.Get().Range);
- self.QueueActivity(false, new AttackMoveActivity(self, self.Trait().MoveFollow(self, target, WRange.Zero, range)));
+ var range = WDist.FromCells(target.Actor.Info.Traits.Get().Range);
+ self.QueueActivity(false, new AttackMoveActivity(self, self.Trait().MoveFollow(self, target, WDist.Zero, range)));
}
public string VoicePhraseForOrder(Actor self, Order order)
diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs
index d460930e22..ed25c3efd5 100644
--- a/OpenRA.Mods.Common/Traits/Mobile.cs
+++ b/OpenRA.Mods.Common/Traits/Mobile.cs
@@ -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> pathFunc) { return new Move(self, pathFunc); }
public void OnNotifyBlockingMove(Actor self, Actor blocking)
diff --git a/OpenRA.Mods.Common/Traits/ParaDrop.cs b/OpenRA.Mods.Common/Traits/ParaDrop.cs
index efd9e34f0c..a1c5d7ec4c 100644
--- a/OpenRA.Mods.Common/Traits/ParaDrop.cs
+++ b/OpenRA.Mods.Common/Traits/ParaDrop.cs
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
public class ParaDropInfo : ITraitInfo, Requires
{
[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";
diff --git a/OpenRA.Mods.Common/Traits/Passenger.cs b/OpenRA.Mods.Common/Traits/Passenger.cs
index 8fad87167d..aa805dee37 100644
--- a/OpenRA.Mods.Common/Traits/Passenger.cs
+++ b/OpenRA.Mods.Common/Traits/Passenger.cs
@@ -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 = { };
diff --git a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs
index aeb82f5927..125494a277 100644
--- a/OpenRA.Mods.Common/Traits/ProximityCapturable.cs
+++ b/OpenRA.Mods.Common/Traits/ProximityCapturable.cs
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable 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);
}
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs
index 476dec1005..2c5e25b266 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderDetectionCircle.cs
@@ -35,10 +35,10 @@ namespace OpenRA.Mods.Common.Traits
var range = self.TraitsImplementing()
.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(
diff --git a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs
index ec53085129..387a98b926 100644
--- a/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/RenderRangeCircle.cs
@@ -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 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(
diff --git a/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs
index fe11cab00a..165f149e51 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithBarrel.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs
index 1d1b4be420..2bc7283a06 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithRangeCircle.cs
@@ -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 Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
{
diff --git a/OpenRA.Mods.Common/Traits/Render/WithTurret.cs b/OpenRA.Mods.Common/Traits/Render/WithTurret.cs
index 398a24edc8..8ff1251a6e 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithTurret.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithTurret.cs
@@ -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));
diff --git a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs
index e9c8a3214f..621af1dce1 100644
--- a/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs
+++ b/OpenRA.Mods.Common/Traits/Render/WithVoxelBarrel.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Traits/RepairableNear.cs b/OpenRA.Mods.Common/Traits/RepairableNear.cs
index 76eeb80f0c..cc99cf650a 100644
--- a/OpenRA.Mods.Common/Traits/RepairableNear.cs
+++ b/OpenRA.Mods.Common/Traits/RepairableNear.cs
@@ -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);
diff --git a/OpenRA.Mods.Common/Traits/RevealsShroud.cs b/OpenRA.Mods.Common/Traits/RevealsShroud.cs
index 1994bb3c49..1ae7491b6b 100644
--- a/OpenRA.Mods.Common/Traits/RevealsShroud.cs
+++ b/OpenRA.Mods.Common/Traits/RevealsShroud.cs
@@ -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; } }
}
}
diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs
index f75d831fa3..964a7e9a7b 100644
--- a/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs
+++ b/OpenRA.Mods.Common/Traits/SupportPowers/AirstrikePower.cs
@@ -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); }
}
diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs
index fee57d8000..bc3690f58f 100644
--- a/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs
+++ b/OpenRA.Mods.Common/Traits/SupportPowers/NukePower.cs
@@ -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;
diff --git a/OpenRA.Mods.Common/Traits/ThrowsParticle.cs b/OpenRA.Mods.Common/Traits/ThrowsParticle.cs
index 3aa7db2d70..d2b0d943f1 100644
--- a/OpenRA.Mods.Common/Traits/ThrowsParticle.cs
+++ b/OpenRA.Mods.Common/Traits/ThrowsParticle.cs
@@ -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);
diff --git a/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs b/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs
index 1dd9bd049c..2d38a009f2 100644
--- a/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs
+++ b/OpenRA.Mods.Common/Traits/Upgrades/UpgradeActorsNear.cs
@@ -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;
}
diff --git a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs
index bb8fae99cf..301aeb7fde 100644
--- a/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs
+++ b/OpenRA.Mods.Common/Traits/World/CrateSpawner.cs
@@ -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); }
}
diff --git a/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs b/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs
index 3cd90e25ad..08d940b4ec 100644
--- a/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs
+++ b/OpenRA.Mods.Common/Traits/World/MPStartLocations.cs
@@ -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); }
}
diff --git a/OpenRA.Mods.Common/Traits/World/PathFinder.cs b/OpenRA.Mods.Common/Traits/World/PathFinder.cs
index f1890e6b8f..09bd3f9c16 100644
--- a/OpenRA.Mods.Common/Traits/World/PathFinder.cs
+++ b/OpenRA.Mods.Common/Traits/World/PathFinder.cs
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
/// A path from start to target
List FindUnitPath(CPos source, CPos target, Actor self);
- List FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self);
+ List FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self);
///
/// Calculates a path given a search specification
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
return pb;
}
- public List FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
+ public List FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self)
{
var mi = self.Info.Traits.Get();
var targetCell = world.Map.CellContaining(target);
diff --git a/OpenRA.Mods.Common/TraitsInterfaces.cs b/OpenRA.Mods.Common/TraitsInterfaces.cs
index 9d2b1eeb68..b8918172d3 100644
--- a/OpenRA.Mods.Common/TraitsInterfaces.cs
+++ b/OpenRA.Mods.Common/TraitsInterfaces.cs
@@ -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 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);
diff --git a/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs
index 219254026e..7f86c85b1e 100644
--- a/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs
+++ b/OpenRA.Mods.Common/UtilityCommands/ExtractTraitDocsCommand.cs
@@ -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))
diff --git a/OpenRA.Mods.Common/Warheads/GrantUpgradeWarhead.cs b/OpenRA.Mods.Common/Warheads/GrantUpgradeWarhead.cs
index 9a7d222fbc..d2eaa49680 100644
--- a/OpenRA.Mods.Common/Warheads/GrantUpgradeWarhead.cs
+++ b/OpenRA.Mods.Common/Warheads/GrantUpgradeWarhead.cs
@@ -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
diff --git a/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs
index bdc7b03fbd..c3a5c34df9 100644
--- a/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs
+++ b/OpenRA.Mods.Common/Warheads/HealthPercentageDamageWarhead.cs
@@ -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 damageModifiers)
{
diff --git a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs
index 18723907f3..efba4d34cc 100644
--- a/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs
+++ b/OpenRA.Mods.Common/Warheads/SpreadDamageWarhead.cs
@@ -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()
{
diff --git a/OpenRA.Mods.D2k/Activities/PickupUnit.cs b/OpenRA.Mods.D2k/Activities/PickupUnit.cs
index c7de52305c..65ad493b9d 100644
--- a/OpenRA.Mods.D2k/Activities/PickupUnit.cs
+++ b/OpenRA.Mods.D2k/Activities/PickupUnit.cs
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.D2k.Activities
{
case State.Intercept:
state = State.LockCarryable;
- return Util.SequenceActivities(movement.MoveWithinRange(Target.FromActor(cargo), WRange.FromCells(4)), this);
+ return Util.SequenceActivities(movement.MoveWithinRange(Target.FromActor(cargo), WDist.FromCells(4)), this);
case State.LockCarryable:
// Last check
diff --git a/OpenRA.Mods.D2k/Traits/AttractsWorms.cs b/OpenRA.Mods.D2k/Traits/AttractsWorms.cs
index e5fbb72d7a..71acd0e53e 100644
--- a/OpenRA.Mods.D2k/Traits/AttractsWorms.cs
+++ b/OpenRA.Mods.D2k/Traits/AttractsWorms.cs
@@ -23,10 +23,10 @@ namespace OpenRA.Mods.D2k.Traits
public readonly int[] Falloff = { 100, 100, 25, 11, 6, 4, 3, 2, 1, 0 };
[Desc("Range between falloff steps.")]
- public readonly WRange Spread = new WRange(3072);
+ public readonly WDist Spread = new WDist(3072);
[Desc("Ranges at which each Falloff step is defined. Overrides Spread.")]
- public WRange[] Range = null;
+ public WDist[] Range = null;
public override object Create(ActorInitializer init) { return new AttractsWorms(init, this); }
}
diff --git a/OpenRA.Mods.D2k/Traits/Carryable.cs b/OpenRA.Mods.D2k/Traits/Carryable.cs
index ed9616507b..c2f6c31bc3 100644
--- a/OpenRA.Mods.D2k/Traits/Carryable.cs
+++ b/OpenRA.Mods.D2k/Traits/Carryable.cs
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.D2k.Traits
public class CarryableInfo : ITraitInfo
{
[Desc("Required distance away from destination before requesting a pickup. Default is 6 cells.")]
- public WRange MinDistance = WRange.FromCells(6);
+ public WDist MinDistance = WDist.FromCells(6);
public object Create(ActorInitializer init) { return new Carryable(init.Self, this); }
}
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.D2k.Traits
public void MovingToResources(Actor self, CPos targetCell, Activity next) { RequestTransport(targetCell, next); }
public void MovingToRefinery(Actor self, CPos targetCell, Activity next) { RequestTransport(targetCell, next); }
- public WRange MinimumDistance { get { return info.MinDistance; } }
+ public WDist MinimumDistance { get { return info.MinDistance; } }
public void RequestTransport(CPos destination, Activity afterLandActivity)
{
diff --git a/OpenRA.Mods.D2k/Traits/Carryall.cs b/OpenRA.Mods.D2k/Traits/Carryall.cs
index 4a13a8b56c..78cbfae3d5 100644
--- a/OpenRA.Mods.D2k/Traits/Carryall.cs
+++ b/OpenRA.Mods.D2k/Traits/Carryall.cs
@@ -31,7 +31,7 @@ namespace OpenRA.Mods.D2k.Traits
public class Carryall : INotifyBecomingIdle, INotifyKilled, ISync, IRender, INotifyActorDisposing
{
readonly Actor self;
- readonly WRange carryHeight;
+ readonly WDist carryHeight;
readonly CarryallInfo info;
// The actor we are currently carrying.
diff --git a/OpenRA.Mods.D2k/Traits/Sandworm.cs b/OpenRA.Mods.D2k/Traits/Sandworm.cs
index 8281a11d05..5aa7d6c400 100644
--- a/OpenRA.Mods.D2k/Traits/Sandworm.cs
+++ b/OpenRA.Mods.D2k/Traits/Sandworm.cs
@@ -21,10 +21,10 @@ namespace OpenRA.Mods.D2k.Traits
public readonly int TargetRescanInterval = 32;
[Desc("The radius in which the worm \"searches\" for targets.")]
- public readonly WRange MaxSearchRadius = WRange.FromCells(27);
+ public readonly WDist MaxSearchRadius = WDist.FromCells(27);
[Desc("The range at which the worm launches an attack regardless of noise levels.")]
- public readonly WRange IgnoreNoiseAttackRange = WRange.FromCells(3);
+ public readonly WDist IgnoreNoiseAttackRange = WDist.FromCells(3);
[Desc("The chance this actor has of disappearing after it attacks (in %).")]
public readonly int ChanceToDisappear = 80;
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.D2k.Traits
if (IsMovingTowardTarget)
return;
- self.QueueActivity(mobile.Value.MoveWithinRange(Target.FromCell(self.World, targetCell, SubCell.Any), WRange.FromCells(1)));
+ self.QueueActivity(mobile.Value.MoveWithinRange(Target.FromCell(self.World, targetCell, SubCell.Any), WDist.FromCells(1)));
}
public void Tick(Actor self)
diff --git a/OpenRA.Mods.D2k/Traits/ThrowsShrapnel.cs b/OpenRA.Mods.D2k/Traits/ThrowsShrapnel.cs
index 8d024c5efc..157c7e92ce 100644
--- a/OpenRA.Mods.D2k/Traits/ThrowsShrapnel.cs
+++ b/OpenRA.Mods.D2k/Traits/ThrowsShrapnel.cs
@@ -20,7 +20,7 @@ namespace OpenRA.Mods.D2k.Traits
[WeaponReference]
public string[] Weapons = { };
public int[] Pieces = { 3, 10 };
- public WRange[] Range = { WRange.FromCells(2), WRange.FromCells(5) };
+ public WDist[] Range = { WDist.FromCells(2), WDist.FromCells(5) };
public object Create(ActorInitializer actor) { return new ThrowsShrapnel(this); }
}
diff --git a/OpenRA.Mods.D2k/Warheads/ChangeOwnerWarhead.cs b/OpenRA.Mods.D2k/Warheads/ChangeOwnerWarhead.cs
index 4c253f9e39..b586fa8b33 100644
--- a/OpenRA.Mods.D2k/Warheads/ChangeOwnerWarhead.cs
+++ b/OpenRA.Mods.D2k/Warheads/ChangeOwnerWarhead.cs
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.D2k.Warheads
[Desc("Duration of the owner change (in ticks). Set to 0 to make it permanent.")]
public readonly int Duration = 0;
- public readonly WRange Range = WRange.FromCells(1);
+ public readonly WDist Range = WDist.FromCells(1);
public override void DoImpact(Target target, Actor firedBy, IEnumerable damageModifiers)
{
diff --git a/OpenRA.Mods.RA/Activities/Leap.cs b/OpenRA.Mods.RA/Activities/Leap.cs
index 0cf58fb6df..3abb516456 100644
--- a/OpenRA.Mods.RA/Activities/Leap.cs
+++ b/OpenRA.Mods.RA/Activities/Leap.cs
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA.Activities
int ticks;
WAngle angle;
- public Leap(Actor self, Actor target, WeaponInfo weapon, WRange speed, WAngle angle)
+ public Leap(Actor self, Actor target, WeaponInfo weapon, WDist speed, WAngle angle)
{
var targetMobile = target.TraitOrDefault();
if (targetMobile == null)
diff --git a/OpenRA.Mods.RA/Graphics/TeslaZapRenderable.cs b/OpenRA.Mods.RA/Graphics/TeslaZapRenderable.cs
index 5c4155f696..f1dc11e112 100644
--- a/OpenRA.Mods.RA/Graphics/TeslaZapRenderable.cs
+++ b/OpenRA.Mods.RA/Graphics/TeslaZapRenderable.cs
@@ -107,8 +107,8 @@ namespace OpenRA.Mods.RA.Graphics
var renderables = new List();
if (Game.CosmeticRandom.Next(2) != 0)
{
- var p1 = from + (1 / 3f) * dist + WRange.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
- var p2 = from + (2 / 3f) * dist + WRange.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
+ var p1 = from + (1 / 3f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
+ var p2 = from + (2 / 3f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
renderables.AddRange(DrawZap(wr, p1, p2, s, out p2, pal));
@@ -116,7 +116,7 @@ namespace OpenRA.Mods.RA.Graphics
}
else
{
- var p1 = from + (1 / 2f) * dist + WRange.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
+ var p1 = from + (1 / 2f) * dist + WDist.FromPDF(Game.CosmeticRandom, 2).Range * dist.Length / 4096 * norm;
renderables.AddRange(DrawZap(wr, from, p1, s, out p1, pal));
renderables.AddRange(DrawZap(wr, p1, to, s, out z, pal));
diff --git a/OpenRA.Mods.RA/Traits/Attack/AttackLeap.cs b/OpenRA.Mods.RA/Traits/Attack/AttackLeap.cs
index 5bfd8be873..8965dd47fa 100644
--- a/OpenRA.Mods.RA/Traits/Attack/AttackLeap.cs
+++ b/OpenRA.Mods.RA/Traits/Attack/AttackLeap.cs
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Traits
class AttackLeapInfo : AttackFrontalInfo
{
[Desc("Leap speed (in units/tick).")]
- public readonly WRange Speed = new WRange(426);
+ public readonly WDist Speed = new WDist(426);
public readonly WAngle Angle = WAngle.FromDegrees(20);
public override object Create(ActorInitializer init) { return new AttackLeap(init.Self, this); }
diff --git a/OpenRA.Mods.RA/Traits/PortableChrono.cs b/OpenRA.Mods.RA/Traits/PortableChrono.cs
index c1065a5527..8bf70b2ace 100644
--- a/OpenRA.Mods.RA/Traits/PortableChrono.cs
+++ b/OpenRA.Mods.RA/Traits/PortableChrono.cs
@@ -198,7 +198,7 @@ namespace OpenRA.Mods.RA.Traits
yield return new RangeCircleRenderable(
self.CenterPosition,
- WRange.FromCells(self.Trait().Info.MaxDistance),
+ WDist.FromCells(self.Trait().Info.MaxDistance),
0,
Color.FromArgb(128, Color.LawnGreen),
Color.FromArgb(96, Color.Black));
diff --git a/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs b/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs
index c0cf90a06c..ac263cf3d5 100644
--- a/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs
+++ b/OpenRA.Mods.RA/Traits/Render/RenderJammerCircle.cs
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Traits
{
yield return new RangeCircleRenderable(
centerPosition,
- WRange.FromCells(jamsMissiles.Range),
+ WDist.FromCells(jamsMissiles.Range),
0,
Color.FromArgb(128, Color.Red),
Color.FromArgb(96, Color.Black));
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Traits
{
yield return new RangeCircleRenderable(
centerPosition,
- WRange.FromCells(jamsRadar.Range),
+ WDist.FromCells(jamsRadar.Range),
0,
Color.FromArgb(128, Color.Blue),
Color.FromArgb(96, Color.Black));
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.RA.Traits
{
yield return new RangeCircleRenderable(
self.CenterPosition,
- WRange.FromCells(jamsMissiles.Range),
+ WDist.FromCells(jamsMissiles.Range),
0,
Color.FromArgb(128, Color.Red),
Color.FromArgb(96, Color.Black));
@@ -80,7 +80,7 @@ namespace OpenRA.Mods.RA.Traits
{
yield return new RangeCircleRenderable(
self.CenterPosition,
- WRange.FromCells(jamsRadar.Range),
+ WDist.FromCells(jamsRadar.Range),
0,
Color.FromArgb(128, Color.Blue),
Color.FromArgb(96, Color.Black));
diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs
index 6820aee695..1d6f147043 100644
--- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs
+++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.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);
[ActorReference]
[Desc("Troops to be delivered. They will be distributed between the planes if SquadSize > 1.")]
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly int CameraRemoveDelay = 85;
[Desc("Weapon range offset to apply during the beacon clock calculation.")]
- public readonly WRange BeaconDistanceOffset = WRange.FromCells(4);
+ public readonly WDist BeaconDistanceOffset = WDist.FromCells(4);
public override object Create(ActorInitializer init) { return new ParatroopersPower(init.Self, this); }
}