rename WRange to WDist
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -305,8 +305,8 @@
|
||||
<Compile Include="CPos.cs" />
|
||||
<Compile Include="CVec.cs" />
|
||||
<Compile Include="WAngle.cs" />
|
||||
<Compile Include="WDist.cs" />
|
||||
<Compile Include="WPos.cs" />
|
||||
<Compile Include="WRange.cs" />
|
||||
<Compile Include="WRot.cs" />
|
||||
<Compile Include="WVec.cs" />
|
||||
<Compile Include="Primitives\TypeDictionary.cs" />
|
||||
|
||||
2
OpenRA.Game/Sync.cs
Executable file → Normal file
2
OpenRA.Game/Sync.cs
Executable file → Normal file
@@ -36,7 +36,7 @@ namespace OpenRA
|
||||
{ typeof(int2), ((Func<int2, int>)HashInt2).Method },
|
||||
{ typeof(CPos), ((Func<CPos, int>)HashCPos).Method },
|
||||
{ typeof(CVec), ((Func<CVec, int>)HashCVec).Method },
|
||||
{ typeof(WRange), ((Func<WRange, int>)Hash<WRange>).Method },
|
||||
{ typeof(WDist), ((Func<WDist, int>)Hash<WDist>).Method },
|
||||
{ typeof(WPos), ((Func<WPos, int>)Hash<WPos>).Method },
|
||||
{ typeof(WVec), ((Func<WVec, int>)Hash<WVec>).Method },
|
||||
{ typeof(WAngle), ((Func<WAngle, int>)Hash<WAngle>).Method },
|
||||
|
||||
2
OpenRA.Game/Traits/Health.cs
Executable file → Normal file
2
OpenRA.Game/Traits/Health.cs
Executable file → Normal file
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<Actor> currentActors = Enumerable.Empty<Actor>();
|
||||
|
||||
public ProximityTrigger(int id, WPos pos, WRange range, Action<Actor> onActorEntered, Action<Actor> onActorExited)
|
||||
public ProximityTrigger(int id, WPos pos, WDist range, Action<Actor> onActorEntered, Action<Actor> 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<Actor> onEntry, Action<Actor> onExit)
|
||||
public int AddProximityTrigger(WPos pos, WDist range, Action<Actor> onEntry, Action<Actor> 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))
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Traits
|
||||
Hash += 1;
|
||||
}
|
||||
|
||||
public static IEnumerable<CPos> CellsInRange(Map map, WPos pos, WRange range)
|
||||
public static IEnumerable<CPos> 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<CPos> CellsInRange(Map map, CPos cell, WRange range)
|
||||
public static IEnumerable<CPos> CellsInRange(Map map, CPos cell, WDist range)
|
||||
{
|
||||
return CellsInRange(map, map.CenterOfCell(cell), range);
|
||||
}
|
||||
|
||||
@@ -20,43 +20,43 @@ namespace OpenRA
|
||||
/// <summary>
|
||||
/// 1d world distance - 1024 units = 1 cell.
|
||||
/// </summary>
|
||||
public struct WRange : IComparable, IComparable<WRange>, IEquatable<WRange>, IScriptBindable, ILuaAdditionBinding, ILuaSubtractionBinding, ILuaEqualityBinding, ILuaTableBinding
|
||||
public struct WDist : IComparable, IComparable<WDist>, IEquatable<WDist>, 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<WRange>(out a) || !right.TryGetClrValue<WRange>(out b))
|
||||
WDist a;
|
||||
WDist b;
|
||||
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(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<WRange>(out a) || !right.TryGetClrValue<WRange>(out b))
|
||||
WDist a;
|
||||
WDist b;
|
||||
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(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<WRange>(out a) || !right.TryGetClrValue<WRange>(out b))
|
||||
WDist a;
|
||||
WDist b;
|
||||
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
|
||||
throw new LuaException("Attempted to call WRange.Equals(WRange, WRange) with invalid arguments.");
|
||||
|
||||
return a == b;
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -30,12 +30,12 @@ namespace OpenRA
|
||||
return actors.MinByOrDefault(a => (a.CenterPosition - pos).LengthSquared);
|
||||
}
|
||||
|
||||
public static IEnumerable<Actor> FindActorsInCircle(this World world, WPos origin, WRange r)
|
||||
public static IEnumerable<Actor> 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);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
||||
var altitude = self.World.Map.Rules.Actors[actorType].Traits.Get<PlaneInfo>().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)
|
||||
});
|
||||
|
||||
@@ -485,7 +485,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
return allEnemyUnits.ClosestTo(pos);
|
||||
}
|
||||
|
||||
internal Actor FindClosestEnemy(WPos pos, WRange radius)
|
||||
internal Actor FindClosestEnemy(WPos pos, WDist radius)
|
||||
{
|
||||
var enemyUnits = World.FindActorsInCircle(pos, radius)
|
||||
.Where(unit => Player.Stances[unit.Owner] == Stance.Enemy &&
|
||||
@@ -643,7 +643,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
foreach (var b in allEnemyBaseBuilder)
|
||||
{
|
||||
var enemies = World.FindActorsInCircle(b.CenterPosition, WRange.FromCells(Info.RushAttackScanRadius))
|
||||
var enemies = World.FindActorsInCircle(b.CenterPosition, WDist.FromCells(Info.RushAttackScanRadius))
|
||||
.Where(unit => Player.Stances[unit.Owner] == Stance.Enemy && unit.HasTrait<AttackBase>()).ToList();
|
||||
|
||||
if (rushFuzzy.CanAttack(ownUnits, enemies))
|
||||
@@ -672,7 +672,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
|
||||
if (!protectSq.IsValid)
|
||||
{
|
||||
var ownUnits = World.FindActorsInCircle(World.Map.CenterOfCell(GetRandomBaseCenter()), WRange.FromCells(Info.ProtectUnitScanRadius))
|
||||
var ownUnits = World.FindActorsInCircle(World.Map.CenterOfCell(GetRandomBaseCenter()), WDist.FromCells(Info.ProtectUnitScanRadius))
|
||||
.Where(unit => unit.Owner == Player && !unit.HasTrait<Building>()
|
||||
&& unit.HasTrait<AttackBase>());
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
owner.TargetActor = t;
|
||||
}
|
||||
|
||||
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WRange.FromCells(10))
|
||||
var enemyUnits = owner.World.FindActorsInCircle(owner.TargetActor.CenterPosition, WDist.FromCells(10))
|
||||
.Where(unit => owner.Bot.Player.Stances[unit.Owner] == Stance.Enemy).ToList();
|
||||
|
||||
if (enemyUnits.Any())
|
||||
@@ -83,7 +83,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
var leader = owner.Units.ClosestTo(owner.TargetActor.CenterPosition);
|
||||
if (leader == null)
|
||||
return;
|
||||
var ownUnits = owner.World.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(owner.Units.Count) / 3)
|
||||
var ownUnits = owner.World.FindActorsInCircle(leader.CenterPosition, WDist.FromCells(owner.Units.Count) / 3)
|
||||
.Where(a => a.Owner == owner.Units.FirstOrDefault().Owner && owner.Units.Contains(a)).ToHashSet();
|
||||
if (ownUnits.Count < owner.Units.Count)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
}
|
||||
else
|
||||
{
|
||||
var enemies = owner.World.FindActorsInCircle(leader.CenterPosition, WRange.FromCells(12))
|
||||
var enemies = owner.World.FindActorsInCircle(leader.CenterPosition, WDist.FromCells(12))
|
||||
.Where(a1 => !a1.Disposed && !a1.IsDead);
|
||||
var enemynearby = enemies.Where(a1 => a1.HasTrait<ITargetable>() && leader.Owner.Stances[a1.Owner] == Stance.Enemy);
|
||||
var target = enemynearby.ClosestTo(leader.CenterPosition);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.AI
|
||||
return false;
|
||||
|
||||
var u = squad.Units.Random(squad.Random);
|
||||
var units = squad.World.FindActorsInCircle(u.CenterPosition, WRange.FromCells(DangerRadius)).ToList();
|
||||
var units = squad.World.FindActorsInCircle(u.CenterPosition, WDist.FromCells(DangerRadius)).ToList();
|
||||
var ownBaseBuildingAround = units.Where(unit => unit.Owner == squad.Bot.Player && unit.HasTrait<Building>());
|
||||
if (ownBaseBuildingAround.Any())
|
||||
return false;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
var move = info.Moves ? aircraft.FlyStep(aircraft.Facing) : WVec.Zero;
|
||||
move -= new WVec(WRange.Zero, WRange.Zero, info.Velocity);
|
||||
move -= new WVec(WDist.Zero, WDist.Zero, info.Velocity);
|
||||
aircraft.SetPosition(self, aircraft.CenterPosition + move);
|
||||
|
||||
return this;
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
readonly Plane plane;
|
||||
readonly Target target;
|
||||
readonly WRange maxRange;
|
||||
readonly WRange minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public Fly(Actor self, Target t)
|
||||
{
|
||||
@@ -28,14 +28,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
target = t;
|
||||
}
|
||||
|
||||
public Fly(Actor self, Target t, WRange minRange, WRange maxRange)
|
||||
public Fly(Actor self, Target t, WDist minRange, WDist maxRange)
|
||||
: this(self, t)
|
||||
{
|
||||
this.maxRange = maxRange;
|
||||
this.minRange = minRange;
|
||||
}
|
||||
|
||||
public static void FlyToward(Actor self, Plane plane, int desiredFacing, WRange desiredAltitude)
|
||||
public static void FlyToward(Actor self, Plane plane, int desiredFacing, WDist desiredAltitude)
|
||||
{
|
||||
var move = plane.FlyStep(plane.Facing);
|
||||
var altitude = plane.CenterPosition.Z;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class FlyCircle : Activity
|
||||
{
|
||||
readonly Plane plane;
|
||||
readonly WRange cruiseAltitude;
|
||||
readonly WDist cruiseAltitude;
|
||||
|
||||
public FlyCircle(Actor self)
|
||||
{
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
Target target;
|
||||
Plane plane;
|
||||
WRange minRange;
|
||||
WRange maxRange;
|
||||
WDist minRange;
|
||||
WDist maxRange;
|
||||
|
||||
public FlyFollow(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
public FlyFollow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
{
|
||||
this.target = target;
|
||||
plane = self.Trait<Plane>();
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class FlyTimed : Activity
|
||||
{
|
||||
readonly Plane plane;
|
||||
readonly WRange cruiseAltitude;
|
||||
readonly WDist cruiseAltitude;
|
||||
int remainingTicks;
|
||||
|
||||
public FlyTimed(int ticks, Actor self)
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
readonly Helicopter helicopter;
|
||||
readonly Target target;
|
||||
readonly WRange maxRange;
|
||||
readonly WRange minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public HeliFly(Actor self, Target t)
|
||||
{
|
||||
@@ -28,14 +28,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
target = t;
|
||||
}
|
||||
|
||||
public HeliFly(Actor self, Target t, WRange minRange, WRange maxRange)
|
||||
public HeliFly(Actor self, Target t, WDist minRange, WDist maxRange)
|
||||
: this(self, t)
|
||||
{
|
||||
this.maxRange = maxRange;
|
||||
this.minRange = minRange;
|
||||
}
|
||||
|
||||
public static bool AdjustAltitude(Actor self, Helicopter helicopter, WRange targetAltitude)
|
||||
public static bool AdjustAltitude(Actor self, Helicopter helicopter, WDist targetAltitude)
|
||||
{
|
||||
var altitude = helicopter.CenterPosition.Z;
|
||||
if (altitude == targetAltitude.Range)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class HeliLand : Activity
|
||||
{
|
||||
readonly Helicopter helicopter;
|
||||
readonly WRange landAltitude;
|
||||
readonly WDist landAltitude;
|
||||
bool requireSpace;
|
||||
|
||||
public HeliLand(Actor self, bool requireSpace)
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
}
|
||||
|
||||
var desiredFacing = Util.GetFacing(d, plane.Facing);
|
||||
Fly.FlyToward(self, plane, desiredFacing, WRange.Zero);
|
||||
Fly.FlyToward(self, plane, desiredFacing, WDist.Zero);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
readonly AttackBase attack;
|
||||
readonly IMove move;
|
||||
readonly IFacing facing;
|
||||
readonly WRange minRange;
|
||||
readonly WRange maxRange;
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly IPositionable positionable;
|
||||
|
||||
public Attack(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
|
||||
public Attack(Actor self, Target target, WDist minRange, WDist maxRange, bool allowMovement)
|
||||
{
|
||||
Target = target;
|
||||
this.minRange = minRange;
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
protected virtual void OnInside(Actor self) { }
|
||||
|
||||
protected bool TryGetAlternateTargetInCircle(
|
||||
Actor self, WRange radius, Action<Target> update, Func<Actor, bool> primaryFilter, Func<Actor, bool>[] preferenceFilters = null)
|
||||
Actor self, WDist radius, Action<Target> update, Func<Actor, bool> primaryFilter, Func<Actor, bool>[] preferenceFilters = null)
|
||||
{
|
||||
var diff = new WVec(radius, radius, WRange.Zero);
|
||||
var diff = new WVec(radius, radius, WDist.Zero);
|
||||
var candidates = self.World.ActorMap.ActorsInBox(self.CenterPosition - diff, self.CenterPosition + diff)
|
||||
.Where(primaryFilter).Select(a => new { Actor = a, Ls = (self.CenterPosition - a.CenterPosition).HorizontalLengthSquared })
|
||||
.Where(p => p.Ls <= radius.RangeSquared).OrderBy(p => p.Ls).Select(p => p.Actor);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class Heal : Attack
|
||||
{
|
||||
public Heal(Actor self, Target target, WRange minRange, WRange maxRange, bool allowMovement)
|
||||
public Heal(Actor self, Target target, WDist minRange, WDist maxRange, bool allowMovement)
|
||||
: base(self, target, minRange, maxRange, allowMovement) { }
|
||||
|
||||
protected override Activity InnerTick(Actor self, AttackBase attack)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
return this;
|
||||
|
||||
return Util.SequenceActivities(
|
||||
new AttackMoveActivity(self, new Move(self, target.Location, WRange.FromCells(2))),
|
||||
new AttackMoveActivity(self, new Move(self, target.Location, WDist.FromCells(2))),
|
||||
new Wait(25),
|
||||
this);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
public class Follow : Activity
|
||||
{
|
||||
readonly Target target;
|
||||
readonly WRange minRange;
|
||||
readonly WRange maxRange;
|
||||
readonly WDist minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly IMove move;
|
||||
|
||||
public Follow(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
public Follow(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
{
|
||||
this.target = target;
|
||||
this.minRange = minRange;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
readonly Mobile mobile;
|
||||
readonly IDisableMove[] moveDisablers;
|
||||
readonly WRange nearEnough;
|
||||
readonly WDist nearEnough;
|
||||
readonly Func<List<CPos>> getPath;
|
||||
readonly Actor ignoredActor;
|
||||
|
||||
@@ -50,14 +50,14 @@ namespace OpenRA.Mods.Common.Activities
|
||||
PathSearch.FromPoint(self.World, mobile.Info, self, mobile.ToCell, destination, false)
|
||||
.WithoutLaneBias());
|
||||
this.destination = destination;
|
||||
this.nearEnough = WRange.Zero;
|
||||
this.nearEnough = WDist.Zero;
|
||||
}
|
||||
|
||||
// HACK: for legacy code
|
||||
public Move(Actor self, CPos destination, int nearEnough)
|
||||
: this(self, destination, WRange.FromCells(nearEnough)) { }
|
||||
: this(self, destination, WDist.FromCells(nearEnough)) { }
|
||||
|
||||
public Move(Actor self, CPos destination, WRange nearEnough)
|
||||
public Move(Actor self, CPos destination, WDist nearEnough)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
this.nearEnough = nearEnough;
|
||||
}
|
||||
|
||||
public Move(Actor self, CPos destination, SubCell subCell, WRange nearEnough)
|
||||
public Move(Actor self, CPos destination, SubCell subCell, WDist nearEnough)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
|
||||
@@ -90,11 +90,11 @@ namespace OpenRA.Mods.Common.Activities
|
||||
.WithIgnoredActor(ignoredActor));
|
||||
|
||||
this.destination = destination;
|
||||
this.nearEnough = WRange.Zero;
|
||||
this.nearEnough = WDist.Zero;
|
||||
this.ignoredActor = ignoredActor;
|
||||
}
|
||||
|
||||
public Move(Actor self, Target target, WRange range)
|
||||
public Move(Actor self, Target target, WDist range)
|
||||
{
|
||||
mobile = self.Trait<Mobile>();
|
||||
moveDisablers = self.TraitsImplementing<IDisableMove>().ToArray();
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
this.getPath = getPath;
|
||||
|
||||
destination = null;
|
||||
nearEnough = WRange.Zero;
|
||||
nearEnough = WDist.Zero;
|
||||
}
|
||||
|
||||
static int HashList<T>(List<T> xs)
|
||||
|
||||
@@ -18,10 +18,10 @@ namespace OpenRA.Mods.Common.Activities
|
||||
{
|
||||
public class MoveWithinRange : MoveAdjacentTo
|
||||
{
|
||||
readonly WRange maxRange;
|
||||
readonly WRange minRange;
|
||||
readonly WDist maxRange;
|
||||
readonly WDist minRange;
|
||||
|
||||
public MoveWithinRange(Actor self, Target target, WRange minRange, WRange maxRange)
|
||||
public MoveWithinRange(Actor self, Target target, WDist minRange, WDist maxRange)
|
||||
: base(self, target)
|
||||
{
|
||||
this.minRange = minRange;
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common
|
||||
{
|
||||
// Move within sight range of the frozen actor
|
||||
var sight = self.TraitOrDefault<RevealsShroud>();
|
||||
var range = sight != null ? sight.Range : WRange.FromCells(2);
|
||||
var range = sight != null ? sight.Range : WDist.FromCells(2);
|
||||
|
||||
self.QueueActivity(move.MoveWithinRange(Target.FromPos(frozen.CenterPosition), range));
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
|
||||
public class DefaultSpriteSequence : ISpriteSequence
|
||||
{
|
||||
static readonly WRange DefaultShadowSpriteZOffset = new WRange(-5);
|
||||
static readonly WDist DefaultShadowSpriteZOffset = new WDist(-5);
|
||||
readonly Sprite[] sprites;
|
||||
readonly bool reverseFacings, transpose;
|
||||
|
||||
@@ -104,8 +104,8 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
{
|
||||
Start = LoadField<int>(d, "Start", 0);
|
||||
ShadowStart = LoadField<int>(d, "ShadowStart", -1);
|
||||
ShadowZOffset = LoadField<WRange>(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Range;
|
||||
ZOffset = LoadField<WRange>(d, "ZOffset", WRange.Zero).Range;
|
||||
ShadowZOffset = LoadField<WDist>(d, "ShadowZOffset", DefaultShadowSpriteZOffset).Range;
|
||||
ZOffset = LoadField<WDist>(d, "ZOffset", WDist.Zero).Range;
|
||||
Tick = LoadField<int>(d, "Tick", 40);
|
||||
transpose = LoadField<bool>(d, "Transpose", false);
|
||||
Frames = LoadField<int[]>(d, "Frames", null);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Pathfinder
|
||||
}
|
||||
}
|
||||
|
||||
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
|
||||
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self)
|
||||
{
|
||||
using (new PerfSample("Pathfinder"))
|
||||
{
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
public class AircraftInfo : ITraitInfo, IFacingInfo, IOccupySpaceInfo, ICruiseAltitudeInfo, UsesInit<LocationInit>, UsesInit<FacingInit>
|
||||
{
|
||||
public readonly WRange CruiseAltitude = new WRange(1280);
|
||||
public readonly WRange IdealSeparation = new WRange(1706);
|
||||
public readonly WDist CruiseAltitude = new WDist(1280);
|
||||
public readonly WDist IdealSeparation = new WDist(1706);
|
||||
[Desc("Whether the aircraft can be repulsed.")]
|
||||
public readonly bool Repulsable = true;
|
||||
[Desc("The speed at which the aircraft is repulsed from other aircraft. Specify -1 for normal movement speed.")]
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public virtual object Create(ActorInitializer init) { return new Aircraft(init, this); }
|
||||
public int GetInitialFacing() { return InitialFacing; }
|
||||
public WRange GetCruiseAltitude() { return CruiseAltitude; }
|
||||
public WDist GetCruiseAltitude() { return CruiseAltitude; }
|
||||
|
||||
[VoiceReference] public readonly string Voice = "Action";
|
||||
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly WAngle[] LocalYaw = { };
|
||||
|
||||
[Desc("Move the turret backwards when firing.")]
|
||||
public readonly WRange Recoil = WRange.Zero;
|
||||
public readonly WDist Recoil = WDist.Zero;
|
||||
|
||||
[Desc("Recoil recovery per-frame")]
|
||||
public readonly WRange RecoilRecovery = new WRange(9);
|
||||
public readonly WDist RecoilRecovery = new WDist(9);
|
||||
|
||||
[Desc("Muzzle flash sequence to render")]
|
||||
public readonly string MuzzleSequence = null;
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
Lazy<AmmoPool> ammoPool;
|
||||
List<Pair<int, Action>> delayedActions = new List<Pair<int, Action>>();
|
||||
|
||||
public WRange Recoil;
|
||||
public WDist Recoil;
|
||||
public int FireDelay { get; private set; }
|
||||
public int Burst { get; private set; }
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (FireDelay > 0)
|
||||
--FireDelay;
|
||||
|
||||
Recoil = new WRange(Math.Max(0, Recoil.Range - Info.RecoilRecovery.Range));
|
||||
Recoil = new WDist(Math.Max(0, Recoil.Range - Info.RecoilRecovery.Range));
|
||||
|
||||
for (var i = 0; i < delayedActions.Count; i++)
|
||||
{
|
||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (!target.IsInRange(self.CenterPosition, Weapon.Range))
|
||||
return null;
|
||||
|
||||
if (Weapon.MinRange != WRange.Zero && target.IsInRange(self.CenterPosition, Weapon.MinRange))
|
||||
if (Weapon.MinRange != WDist.Zero && target.IsInRange(self.CenterPosition, Weapon.MinRange))
|
||||
return null;
|
||||
|
||||
if (!Weapon.IsValidAgainst(target, self.World, self))
|
||||
@@ -215,7 +215,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public WVec MuzzleOffset(Actor self, Barrel b)
|
||||
{
|
||||
var bodyOrientation = coords.Value.QuantizeOrientation(self, self.Orientation);
|
||||
var localOffset = b.Offset + new WVec(-Recoil, WRange.Zero, WRange.Zero);
|
||||
var localOffset = b.Offset + new WVec(-Recoil, WDist.Zero, WDist.Zero);
|
||||
if (turret.Value != null)
|
||||
{
|
||||
var turretOrientation = coords.Value.QuantizeOrientation(self, turret.Value.LocalOrientation(self));
|
||||
|
||||
@@ -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)); }
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|| (target.Type == TargetType.FrozenActor && target.FrozenActor.Info.Traits.Contains<IMove>());
|
||||
|
||||
// Try and sit at least one cell closer than the max range to give some leeway if the target starts moving.
|
||||
var maxRange = targetIsMobile ? new WRange(Math.Max(weapon.Weapon.MinRange.Range, weapon.Weapon.Range.Range - 1024))
|
||||
var maxRange = targetIsMobile ? new WDist(Math.Max(weapon.Weapon.MinRange.Range, weapon.Weapon.Range.Range - 1024))
|
||||
: weapon.Weapon.Range;
|
||||
|
||||
attack.Target = target;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
return self.World.ActorsWithTrait<DetectCloaked>().Any(a => !a.Trait.IsTraitDisabled && a.Actor.Owner.IsAlliedWith(viewer)
|
||||
&& Info.CloakTypes.Intersect(a.Trait.Info.CloakTypes).Any()
|
||||
&& (self.CenterPosition - a.Actor.CenterPosition).Length <= WRange.FromCells(a.Trait.Info.Range).Range);
|
||||
&& (self.CenterPosition - a.Actor.CenterPosition).Length <= WDist.FromCells(a.Trait.Info.Range).Range);
|
||||
}
|
||||
|
||||
public Color RadarColorOverride(Actor self)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
self.SetTargetLine(target, Color.Yellow);
|
||||
|
||||
var range = WRange.FromCells(target.Actor.Info.Traits.Get<GuardableInfo>().Range);
|
||||
self.QueueActivity(false, new AttackMoveActivity(self, self.Trait<IMove>().MoveFollow(self, target, WRange.Zero, range)));
|
||||
var range = WDist.FromCells(target.Actor.Info.Traits.Get<GuardableInfo>().Range);
|
||||
self.QueueActivity(false, new AttackMoveActivity(self, self.Trait<IMove>().MoveFollow(self, target, WDist.Zero, range)));
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
|
||||
@@ -717,9 +717,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public Activity ScriptedMove(CPos cell) { return new Move(self, cell); }
|
||||
public Activity MoveTo(CPos cell, int nearEnough) { return new Move(self, cell, nearEnough); }
|
||||
public Activity MoveTo(CPos cell, Actor ignoredActor) { return new Move(self, cell, ignoredActor); }
|
||||
public Activity MoveWithinRange(Target target, WRange range) { return new MoveWithinRange(self, target, WRange.Zero, range); }
|
||||
public Activity MoveWithinRange(Target target, WRange minRange, WRange maxRange) { return new MoveWithinRange(self, target, minRange, maxRange); }
|
||||
public Activity MoveFollow(Actor self, Target target, WRange minRange, WRange maxRange) { return new Follow(self, target, minRange, maxRange); }
|
||||
public Activity MoveWithinRange(Target target, WDist range) { return new MoveWithinRange(self, target, WDist.Zero, range); }
|
||||
public Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange) { return new MoveWithinRange(self, target, minRange, maxRange); }
|
||||
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange) { return new Follow(self, target, minRange, maxRange); }
|
||||
public Activity MoveTo(Func<List<CPos>> pathFunc) { return new Move(self, pathFunc); }
|
||||
|
||||
public void OnNotifyBlockingMove(Actor self, Actor blocking)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class ParaDropInfo : ITraitInfo, Requires<CargoInfo>
|
||||
{
|
||||
[Desc("Distance around the drop-point to unload troops.")]
|
||||
public readonly WRange DropRange = WRange.FromCells(4);
|
||||
public readonly WDist DropRange = WDist.FromCells(4);
|
||||
|
||||
[Desc("Sound to play when dropping.")]
|
||||
public readonly string ChuteSound = "chute1.aud";
|
||||
|
||||
@@ -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 = { };
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
IEnumerable<Actor> UnitsInRange()
|
||||
{
|
||||
return Self.World.FindActorsInCircle(Self.CenterPosition, WRange.FromCells(Info.Range))
|
||||
return Self.World.FindActorsInCircle(Self.CenterPosition, WDist.FromCells(Info.Range))
|
||||
.Where(a => a.IsInWorld && a != Self && !a.Disposed && !a.Owner.NonCombatant);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
var range = self.TraitsImplementing<DetectCloaked>()
|
||||
.Where(a => !a.IsTraitDisabled)
|
||||
.Select(a => WRange.FromCells(a.Info.Range))
|
||||
.Append(WRange.Zero).Max();
|
||||
.Select(a => WDist.FromCells(a.Info.Range))
|
||||
.Append(WDist.Zero).Max();
|
||||
|
||||
if (range == WRange.Zero)
|
||||
if (range == WDist.Zero)
|
||||
yield break;
|
||||
|
||||
yield return new RangeCircleRenderable(
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string RangeCircleType = null;
|
||||
|
||||
[Desc("Range to draw if no armaments are available")]
|
||||
public readonly WRange FallbackRange = WRange.Zero;
|
||||
public readonly WDist FallbackRange = WDist.Zero;
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (armaments.Any())
|
||||
range = armaments.Select(a => w.Map.Rules.Weapons[a.Weapon.ToLowerInvariant()].Range).Max();
|
||||
|
||||
if (range == WRange.Zero)
|
||||
if (range == WDist.Zero)
|
||||
yield break;
|
||||
|
||||
yield return new RangeCircleRenderable(
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
yield break;
|
||||
|
||||
var range = attack.GetMaximumRange();
|
||||
if (range == WRange.Zero)
|
||||
if (range == WDist.Zero)
|
||||
yield break;
|
||||
|
||||
yield return new RangeCircleRenderable(
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Color Color = Color.FromArgb(128, Color.White);
|
||||
|
||||
[Desc("Range of the circle")]
|
||||
public readonly WRange Range = WRange.Zero;
|
||||
public readonly WDist Range = WDist.Zero;
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
/// <returns>A path from start to target</returns>
|
||||
List<CPos> FindUnitPath(CPos source, CPos target, Actor self);
|
||||
|
||||
List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self);
|
||||
List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self);
|
||||
|
||||
/// <summary>
|
||||
/// Calculates a path given a search specification
|
||||
@@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return pb;
|
||||
}
|
||||
|
||||
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WRange range, Actor self)
|
||||
public List<CPos> FindUnitPathToRange(CPos source, SubCell srcSub, WPos target, WDist range, Actor self)
|
||||
{
|
||||
var mi = self.Info.Traits.Get<MobileInfo>();
|
||||
var targetCell = world.Map.CellContaining(target);
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public interface INotifyChat { bool OnChat(string from, string message); }
|
||||
public interface INotifyParachuteLanded { void OnLanded(); }
|
||||
public interface IRenderActorPreviewInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); }
|
||||
public interface ICruiseAltitudeInfo { WRange GetCruiseAltitude(); }
|
||||
public interface ICruiseAltitudeInfo { WDist GetCruiseAltitude(); }
|
||||
|
||||
public interface IUpgradable
|
||||
{
|
||||
@@ -102,7 +102,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public interface ICallForTransport
|
||||
{
|
||||
WRange MinimumDistance { get; }
|
||||
WDist MinimumDistance { get; }
|
||||
bool WantsTransport { get; set; }
|
||||
void MovementCancelled(Actor self);
|
||||
void RequestTransport(CPos destination, Activity afterLandActivity);
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
public class HealthPercentageDamageWarhead : DamageWarhead
|
||||
{
|
||||
[Desc("Size of the area. Damage will be applied to this area.", "If two spreads are defined, the area of effect is a ring, where the second value is the inner radius.")]
|
||||
public readonly WRange[] Spread = { new WRange(43) };
|
||||
public readonly WDist[] Spread = { new WDist(43) };
|
||||
|
||||
public override void DoImpact(WPos pos, Actor firedBy, IEnumerable<int> damageModifiers)
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
|
||||
@@ -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<int> damageModifiers)
|
||||
{
|
||||
|
||||
@@ -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<Mobile>();
|
||||
if (targetMobile == null)
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace OpenRA.Mods.RA.Graphics
|
||||
var renderables = new List<IFinalizedRenderable>();
|
||||
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));
|
||||
|
||||
@@ -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); }
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
yield return new RangeCircleRenderable(
|
||||
self.CenterPosition,
|
||||
WRange.FromCells(self.Trait<PortableChrono>().Info.MaxDistance),
|
||||
WDist.FromCells(self.Trait<PortableChrono>().Info.MaxDistance),
|
||||
0,
|
||||
Color.FromArgb(128, Color.LawnGreen),
|
||||
Color.FromArgb(96, Color.Black));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user