petra: fixes some unit assignments
This was SVN commit r21214.
This commit is contained in:
parent
8f4db16139
commit
98791a86a1
@ -640,7 +640,7 @@ m.AttackPlan.prototype.assignUnits = function(gameState)
|
||||
return added;
|
||||
}
|
||||
|
||||
if (this.type === "Raid")
|
||||
if (this.type == "Raid")
|
||||
{
|
||||
// Raid are fast cavalry attack: assign all cav except some for hunting
|
||||
let num = 0;
|
||||
@ -699,10 +699,10 @@ m.AttackPlan.prototype.assignUnits = function(gameState)
|
||||
m.dumpEntity(ent);
|
||||
continue;
|
||||
}
|
||||
if (this.type !== "Rush" && ent.getMetadata(PlayerID, "subrole") !== "idle")
|
||||
continue;
|
||||
if (num++ < keep || numbase[baseID] < 5)
|
||||
continue;
|
||||
if (this.type != "Rush" && ent.getMetadata(PlayerID, "subrole") != "idle")
|
||||
continue;
|
||||
ent.setMetadata(PlayerID, "plan", plan);
|
||||
this.unitCollection.updateEnt(ent);
|
||||
added = true;
|
||||
|
@ -184,7 +184,9 @@ m.TransportPlan.prototype.removeUnit = function(gameState, unit)
|
||||
{
|
||||
let shipId = unit.getMetadata(PlayerID, "onBoard");
|
||||
if (shipId == "onBoard")
|
||||
return; // too late, already onBoard
|
||||
return; // too late, already onBoard
|
||||
else if (shipId !== undefined)
|
||||
unit.stopMoving(); // cancel the garrison order
|
||||
unit.setMetadata(PlayerID, "transport", undefined);
|
||||
unit.setMetadata(PlayerID, "endPos", undefined);
|
||||
this.units.updateEnt(unit);
|
||||
|
Loading…
Reference in New Issue
Block a user