1
0
Fork 0

[node] fix shortest path to only hop through refueling points

This commit is contained in:
Julien Dessaux 2024-05-05 00:08:28 +02:00
parent 063b2c9951
commit 5aac233c08
Signed by: adyxax
GPG key ID: F92E51B86E07177E
3 changed files with 26 additions and 14 deletions

View file

@ -103,7 +103,7 @@ export class Ship {
return this.cargo.units >= this.cargo.capacity * 0.9;
}
async navigate(waypoint: Waypoint): Promise<void> {
let path = shortestPath(await libSystems.waypoint(this.nav.route.destination.symbol), waypoint, this.fuel.capacity, await libSystems.waypoints(this.nav.systemSymbol));
let path = await shortestPath(await libSystems.waypoint(this.nav.route.destination.symbol), waypoint, this.fuel.capacity, await libSystems.waypoints(this.nav.systemSymbol));
while (path.length > 0) {
const next = path.pop();
if (next === undefined) break;