mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Add return value and code style cleanup
This commit is contained in:
parent
cd4c98d942
commit
d59601f848
@ -82,7 +82,7 @@ function MainPage({ faction, rerender, onAugmentations }: IMainProps): React.Rea
|
|||||||
setGangOpen(true);
|
setGangOpen(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startWork() {
|
function startWork(): void {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
router.toWork();
|
router.toWork();
|
||||||
}
|
}
|
||||||
|
@ -627,7 +627,7 @@ export function NetscriptSingularity(
|
|||||||
helper.checkSingularityAccess("isFocused", 2);
|
helper.checkSingularityAccess("isFocused", 2);
|
||||||
return player.focus;
|
return player.focus;
|
||||||
},
|
},
|
||||||
setFocus: function(focus: boolean): any {
|
setFocus: function(focus: boolean): boolean {
|
||||||
helper.updateDynamicRam("setFocus", getRamCost("setFocus"));
|
helper.updateDynamicRam("setFocus", getRamCost("setFocus"));
|
||||||
helper.checkSingularityAccess("setFocus", 2);
|
helper.checkSingularityAccess("setFocus", 2);
|
||||||
if (!player.isWorking) {
|
if (!player.isWorking) {
|
||||||
@ -636,13 +636,16 @@ export function NetscriptSingularity(
|
|||||||
if (!(player.workType == CONSTANTS.WorkTypeFaction || player.workType == CONSTANTS.WorkTypeCompany || player.workType == CONSTANTS.WorkTypeCompanyPartTime)) {
|
if (!(player.workType == CONSTANTS.WorkTypeFaction || player.workType == CONSTANTS.WorkTypeCompany || player.workType == CONSTANTS.WorkTypeCompanyPartTime)) {
|
||||||
throw helper.makeRuntimeErrorMsg("setFocus", "Cannot change focus for current job");
|
throw helper.makeRuntimeErrorMsg("setFocus", "Cannot change focus for current job");
|
||||||
}
|
}
|
||||||
if (!player.focus && focus === true) {
|
if (!player.focus && focus) {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
} else if (player.focus && focus === false) {
|
return true;
|
||||||
|
} else if (player.focus && !focus) {
|
||||||
player.stopFocusing();
|
player.stopFocusing();
|
||||||
Router.toTerminal();
|
Router.toTerminal();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
getStats: function (): any {
|
getStats: function (): any {
|
||||||
helper.updateDynamicRam("getStats", getRamCost("getStats"));
|
helper.updateDynamicRam("getStats", getRamCost("getStats"));
|
||||||
|
3
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
3
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -2001,8 +2001,9 @@ export interface Singularity {
|
|||||||
* @remarks
|
* @remarks
|
||||||
* RAM cost: 0.1 GB
|
* RAM cost: 0.1 GB
|
||||||
*
|
*
|
||||||
|
* @returns True if the focus was changed.
|
||||||
*/
|
*/
|
||||||
setFocus(focus: boolean): void;
|
setFocus(focus: boolean): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user