mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-03 20:07:34 +01:00
commit
3414eb8306
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -36,9 +36,9 @@ export function NetscriptExtra(player: IPlayer, workerScript: WorkerScript): INe
|
||||
real_document.completely_unused_field = undefined;
|
||||
},
|
||||
alterReality: function (): void {
|
||||
// eval so the code doesn't get optimized away.
|
||||
const x = eval("false");
|
||||
console.warn("I am sure that this variable is false.");
|
||||
// add Math.random so webpack doesn't optimise the if away
|
||||
if (x !== false) {
|
||||
console.warn("Reality has been altered!");
|
||||
player.giveExploit(Exploit.RealityAlteration);
|
||||
|
@ -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