1
0
Fork 0

[javascript] Rework the contracting loop following the asteroids changes

This commit is contained in:
Julien Dessaux 2024-03-15 22:17:10 +01:00
parent 4c4e4cb98f
commit 01e3f05ea0
Signed by: adyxax
GPG key ID: F92E51B86E07177E
5 changed files with 30 additions and 20 deletions

View file

@ -10,7 +10,7 @@ let busy = false; // true if we are already sending api requests.
let backoffSeconds = 0;
let running = false;
// other module variables
let headers = undefined; // a file scope variable so that we only evaluate these once.
let headers = undefined; // a file scoped variable so that we only evaluate these once.
let queue = new PriorityQueue(); // a priority queue to hold api calls we want to send, allows for throttling.
// a single queue processor should be running at any time, otherwise there will be trouble!

View file

@ -5,7 +5,7 @@ import * as systems from '../lib/systems.js';
export async function extract(ctx) {
const ship = dbShips.getShip(ctx.symbol);
const asteroidFields = await systems.type({symbol: ship.nav.systemSymbol, type: 'ASTEROID_FIELD'});
const asteroidFields = await systems.type({symbol: ship.nav.systemSymbol, type: 'ENGINEERED_ASTEROID'});
// TODO if there are multiple fields, find the closest one?
await navigate({symbol: ctx.symbol, waypoint: asteroidFields[0].symbol});
await orbit(ctx);