mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-27 00:17:32 +01:00
fix static ram calc
This commit is contained in:
parent
9f14f2b863
commit
49d807c9a9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -163,22 +163,9 @@ async function parseOnlyRamCalculate(
|
||||
// If it is, then we need to get its RAM cost.
|
||||
try {
|
||||
function applyFuncRam(func: any): number {
|
||||
if (typeof func === "function") {
|
||||
try {
|
||||
let res;
|
||||
if (func.constructor.name === "AsyncFunction") {
|
||||
res = 0; // Async functions will always be 0 RAM
|
||||
} else {
|
||||
res = func.apply(null, []);
|
||||
}
|
||||
if (typeof res === "number") {
|
||||
return res;
|
||||
}
|
||||
return 0;
|
||||
} catch (e) {
|
||||
console.error(`Error applying function: ${e}`);
|
||||
return 0;
|
||||
}
|
||||
console.log(func);
|
||||
if (typeof func === "number") {
|
||||
return func;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user