mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-22 14:12:27 +01:00
Add errors and only change page when focus changes
This commit is contained in:
parent
07d449afc2
commit
2726420709
@ -630,11 +630,18 @@ export function NetscriptSingularity(
|
||||
setFocus: function(focus: boolean): any {
|
||||
helper.updateDynamicRam("setFocus", getRamCost("setFocus"));
|
||||
helper.checkSingularityAccess("setFocus", 1);
|
||||
if (focus === true) {
|
||||
if (!player.isWorking) {
|
||||
throw helper.makeRuntimeErrorMsg("setFocus", "Not currently working");
|
||||
}
|
||||
if (!(player.workType == CONSTANTS.WorkTypeFaction || player.workType == CONSTANTS.WorkTypeCompany || player.workType == CONSTANTS.WorkTypeCompanyPartTime)) {
|
||||
throw helper.makeRuntimeErrorMsg("setFocus", "Cannot change focus for current job");
|
||||
}
|
||||
if (!player.focus && focus === true) {
|
||||
player.startFocusing();
|
||||
Router.toWork();
|
||||
} else if (focus === false) {
|
||||
} else if (player.focus && focus === false) {
|
||||
player.stopFocusing();
|
||||
Router.toTerminal();
|
||||
}
|
||||
},
|
||||
getStats: function (): any {
|
||||
|
Loading…
Reference in New Issue
Block a user