diff options
author | Julien Dessaux | 2024-04-06 10:55:11 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-04-07 23:01:52 +0200 |
commit | eeaa64b5ed54cee8f4ffc85f96178e9799c1a8ac (patch) | |
tree | 4c9ebcfd01773bb6c34e66e1325cf40739dae17f /nodejs/automation/mining.ts | |
parent | [node] Big Ships lib refactoring (diff) | |
download | spacetraders-eeaa64b5ed54cee8f4ffc85f96178e9799c1a8ac.tar.gz spacetraders-eeaa64b5ed54cee8f4ffc85f96178e9799c1a8ac.tar.bz2 spacetraders-eeaa64b5ed54cee8f4ffc85f96178e9799c1a8ac.zip |
[node] waypoints usage refactoring
Diffstat (limited to '')
-rw-r--r-- | nodejs/automation/mining.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/nodejs/automation/mining.ts b/nodejs/automation/mining.ts index 07fa19b..cdfcb78 100644 --- a/nodejs/automation/mining.ts +++ b/nodejs/automation/mining.ts @@ -1,10 +1,13 @@ import * as selling from './selling.js'; import * as dbContracts from '../database/contracts.js'; import { Ship } from '../lib/ships.js'; -import { Contract } from '../lib/types.ts'; +import { + Contract, + Waypoint, +} from '../lib/types.ts'; import { categorizeCargo } from '../lib/utils.ts'; -export async function mineUntilFullFor(contract: Contract, ship: Ship, asteroidSymbol: string): Promise<void> { +export async function mineUntilFullFor(contract: Contract, ship: Ship, asteroid: Waypoint): Promise<void> { // TODO find a good asteroid while(true) { await mineUntilFull(ship); @@ -17,7 +20,7 @@ export async function mineUntilFullFor(contract: Contract, ship: Ship, asteroidS || cargo.wanted[deliver.tradeSymbol] >= deliver.unitsRequired - deliver.unitsFulfilled) return; // we are full but need to sell junk await selling.sell(ship, deliver.tradeSymbol); - await ship.navigate(asteroidSymbol); + await ship.navigate(asteroid); } } |