mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-26 21:52:46 +00:00
Fix: Resolve deployment failure due to euclideanDist
Corrected the usage of distance calculation in MIRVExecution.ts. Previously, euclideanDist was called on the Game object, which does not exist. Changed to use Math.sqrt(this.mg.euclideanDistSquared()) which is the correct method. This resolves the TS2339: Property 'euclideanDist' does not exist on type 'Game'. error that caused the deployment to fail.
This commit is contained in:
@@ -45,7 +45,6 @@ export class MirvExecution implements Execution {
|
||||
this.pathFinder = new ParabolaPathFinder(mg);
|
||||
this.targetPlayer = this.mg.owner(this.dst);
|
||||
|
||||
|
||||
// Record stats
|
||||
this.mg.stats().bombLaunch(this.player, this.targetPlayer, UnitType.MIRV);
|
||||
|
||||
@@ -77,7 +76,9 @@ export class MirvExecution implements Execution {
|
||||
this.separateDst = this.mg.ref(x, y);
|
||||
this.pathFinder.computeControlPoints(spawn, this.separateDst);
|
||||
// Calculate speed for fixed travel time
|
||||
const distance = this.mg.euclideanDist(spawn, this.separateDst);
|
||||
const distance = Math.sqrt(
|
||||
this.mg.euclideanDistSquared(spawn, this.separateDst),
|
||||
);
|
||||
this.speed = distance / this.MIRV_FIXED_TRAVEL_TIME;
|
||||
|
||||
this.mg.displayIncomingUnit(
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
PlayerType,
|
||||
UnitType,
|
||||
} from "../../../src/core/game/Game";
|
||||
import { TileRef } from "../../../src/core/game/GameMap";
|
||||
|
||||
import { setup } from "../../util/Setup";
|
||||
import { constructionExecution, executeTicks } from "../../util/utils";
|
||||
import { constructionExecution } from "../../util/utils";
|
||||
|
||||
let game: Game;
|
||||
let player: Player;
|
||||
|
||||
Reference in New Issue
Block a user