This commit is contained in:
2024-10-15 21:51:28 +02:00
parent 3bf0443571
commit fd29b0d35d
10 changed files with 160 additions and 37 deletions

View File

@@ -14,12 +14,14 @@ export async function main(ns) {
const sGrowScript = "lowram/Lowgrow.js";
const sDistScript = "testdistribute.js";
await ns.sleep(100);
//declare variables
const sWeakenScript = "RMweaken.js";
const nCores = oHome.cpuCores;
let nSecurity = ns.getServerSecurityLevel(sTarget);
const nMinSecurity = ns.getServerMinSecurityLevel(sTarget);
const nWeakenSTR = ns.weakenAnalyze(1, nCores);
const nWeakenSTR = ns.weakenAnalyze(1, 1);
let nThreads = Math.ceil((nSecurity - nMinSecurity) / nWeakenSTR);
//ns.print("nThreads = " + nThreads);
@@ -41,7 +43,7 @@ export async function main(ns) {
ns.print("weakening will take " + (nDelay / 1000 / 60) + " minutes");
ns.run(sDistScript, 1, sWeakenScript, nThreads, sTarget, false, 0);
await ns.sleep(nDelay+10);
await ns.sleep(nDelay);
/*
if ((ns.getServerMaxRam(oHome.hostname) - ns.getServerUsedRam(oHome.hostname)) >= (ns.getScriptRam(sWeakenScript, "home") * nThreads)) {
nWeakenPID = ns.exec(sWeakenScript, nThreads, sTarget);
@@ -62,5 +64,6 @@ export async function main(ns) {
*/
}
//back to Lowrun
await ns.sleep(1);
ns.spawn(sRunScript, { threads: 1, spawnDelay: 0 }, sTarget);
}