mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +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.
|
// If it is, then we need to get its RAM cost.
|
||||||
try {
|
try {
|
||||||
function applyFuncRam(func: any): number {
|
function applyFuncRam(func: any): number {
|
||||||
if (typeof func === "function") {
|
console.log(func);
|
||||||
try {
|
if (typeof func === "number") {
|
||||||
let res;
|
return func;
|
||||||
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;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user