rename WRange to WDist
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user