fix disableLog not disabling blade functions

This commit is contained in:
Olivier Gagnon 2021-10-11 13:31:12 -04:00
parent 3fd26bea9b
commit 3d36982a56
3 changed files with 6 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -4610,19 +4610,19 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
...extra,
};
function getFunctionNames(obj: NS): string[] {
function getFunctionNames(obj: NS, prefix: string): string[] {
const functionNames: string[] = [];
for (const [key, value] of Object.entries(obj)) {
if (typeof value == "function") {
functionNames.push(key);
functionNames.push(prefix + key);
} else if (typeof value == "object") {
functionNames.push(...getFunctionNames(value));
functionNames.push(...getFunctionNames(value, key + "."));
}
}
return functionNames;
}
const possibleLogs = Object.fromEntries([...getFunctionNames(functions)].map((a) => [a, true]));
const possibleLogs = Object.fromEntries([...getFunctionNames(functions, "")].map((a) => [a, true]));
return functions;
} // End NetscriptFunction()