bugfix: destroys not capturing tradeships

This commit is contained in:
Evan
2024-11-25 09:19:22 -08:00
parent 0b062179ac
commit 146a7ef657
2 changed files with 8 additions and 5 deletions
+6 -5
View File
@@ -44,17 +44,18 @@ export class TradeShipExecution implements Execution {
this.active = false
return
}
if (!this.dstPort.isActive() || !this.tradeShip.owner().isAlliedWith(this.dstPort.owner())) {
this.tradeShip.delete()
this.active = false
return
}
if (this.origOwner != this.tradeShip.owner()) {
// Store as vairable in case ship is recaptured by previous owner
this.wasCaptured = true
}
if (!this.wasCaptured && (!this.dstPort.isActive() || !this.tradeShip.owner().isAlliedWith(this.dstPort.owner()))) {
this.tradeShip.delete()
this.active = false
return
}
if (this.wasCaptured) {
const ports = this.tradeShip.owner().units(UnitType.Port).sort(distSortUnit(this.tradeShip))
if (ports.length == 0) {