From 719a9c1a77733040de8e1c4256b92111dcc53c13 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 29 Mar 2024 00:24:51 +0100 Subject: [node] fixed mining and selling loop issues --- nodejs/automation/mining.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'nodejs/automation/mining.ts') diff --git a/nodejs/automation/mining.ts b/nodejs/automation/mining.ts index e1230fd..b9db7d4 100644 --- a/nodejs/automation/mining.ts +++ b/nodejs/automation/mining.ts @@ -20,12 +20,9 @@ export async function mineUntilFullOf(good: string, ship: Ship, asteroidSymbol: } } -// example ctx { symbol: 'ADYXAX-2' } -// extract the ship's cargo contents when more than 80% full then returns the ships cargo object async function mineUntilFull(ship: Ship): Promise { - ship = dbShips.getShip(ship.symbol) as Ship; - while (ship.cargo.units <= ship.cargo.capacity * 0.9) { - ship.cargo = await libShips.extract(ship); + while (!libShips.isFull(ship)) { + await libShips.extract(ship); } } -- cgit v1.2.3