Skip to content

Commit

Permalink
#390 Fix working for company interrupting grafting
Browse files Browse the repository at this point in the history
  • Loading branch information
alainbryden committed Nov 29, 2024
1 parent 1aa71e8 commit d03abf2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion work-for-factions.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ export async function workForSingleFaction(ns, factionName, forceUnlockDonations
let factionJob = currentWork.factionWorkType;
// Detect if faction work was interrupted and log a warning
if (workAssigned && currentWork.factionName != factionName) {
if (await isValidInterruption(ns, currentWork)) return;
if (await isValidInterruption(ns, currentWork)) return false;
log(ns, `Work for faction ${factionName} was interrupted (Now: ${JSON.stringify(currentWork)}). Restarting...`, false, 'warning');
workAssigned = false;
if (!options['no-tail-windows']) tail(ns); // Force a tail window open to help the user kill this script if they accidentally closed the tail window and don't want to keep working
Expand Down Expand Up @@ -1244,6 +1244,7 @@ export async function workForMegacorpFactionInvite(ns, factionName, waitForInvit
// If not studying, ensure we are working for this company
if (!isStudying && (!isWorking || currentWork.companyName != companyName)) {
if (isWorking) { // Log a warning if we discovered that work we previously began was disrupted
if (await isValidInterruption(ns, currentWork)) return false;
log(ns, `Work for company ${companyName} was interrupted (Now: ${JSON.stringify(currentWork)}). Restarting...`, false, 'warning');
isWorking = false;
if (!options['no-tail-windows']) tail(ns); // Force a tail window open to help the user kill this script if they accidentally closed the tail window and don't want to keep working
Expand Down

0 comments on commit d03abf2

Please sign in to comment.