diff options
author | Julien Dessaux | 2024-03-29 00:24:51 +0100 |
---|---|---|
committer | Julien Dessaux | 2024-03-29 00:24:51 +0100 |
commit | 719a9c1a77733040de8e1c4256b92111dcc53c13 (patch) | |
tree | 4cc20d3a386507085840b8880ad4350754fbecf2 /nodejs/automation/mining.ts | |
parent | [node] stop trying to optimize useless things like local database calls (diff) | |
download | spacetraders-719a9c1a77733040de8e1c4256b92111dcc53c13.tar.gz spacetraders-719a9c1a77733040de8e1c4256b92111dcc53c13.tar.bz2 spacetraders-719a9c1a77733040de8e1c4256b92111dcc53c13.zip |
[node] fixed mining and selling loop issues
Diffstat (limited to '')
-rw-r--r-- | nodejs/automation/mining.ts | 7 |
1 files changed, 2 insertions, 5 deletions
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<void> { - 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); } } |