From eeaa64b5ed54cee8f4ffc85f96178e9799c1a8ac Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 6 Apr 2024 10:55:11 +0200 Subject: [node] waypoints usage refactoring --- nodejs/automation/mining.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'nodejs/automation/mining.ts') 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 { +export async function mineUntilFullFor(contract: Contract, ship: Ship, asteroid: Waypoint): Promise { // 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); } } -- cgit v1.2.3