fixed bug causing crash when capturing trade ship already captured by another destroyer

This commit is contained in:
Evan
2024-11-22 20:49:45 -08:00
parent a2a6654bf5
commit 1e2b23d2de
2 changed files with 11 additions and 6 deletions
+5
View File
@@ -77,6 +77,11 @@ export class DestroyerExecution implements Execution {
}
this.target = ships.sort(distSortUnit(this.destroyer))[0]
}
if (!this.target.isActive() || this.target.owner() == this._owner) {
// Incase another destroyer captured or destroyed target
this.target = null
return
}
for (let i = 0; i < 2; i++) {
const result = this.pathfinder.nextTile(this.destroyer.tile(), this.target.tile(), 5)