mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 04:53:06 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user