mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-26 17:44:36 +00:00
665a8c3823
when an building is taken over by another player the execution for it doesnt change its owner this makes it so when a sam is captured it tries to intercept your own nukes and doesnt intercept the ones by the previous player this change makes executions of buildings automaticly switch their owner
36 lines
751 B
TypeScript
36 lines
751 B
TypeScript
import { Execution, Game, Player, PlayerID } from "../game/Game";
|
|
|
|
const cancelDelay = 2;
|
|
|
|
export class MoveWarshipExecution implements Execution {
|
|
private active = true;
|
|
private mg: Game;
|
|
|
|
constructor(
|
|
public readonly unitId: number,
|
|
public readonly position: number,
|
|
) {}
|
|
|
|
init(mg: Game, ticks: number): void {
|
|
this.mg = mg;
|
|
}
|
|
|
|
tick(ticks: number): void {
|
|
const warship = this.mg.units().find((u) => u.id() == this.unitId);
|
|
if (!warship) {
|
|
console.log("MoveWarshipExecution: warship is already dead");
|
|
return;
|
|
}
|
|
warship.setMoveTarget(this.position);
|
|
this.active = false;
|
|
}
|
|
|
|
isActive(): boolean {
|
|
return this.active;
|
|
}
|
|
|
|
activeDuringSpawnPhase(): boolean {
|
|
return false;
|
|
}
|
|
}
|