[node] implement shipyard info retrieval and database caching
This commit is contained in:
parent
ccbfd9deb9
commit
4cb5c7853c
5 changed files with 81 additions and 10 deletions
|
@ -2,9 +2,8 @@ import {
|
|||
debugLog,
|
||||
} from './api.ts';
|
||||
import { PriorityQueue } from './priority_queue.ts';
|
||||
import {
|
||||
market,
|
||||
} from './systems.ts';
|
||||
import { getShips } from './ships.ts';
|
||||
import { market } from './systems.ts';
|
||||
import {
|
||||
Cargo,
|
||||
CargoManifest,
|
||||
|
@ -41,6 +40,10 @@ export function distance(a: Point, b: Point) {
|
|||
return Math.sqrt((a.x-b.x)**2 + (a.y-b.y)**2);
|
||||
}
|
||||
|
||||
export function isThereAShipAtThisWaypoint(waypoint: Waypoint): boolean {
|
||||
return getShips().some(s => s.nav.waypointSymbol === waypoint.symbol);
|
||||
}
|
||||
|
||||
export function sortByDistanceFrom<T extends Point>(a: Point, points: Array<T>): Array<{data: T, distance: number}>{
|
||||
let result = points.map(function (m) { return {
|
||||
data: m,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue