Remove remaining shouldLog calls.

This commit is contained in:
Olivier Gagnon 2021-03-11 17:01:28 -05:00
parent e7dbc08e18
commit d4816ad0c4

@ -1107,12 +1107,10 @@ function NetscriptFunctions(workerScript) {
} }
if (res) { if (res) {
if (workerScript.shouldLog("kill")) { if (killByPid) {
if (killByPid) { workerScript.log("kill", `Killing script with PID ${filename}`);
workerScript.log("kill", `Killing script with PID ${filename}`); } else {
} else { workerScript.log("kill", `Killing '${filename}' on '${ip}' with args: ${arrayToString(scriptArgs)}.`);
workerScript.log("kill", `Killing ${filename} on ${ip} with args: ${arrayToString(scriptArgs)}.`);
}
} }
return true; return true;
} else { } else {
@ -1138,7 +1136,7 @@ function NetscriptFunctions(workerScript) {
killWorkerScript(server.runningScripts[i], server.ip, false); killWorkerScript(server.runningScripts[i], server.ip, false);
} }
WorkerScriptStartStopEventEmitter.emitEvent(); WorkerScriptStartStopEventEmitter.emitEvent();
workerScript.log("killall", `Killing all scripts on ${server.hostname}. May take a few minutes for the scripts to die.`); workerScript.log("killall", `Killing all scripts on '${server.hostname}'. May take a few minutes for the scripts to die.`);
return scriptsRunning; return scriptsRunning;
}, },
@ -1168,7 +1166,7 @@ function NetscriptFunctions(workerScript) {
// Invalid file type // Invalid file type
if (!isValidFilePath(scriptname)) { if (!isValidFilePath(scriptname)) {
throw makeRuntimeErrorMsg("scp", `Invalid filename: ${scriptname}`); throw makeRuntimeErrorMsg("scp", `Invalid filename: '${scriptname}'`);
} }
// Invalid file name // Invalid file name
@ -1455,10 +1453,10 @@ function NetscriptFunctions(workerScript) {
if (failOnHacknetServer(server, "getServerMoneyAvailable")) { return 0; } if (failOnHacknetServer(server, "getServerMoneyAvailable")) { return 0; }
if (server.hostname == "home") { if (server.hostname == "home") {
// Return player's money // Return player's money
workerScript.log("getServerMoneyAvailable", `returned player's money: $${formatNumber(Player.money.toNumber(), 2)}`); workerScript.log("getServerMoneyAvailable", `returned player's money: ${numeralWrapper.format(Player.money.toNumber(), '$0.000a')}`);
return Player.money.toNumber(); return Player.money.toNumber();
} }
workerScript.log("getServerMoneyAvailable", `returned ${formatNumber(server.moneyAvailable, 2)} for '${server.hostname}`); workerScript.log("getServerMoneyAvailable", `returned ${numeralWrapper.format(server.moneyAvailable, '$0.000a')} for '${server.hostname}`);
return server.moneyAvailable; return server.moneyAvailable;
}, },
getServerSecurityLevel: function(ip) { getServerSecurityLevel: function(ip) {
@ -1493,7 +1491,7 @@ function NetscriptFunctions(workerScript) {
updateDynamicRam("getServerMaxMoney", getRamCost("getServerMaxMoney")); updateDynamicRam("getServerMaxMoney", getRamCost("getServerMaxMoney"));
const server = safeGetServer(ip, "getServerMaxMoney"); const server = safeGetServer(ip, "getServerMaxMoney");
if (failOnHacknetServer(server, "getServerMaxMoney")) { return 0; } if (failOnHacknetServer(server, "getServerMaxMoney")) { return 0; }
workerScript.log("getServerMaxMoney", `returned ${formatNumber(server.moneyMax, 0)} for '${server.hostname}'`); workerScript.log("getServerMaxMoney", `returned ${numeralWrapper.format(server.moneyMax, '$0.000a')} for '${server.hostname}'`);
return server.moneyMax; return server.moneyMax;
}, },
getServerGrowth: function(ip) { getServerGrowth: function(ip) {
@ -1901,7 +1899,7 @@ function NetscriptFunctions(workerScript) {
} }
if (Player.money.lt(cost)) { if (Player.money.lt(cost)) {
workerScript.log("purchaseServer", `Not enough money to purchase server. Need $${formatNumber(cost, 2)}`); workerScript.log("purchaseServer", `Not enough money to purchase server. Need ${numeralWrapper.format(cost, '$0.000a')}`);
return ""; return "";
} }
var newServ = safetlyCreateUniqueServer({ var newServ = safetlyCreateUniqueServer({
@ -1920,7 +1918,7 @@ function NetscriptFunctions(workerScript) {
homeComputer.serversOnNetwork.push(newServ.ip); homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip); newServ.serversOnNetwork.push(homeComputer.ip);
Player.loseMoney(cost); Player.loseMoney(cost);
workerScript.log("purchaseServer", `Purchased new server with hostname '${newServ.hostname}' for $${formatNumber(cost, 2)}`); workerScript.log("purchaseServer", `Purchased new server with hostname '${newServ.hostname}' for ${numeralWrapper.format(cost, '$0.000a')}`);
return newServ.hostname; return newServ.hostname;
}, },
deleteServer: function(hostname) { deleteServer: function(hostname) {
@ -1954,7 +1952,7 @@ function NetscriptFunctions(workerScript) {
// Delete all scripts running on server // Delete all scripts running on server
if (server.runningScripts.length > 0) { if (server.runningScripts.length > 0) {
workerScript.log("deleteServer", `Cannot delete server ('${server.hostname}') because it still has scripts running.`); workerScript.log("deleteServer", `Cannot delete server '${server.hostname}' because it still has scripts running.`);
return false; return false;
} }
@ -3340,12 +3338,10 @@ function NetscriptFunctions(workerScript) {
updateDynamicRam("recruitMember", getRamCost("gang", "recruitMember")); updateDynamicRam("recruitMember", getRamCost("gang", "recruitMember"));
checkGangApiAccess("recruitMember"); checkGangApiAccess("recruitMember");
const recruited = Player.gang.recruitMember(name); const recruited = Player.gang.recruitMember(name);
if (workerScript.shouldLog("recruitMember")) { if (recruited) {
if (recruited) { workerScript.log("recruitMember", `Successfully recruited Gang Member '${name}'`);
workerScript.log("recruitMember", `Successfully recruited Gang Member '${name}'`); } else {
} else { workerScript.log("recruitMember", `Failed to recruit Gang Member '${name}'`);
workerScript.log("recruitMember", `Failed to recruit Gang Member '${name}'`);
}
} }
return recruited; return recruited;
@ -3362,12 +3358,10 @@ function NetscriptFunctions(workerScript) {
checkGangApiAccess("setMemberTask"); checkGangApiAccess("setMemberTask");
const member = getGangMember("setMemberTask", memberName); const member = getGangMember("setMemberTask", memberName);
const success = member.assignToTask(taskName); const success = member.assignToTask(taskName);
if (workerScript.shouldLog("setMemberTask")) { if (success) {
if (success) { workerScript.log("setMemberTask", `Successfully assigned Gang Member '${memberName}' to '${taskName}' task`);
workerScript.log("setMemberTask", `Successfully assigned Gang Member '${memberName}' to '${taskName}' task`); } else {
} else { workerScript.log("setMemberTask", `Failed to assign Gang Member '${memberName}' to '${taskName}' task. '${memberName}' is now Unassigned`);
workerScript.log("setMemberTask", `Failed to assign Gang Member '${memberName}' to '${taskName}' task. '${memberName}' is now Unassigned`);
}
} }
return success; return success;
@ -3409,12 +3403,10 @@ function NetscriptFunctions(workerScript) {
checkGangApiAccess("purchaseEquipment"); checkGangApiAccess("purchaseEquipment");
const member = getGangMember("purchaseEquipment", memberName); const member = getGangMember("purchaseEquipment", memberName);
const res = member.buyUpgrade(equipName, Player, Player.gang); const res = member.buyUpgrade(equipName, Player, Player.gang);
if (workerScript.shouldLog("purchaseEquipment")) { if (res) {
if (res) { workerScript.log("purchaseEquipment", `Purchased '${equipName}' for Gang member '${memberName}'`);
workerScript.log("purchaseEquipment", `Purchased '${equipName}' for Gang member '${memberName}'`); } else {
} else { workerScript.log("purchaseEquipment", `Failed to purchase '${equipName}' for Gang member '${memberName}'`);
workerScript.log("purchaseEquipment", `Failed to purchase '${equipName}' for Gang member '${memberName}'`);
}
} }
return res; return res;