summaryrefslogtreecommitdiff
path: root/nodejs/automation
diff options
context:
space:
mode:
authorJulien Dessaux2024-03-17 01:23:40 +0100
committerJulien Dessaux2024-03-17 01:27:35 +0100
commit0377c99a549bed141d1371577a8d0b10dd09f40d (patch)
tree05a764e592f15f0a5521d2e4c77264973dde43cf /nodejs/automation
parent[javascript] Rework the contracting loop following the asteroids changes (diff)
downloadspacetraders-0377c99a549bed141d1371577a8d0b10dd09f40d.tar.gz
spacetraders-0377c99a549bed141d1371577a8d0b10dd09f40d.tar.bz2
spacetraders-0377c99a549bed141d1371577a8d0b10dd09f40d.zip
[javascript] refactoring
Diffstat (limited to 'nodejs/automation')
-rw-r--r--nodejs/automation/contracting.js4
-rw-r--r--nodejs/automation/utils.js3
2 files changed, 2 insertions, 5 deletions
diff --git a/nodejs/automation/contracting.js b/nodejs/automation/contracting.js
index 220b21b..75bc96c 100644
--- a/nodejs/automation/contracting.js
+++ b/nodejs/automation/contracting.js
@@ -5,7 +5,7 @@ import * as api from '../lib/api.js';
import * as contracts from '../lib/contracts.js';
import * as libShips from '../lib/ships.js';
import * as systems from '../lib/systems.js';
-import * as utils from './utils.js';
+import * as utils from '../lib/utils.js';
export async function init() {
const cs = dbContracts.getContracts();
@@ -14,7 +14,7 @@ export async function init() {
async function run(contract) {
await contracts.accept({id: contract.id});
- const contractSystem = utils.waypointToSystem(contract.terms.deliver[0].destinationSymbol);
+ const contractSystem = utils.systemFromWaypoint(contract.terms.deliver[0].destinationSymbol);
let ships = dbShips.getShipsAt(contractSystem);
ships = ships.filter(ship => ship.registration.role !== 'SATELLITE'); // filter out probes
diff --git a/nodejs/automation/utils.js b/nodejs/automation/utils.js
deleted file mode 100644
index 01ce1ad..0000000
--- a/nodejs/automation/utils.js
+++ /dev/null
@@ -1,3 +0,0 @@
-export function waypointToSystem(waypoint) {
- return waypoint.split('-').slice(0,2).join('-');
-}