-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmarker.js
More file actions
14 lines (14 loc) · 785 Bytes
/
Copy pathmarker.js
File metadata and controls
14 lines (14 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { getAllServers } from "ze-lib.js";
/** @param {NS} ns */
export async function main(ns) {
ns.clearLog(); ns.disableLog('ALL');
const [currentLayout, fileName, s] = [[], "charge_guide.txt", ns.stanek];
ns.print(`Filename set as: ${fileName}\n`);
s.activeFragments().forEach(obj => obj.limit < 99 && currentLayout.push({ x: obj.x, y: obj.y }));
ns.write(fileName, JSON.stringify(currentLayout), "w"); ns.print(`Saved: ${fileName}`);
const nowReadIt = JSON.parse(ns.read(fileName)); ns.print(`Testing file read back:\n` + JSON.stringify(nowReadIt));
for (const server of getAllServers(ns)) {
if (server === "home" || !ns.fileExists(fileName, ns.getHostname())) continue;
if (ns.scp(fileName, server, ns.getHostname())) ns.print(`SUCCESS:${fileName} -> ${server}`);
}
}