diff --git a/src/Netscript/NetscriptHelpers.ts b/src/Netscript/NetscriptHelpers.ts index 909c2d60d..2b45ce1d9 100644 --- a/src/Netscript/NetscriptHelpers.ts +++ b/src/Netscript/NetscriptHelpers.ts @@ -686,9 +686,9 @@ function createPublicRunningScript(runningScript: RunningScript): IRunningScript * @param {string} callingFn - Name of calling function. For logging purposes * @returns {boolean} True if the server is a Hacknet Server, false otherwise */ -function failOnHacknetServer(ctx: NetscriptContext, server: BaseServer, callingFn = ""): boolean { +function failOnHacknetServer(ctx: NetscriptContext, server: BaseServer): boolean { if (server instanceof HacknetServer) { - ctx.workerScript.log(callingFn, () => `Does not work on Hacknet Servers`); + log(ctx, () => `Does not work on Hacknet Servers`); return true; } else { return false; diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 51a54c3c0..fa22e8fef 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1110,7 +1110,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 0; } - if (helpers.failOnHacknetServer(ctx, server, "getServerMoneyAvailable")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 0; } if (server.hostname == "home") { @@ -1130,7 +1130,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 1; } - if (helpers.failOnHacknetServer(ctx, server, "getServerSecurityLevel")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 1; } helpers.log( @@ -1149,7 +1149,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 1; } - if (helpers.failOnHacknetServer(ctx, server, "getServerBaseSecurityLevel")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 1; } helpers.log( @@ -1167,7 +1167,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 1; } - if (helpers.failOnHacknetServer(ctx, server, "getServerMinSecurityLevel")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 1; } helpers.log( @@ -1185,7 +1185,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 1; } - if (helpers.failOnHacknetServer(ctx, server, "getServerRequiredHackingLevel")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 1; } helpers.log( @@ -1203,7 +1203,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 0; } - if (helpers.failOnHacknetServer(ctx, server, "getServerMaxMoney")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 0; } helpers.log(ctx, () => `returned ${numeralWrapper.formatMoney(server.moneyMax)} for '${server.hostname}'`); @@ -1218,7 +1218,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 1; } - if (helpers.failOnHacknetServer(ctx, server, "getServerGrowth")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 1; } helpers.log(ctx, () => `returned ${server.serverGrowth} for '${server.hostname}'`); @@ -1233,7 +1233,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "Cannot be executed on this server."); return 5; } - if (helpers.failOnHacknetServer(ctx, server, "getServerNumPortsRequired")) { + if (helpers.failOnHacknetServer(ctx, server)) { return 5; } helpers.log(ctx, () => `returned ${server.numOpenPortsRequired} for '${server.hostname}'`); @@ -1679,7 +1679,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "invalid for this kind of server"); return Infinity; } - if (helpers.failOnHacknetServer(ctx, server, "getHackTime")) { + if (helpers.failOnHacknetServer(ctx, server)) { return Infinity; } @@ -1694,7 +1694,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "invalid for this kind of server"); return Infinity; } - if (helpers.failOnHacknetServer(ctx, server, "getGrowTime")) { + if (helpers.failOnHacknetServer(ctx, server)) { return Infinity; } @@ -1709,7 +1709,7 @@ const base: InternalAPI = { helpers.log(ctx, () => "invalid for this kind of server"); return Infinity; } - if (helpers.failOnHacknetServer(ctx, server, "getWeakenTime")) { + if (helpers.failOnHacknetServer(ctx, server)) { return Infinity; }