mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Merge pull request #2332 from woody-lam-cwl/nuke-runtime-error
Fix #2329 NUKE.exe runtime error
This commit is contained in:
commit
07b12ca6fb
@ -443,7 +443,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
getServer: safeGetServer,
|
getServer: safeGetServer,
|
||||||
checkSingularityAccess: checkSingularityAccess,
|
checkSingularityAccess: checkSingularityAccess,
|
||||||
hack: hack,
|
hack: hack,
|
||||||
getValidPort: (funcName:string, port: any): IPort => {
|
getValidPort: (funcName: string, port: any): IPort => {
|
||||||
if (isNaN(port)) {
|
if (isNaN(port)) {
|
||||||
throw makeRuntimeErrorMsg(
|
throw makeRuntimeErrorMsg(
|
||||||
funcName,
|
funcName,
|
||||||
@ -462,7 +462,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
throw makeRuntimeErrorMsg(funcName, `Could not find port: ${port}. This is a bug. Report to dev.`);
|
throw makeRuntimeErrorMsg(funcName, `Could not find port: ${port}. This is a bug. Report to dev.`);
|
||||||
}
|
}
|
||||||
return iport;
|
return iport;
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const gang = NetscriptGang(Player, workerScript, helper);
|
const gang = NetscriptGang(Player, workerScript, helper);
|
||||||
@ -833,18 +833,18 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
workerScript.log("nuke", () => "Cannot be executed on this server.");
|
workerScript.log("nuke", () => "Cannot be executed on this server.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (server.hasAdminRights) {
|
||||||
|
workerScript.log("nuke", () => `Already have root access to '${server.hostname}'.`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!Player.hasProgram(Programs.NukeProgram.name)) {
|
if (!Player.hasProgram(Programs.NukeProgram.name)) {
|
||||||
throw makeRuntimeErrorMsg("nuke", "You do not have the NUKE.exe virus!");
|
throw makeRuntimeErrorMsg("nuke", "You do not have the NUKE.exe virus!");
|
||||||
}
|
}
|
||||||
if (server.openPortCount < server.numOpenPortsRequired) {
|
if (server.openPortCount < server.numOpenPortsRequired) {
|
||||||
throw makeRuntimeErrorMsg("nuke", "Not enough ports opened to use NUKE.exe virus.");
|
throw makeRuntimeErrorMsg("nuke", "Not enough ports opened to use NUKE.exe virus.");
|
||||||
}
|
}
|
||||||
if (server.hasAdminRights) {
|
server.hasAdminRights = true;
|
||||||
workerScript.log("nuke", () => `Already have root access to '${server.hostname}'.`);
|
workerScript.log("nuke", () => `Executed NUKE.exe virus on '${server.hostname}' to gain root access.`);
|
||||||
} else {
|
|
||||||
server.hasAdminRights = true;
|
|
||||||
workerScript.log("nuke", () => `Executed NUKE.exe virus on '${server.hostname}' to gain root access.`);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
brutessh: function (hostname: any): boolean {
|
brutessh: function (hostname: any): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user