mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
Petra: update the target of an attack when it has been captured
This was SVN commit r16532.
This commit is contained in:
parent
01673b4c58
commit
7fbab6dd10
1 changed files with 11 additions and 11 deletions
|
|
@ -1663,22 +1663,22 @@ m.AttackPlan.prototype.removeUnit = function(ent, update)
|
|||
|
||||
m.AttackPlan.prototype.checkEvents = function(gameState, events)
|
||||
{
|
||||
if (this.target)
|
||||
let renameEvents = events["EntityRenamed"];
|
||||
for (let evt of renameEvents)
|
||||
{
|
||||
let renameEvents = events["EntityRenamed"];
|
||||
for (let evt of renameEvents)
|
||||
if (this.target && this.target.id() == evt.entity)
|
||||
{
|
||||
if (this.target.id() == evt.entity)
|
||||
{
|
||||
this.target = gameState.getEntityById(evt.newentity);
|
||||
if (this.target)
|
||||
this.targetPos = this.target.position();
|
||||
else
|
||||
this.targetPos = undefined;
|
||||
}
|
||||
this.target = gameState.getEntityById(evt.newentity);
|
||||
if (this.target)
|
||||
this.targetPos = this.target.position();
|
||||
}
|
||||
}
|
||||
|
||||
let captureEvents = events["OwnershipChanged"];
|
||||
for (let evt of captureEvents)
|
||||
if (this.target && this.target.id() == evt.entity && gameState.isPlayerAlly(evt.to))
|
||||
this.target = undefined;
|
||||
|
||||
if (this.state === "unexecuted")
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue