Petra: use moveToRange() instead of move() in some cases

Patch by Sandarac

Reviewed By: mimo
Differential Revision: https://code.wildfiregames.com/D676
This was SVN commit r19834.
This commit is contained in:
mimo
2017-06-26 18:25:18 +00:00
parent be2b2faa77
commit 4241cf441d
3 changed files with 11 additions and 4 deletions
@@ -153,6 +153,13 @@ m.EntityCollection.prototype.move = function(x, z, queued)
return this;
};
m.EntityCollection.prototype.moveToRange = function(x, z, min, max, queued)
{
queued = queued || false;
Engine.PostCommand(PlayerID,{"type": "walk-to-range", "entities": this.toIdArray(), "x": x, "z": z, "min": min, "max": max, "queued": queued });
return this;
};
m.EntityCollection.prototype.attackMove = function(x, z, targetClasses, queued)
{
queued = queued || false;
@@ -1154,7 +1154,7 @@ m.AttackPlan.prototype.StartAttack = function(gameState)
return false;
}
this.state = "walking";
this.unitCollection.move(this.path[0][0], this.path[0][1]);
this.unitCollection.moveToRange(this.path[0][0], this.path[0][1], 0, 15);
}
else
{
@@ -1752,7 +1752,7 @@ m.AttackPlan.prototype.UpdateWalking = function(gameState, events)
{
this.path.shift();
if (this.path.length)
this.unitCollection.move(this.path[0][0], this.path[0][1]);
this.unitCollection.moveToRange(this.path[0][0], this.path[0][1], 0, 15);
else
{
if (this.Config.debug > 1)
@@ -1865,7 +1865,7 @@ m.AttackPlan.prototype.Abort = function(gameState)
if (ent.getMetadata(PlayerID, "role") === "attack")
ent.stopMoving();
if (withdrawal)
ent.move(rallyPoint[0], rallyPoint[1]);
ent.moveToRange(rallyPoint[0], rallyPoint[1], 0, 15);
this.removeUnit(ent);
}
}
@@ -317,7 +317,7 @@ m.TransportPlan.prototype.onBoarding = function(gameState)
ent.garrison(ship, true);
}
else // wait for the ship
ent.move(self.boardingPos[shipId][0], self.boardingPos[shipId][1]);
ent.moveToRange(self.boardingPos[shipId][0], self.boardingPos[shipId][1], 0, 15);
}
else
self.nTry[ent.id()] = 0;