mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23:49 +01:00
Ensure focus does not change between calls to work
This commit is contained in:
parent
ad57f3dc73
commit
07d449afc2
@ -829,6 +829,8 @@ export function NetscriptSingularity(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wasWorking = player.isWorking;
|
||||||
|
const wasFocused = player.focus;
|
||||||
if (player.isWorking) {
|
if (player.isWorking) {
|
||||||
const txt = player.singularityStopWork();
|
const txt = player.singularityStopWork();
|
||||||
workerScript.log("workForCompany", () => txt);
|
workerScript.log("workForCompany", () => txt);
|
||||||
@ -839,7 +841,11 @@ export function NetscriptSingularity(
|
|||||||
} else {
|
} else {
|
||||||
player.startWork(companyName);
|
player.startWork(companyName);
|
||||||
}
|
}
|
||||||
player.stopFocusing();
|
|
||||||
|
if (!wasWorking || (wasWorking && !wasFocused))
|
||||||
|
player.stopFocusing();
|
||||||
|
else if (wasWorking && wasFocused)
|
||||||
|
player.startFocusing();
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"workForCompany",
|
"workForCompany",
|
||||||
() => `Began working at '${player.companyName}' as a '${companyPositionName}'`,
|
() => `Began working at '${player.companyName}' as a '${companyPositionName}'`,
|
||||||
@ -979,6 +985,8 @@ export function NetscriptSingularity(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wasWorking = player.isWorking;
|
||||||
|
const wasFocused = player.focus;
|
||||||
if (player.isWorking) {
|
if (player.isWorking) {
|
||||||
const txt = player.singularityStopWork();
|
const txt = player.singularityStopWork();
|
||||||
workerScript.log("workForFaction", () => txt);
|
workerScript.log("workForFaction", () => txt);
|
||||||
@ -1077,7 +1085,10 @@ export function NetscriptSingularity(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startFactionHackWork(fac);
|
player.startFactionHackWork(fac);
|
||||||
player.stopFocusing();
|
if (!wasWorking || (wasWorking && !wasFocused))
|
||||||
|
player.stopFocusing();
|
||||||
|
else if (wasWorking && wasFocused)
|
||||||
|
player.startFocusing();
|
||||||
workerScript.log("workForFaction", () => `Started carrying out hacking contracts for '${fac.name}'`);
|
workerScript.log("workForFaction", () => `Started carrying out hacking contracts for '${fac.name}'`);
|
||||||
return true;
|
return true;
|
||||||
case "field":
|
case "field":
|
||||||
@ -1088,7 +1099,10 @@ export function NetscriptSingularity(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startFactionFieldWork(fac);
|
player.startFactionFieldWork(fac);
|
||||||
player.stopFocusing();
|
if (!wasWorking || (wasWorking && !wasFocused))
|
||||||
|
player.stopFocusing();
|
||||||
|
else if (wasWorking && wasFocused)
|
||||||
|
player.startFocusing();
|
||||||
workerScript.log("workForFaction", () => `Started carrying out field missions for '${fac.name}'`);
|
workerScript.log("workForFaction", () => `Started carrying out field missions for '${fac.name}'`);
|
||||||
return true;
|
return true;
|
||||||
case "security":
|
case "security":
|
||||||
@ -1099,7 +1113,10 @@ export function NetscriptSingularity(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startFactionSecurityWork(fac);
|
player.startFactionSecurityWork(fac);
|
||||||
player.stopFocusing();
|
if (!wasWorking || (wasWorking && !wasFocused))
|
||||||
|
player.stopFocusing();
|
||||||
|
else if (wasWorking && wasFocused)
|
||||||
|
player.startFocusing();
|
||||||
workerScript.log("workForFaction", () => `Started carrying out security work for '${fac.name}'`);
|
workerScript.log("workForFaction", () => `Started carrying out security work for '${fac.name}'`);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user