Fix logic bug

This commit is contained in:
Isaac Shoebottom 2023-11-03 21:38:00 -03:00
parent 74aae19a82
commit 29d88170ab

View File

@ -97,10 +97,10 @@ export function performFunctionIfCapable(ns: NS, server: string, func: CallableF
}
if (ns.getServerNumPortsRequired(server) < ns.getServer(server).openPortCount) {
ns.print(`Not enough ports, trying to root ${server}`)
if (rootServer(ns, server) < ns.getServerNumPortsRequired(server)) {
ns.print(`Need more port opening programs to root ${server}`)
return false
}
}
if (rootServer(ns, server) < ns.getServerNumPortsRequired(server)) {
ns.print(`Need more port opening programs to root ${server}`)
return false
}
if (!ns.hasRootAccess(server)) {
ns.print(`Failed to root ${server}`)