Bitburner-Scripts/servers/home/hackallservers.ts

13 lines
465 B
TypeScript
Raw Normal View History

2023-11-03 21:57:09 -03:00
import { executeScriptOnServerFromAnother, recursiveScan } from "./utils"
2023-11-03 18:42:37 -03:00
export async function main(ns: NS) {
let servers: string[] = recursiveScan(ns)
for (const server of servers) {
2023-11-03 21:57:09 -03:00
let numThreads = ns.getServerMaxRam(server) / ns.getScriptRam("hack.js")
2023-11-03 18:42:37 -03:00
numThreads = Math.floor(numThreads)
2023-11-04 17:14:34 -03:00
numThreads = Math.max(numThreads, 1) // Make sure we have at least 1 thread
2023-11-03 21:57:09 -03:00
executeScriptOnServerFromAnother(ns, server, "hack.js", numThreads, [server])
2023-11-03 18:42:37 -03:00
}
}