_internal.classes.focus._manager.FocusManager - vladzaharia/bitburner GitHub Wiki
_internal/classes/focus/_manager.FocusManager
Manages IFocusable objects, executing based on priority.
implements IFocusable
- canFocus
- clearFocus
- decrementFocusTime
- focus
- getCheckInterval
- getDetailText
- getFocusTime
- getPriority
- isWorking
- register
- shouldContinueRunning
- shouldRunInBackground
• new FocusManager(ns)
Creates a new manager capable of handling multiple IFocusables.
| Name | Type | Description |
|---|---|---|
ns |
NS |
The Netscript object |
_internal/classes/focus/_manager.ts:32
• Private _currentFocusable: undefined | IFocusable
Currently executing focusable.
_internal/classes/focus/_manager.ts:21
• Private _ns: NS
The Netscript object.
_internal/classes/focus/_manager.ts:15
• Private _registered: IFocusable[] = []
All registered focus actions.
_internal/classes/focus/_manager.ts:18
• Private _sleepTime: undefined | number
Sleep time left.
_internal/classes/focus/_manager.ts:24
• name: string = "Manager"
The name of the focusable.
_internal/classes/focus/_manager.ts:12
▸ canFocus(): boolean
Returns whether any registered focus actions are executable.
boolean
True if any registered actions are available, false otherwise.
_internal/classes/focus/_manager.ts:48
▸ clearFocus(): void
Clear current focus.
void
_internal/classes/focus/_manager.ts:99
▸ decrementFocusTime(decrement?): number
Decrement focus time and return the new value.
| Name | Type |
|---|---|
decrement |
number |
number
New focus time after decrementing.
_internal/classes/focus/_manager.ts:128
▸ focus(): number
Executes focus() on highest priority item which canFocus().
number
Whether the focus action was successful.
_internal/classes/focus/_manager.ts:57
▸ getCheckInterval(): number
Gets the check interval from the focusable, defaults to DEFAULT_CHECK_INTERVAL
number
Amount of time to wait in between soft-sleep checks.
_internal/classes/focus/_manager.ts:119
▸ getDetailText(): string
Not applicable to the FocusManager.
string
_internal/classes/focus/_manager.ts:145
▸ getFocusTime(): number
Gets the focus time left, can be decremented using decrementFocusTime.
number
Time left to focus.
_internal/classes/focus/_manager.ts:110
▸ getPriority(): number
Not applicable to the FocusManager.
number
_internal/classes/focus/_manager.ts:152
▸ isWorking(): boolean
Check whether the player is focusing on something.
boolean
Whether the player is focusing on something.
_internal/classes/focus/_manager.ts:92
▸ register(focusable): void
Registers a new IFocusable with this manager.
| Name | Type |
|---|---|
focusable |
IFocusable |
void
_internal/classes/focus/_manager.ts:39
▸ shouldContinueRunning(): boolean
Check if current focusable needs to continue running.
boolean
True if it should continue, false otherwise.
IFocusable.shouldContinueRunning
_internal/classes/focus/_manager.ts:138
▸ shouldRunInBackground(): boolean
Not applicable to the FocusManager.
boolean