mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23:49 +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 {
|
setFocus: function(focus: boolean): any {
|
||||||
helper.updateDynamicRam("setFocus", getRamCost("setFocus"));
|
helper.updateDynamicRam("setFocus", getRamCost("setFocus"));
|
||||||
helper.checkSingularityAccess("setFocus", 1);
|
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();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
} else if (focus === false) {
|
} else if (player.focus && focus === false) {
|
||||||
player.stopFocusing();
|
player.stopFocusing();
|
||||||
|
Router.toTerminal();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getStats: function (): any {
|
getStats: function (): any {
|
||||||
|
Loading…
Reference in New Issue
Block a user