[node] fix shortest path to only hop through refueling points
This commit is contained in:
parent
063b2c9951
commit
5aac233c08
3 changed files with 26 additions and 14 deletions
|
@ -3,12 +3,9 @@ import * as libSystems from '../lib/systems.ts';
|
|||
import {
|
||||
categorizeCargo,
|
||||
sortByDistanceFrom,
|
||||
whatCanBeTradedAt,
|
||||
} from '../lib/utils.ts';
|
||||
import { Ship } from '../lib/ships.ts';
|
||||
import {
|
||||
CargoManifest,
|
||||
CommonThing,
|
||||
} from '../lib/types.ts';
|
||||
|
||||
// example ctx { ship: {XXX}, keep: 'SILVER_ORE' }
|
||||
export async function sell(ship: Ship, good: string): Promise<Ship> {
|
||||
|
@ -54,7 +51,3 @@ export async function sell(ship: Ship, good: string): Promise<Ship> {
|
|||
throw new Error(`Ship {ship.symbol} has found no importing or exchanging market for its cargo in the system`);
|
||||
}
|
||||
}
|
||||
|
||||
function whatCanBeTradedAt(cargo: CargoManifest, goods: Array<CommonThing>): Array<CommonThing> {
|
||||
return goods.filter(g => cargo[g.symbol] !== undefined );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue