Use WRange for Mobile.MoveWithinRange.
This commit is contained in:
@@ -516,7 +516,7 @@ namespace OpenRA.Mods.RA.Move
|
||||
public Activity ScriptedMove(CPos cell) { return new Move(cell); }
|
||||
public Activity MoveTo(CPos cell, int nearEnough) { return new Move(cell, nearEnough); }
|
||||
public Activity MoveTo(CPos cell, Actor ignoredActor) { return new Move(cell, ignoredActor); }
|
||||
public Activity MoveWithinRange(Target target, int range) { return new Move(target, range); }
|
||||
public Activity MoveWithinRange(Target target, WRange range) { return new Move(target, range); }
|
||||
public Activity MoveTo(Func<List<CPos>> pathFunc) { return new Move(pathFunc); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,19 +59,20 @@ namespace OpenRA.Mods.RA.Move
|
||||
}
|
||||
|
||||
static readonly List<CPos> NoPath = new List<CPos>();
|
||||
public Move(Target target, int range)
|
||||
public Move(Target target, WRange range)
|
||||
{
|
||||
this.getPath = (self, mobile) =>
|
||||
{
|
||||
if (!target.IsValid)
|
||||
return NoPath;
|
||||
|
||||
// TODO: Adjust range to account for target center position
|
||||
return self.World.WorldActor.Trait<PathFinder>().FindUnitPathToRange(
|
||||
mobile.toCell, target.CenterPosition.ToCPos(), range, self);
|
||||
mobile.toCell, target.CenterPosition.ToCPos(), range.Range / 1024, self);
|
||||
};
|
||||
|
||||
this.destination = null;
|
||||
this.nearEnough = range;
|
||||
this.nearEnough = range.Range / 1024;
|
||||
}
|
||||
|
||||
public Move(Func<List<CPos>> getPath)
|
||||
|
||||
Reference in New Issue
Block a user