summaryrefslogtreecommitdiff
path: root/nodejs/automation
diff options
context:
space:
mode:
authorJulien Dessaux2024-05-05 00:08:28 +0200
committerJulien Dessaux2024-05-05 00:08:28 +0200
commit5aac233c08567844d6b99afb4d0a1a56725dd6c4 (patch)
tree337d883da98b020d4652b612eaa2d06fd9a1f5d5 /nodejs/automation
parent[node] crudely handle tradevolume limit while selling (diff)
downloadspacetraders-5aac233c08567844d6b99afb4d0a1a56725dd6c4.tar.gz
spacetraders-5aac233c08567844d6b99afb4d0a1a56725dd6c4.tar.bz2
spacetraders-5aac233c08567844d6b99afb4d0a1a56725dd6c4.zip
[node] fix shortest path to only hop through refueling points
Diffstat (limited to '')
-rw-r--r--nodejs/automation/selling.ts9
1 files changed, 1 insertions, 8 deletions
diff --git a/nodejs/automation/selling.ts b/nodejs/automation/selling.ts
index 5dee8f7..b17aad0 100644
--- a/nodejs/automation/selling.ts
+++ b/nodejs/automation/selling.ts
@@ -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 );
-}