bitburner-official / bitburner-src

Bitburner source code.
Other
838 stars 273 forks source link

MISC: Always add script's earnings to its parent #1754

Closed catloversg closed 3 weeks ago

catloversg commented 3 weeks ago

Currently, we only add the script's earnings to its parent script if the script quits "gracefully". This PR changes that behavior. Now we always do that.

MRE: hack.js

/** @param {NS} ns */
export async function main(ns) {
  await ns.hack("n00dles");
  throw new Error("error");
}

test.js

/** @param {NS} ns */
export async function main(ns) {
  ns.tail();
  while (true) {
    ns.exec("hack.js", "home");
    await ns.sleep(1000);
  }
}