_internal.classes.focus._base.BaseFocusable - vladzaharia/bitburner GitHub Wiki
_internal/classes/focus/_base.BaseFocusable
Abstract class handling priority and sleep returns.
abstract
implements IFocusable
-
BaseFocusable
- _focus
- canFocus
- focus
- getCheckInterval
- getDetailText
- getFocusTime
- getPriority
- shouldContinueRunning
- shouldRunInBackground
• new BaseFocusable(name, ns, priority, detailField?, sleepTime?, checkInterval?)
Creates a new focusable action.
| Name | Type | Default value | Description |
|---|---|---|---|
name |
string |
undefined |
The name of this focusable. |
ns |
NS |
undefined |
The Netscript object. |
priority |
number |
undefined |
Priority this action should run at, lower first. |
detailField? |
string |
undefined |
- |
sleepTime |
number |
DEFAULT_SLEEP_TIME |
Time to sleep after a successful focus event, defaults to 15 minutes. |
checkInterval |
number |
DEFAULT_CHECK_INTERVAL |
- |
_internal/classes/focus/_base.ts:44
• Private _checkInterval: number
Interval to check while sleeping.
_internal/classes/focus/_base.ts:30
• Private _detailField: undefined | string
Field to pull detail from.
_internal/classes/focus/_base.ts:33
• Protected _ns: NS
The Netscript object.
_internal/classes/focus/_base.ts:21
• Private _priority: number
Priority of this focusable.
_internal/classes/focus/_base.ts:24
• Private _sleepTime: number
Time to sleep after a successful focus event.
_internal/classes/focus/_base.ts:27
• name: string
The name of the focusable.
_internal/classes/focus/_base.ts:18
▸ Protected _focus(): boolean
Execute focus using ns.singularity, must be implemented by subclass.
virtual Must be overridden by implementing classes.
boolean
Whether the focus action was successful.
_internal/classes/focus/_base.ts:151
▸ canFocus(): boolean
virtual Must be overridden by implementing classes.
boolean
_internal/classes/focus/_base.ts:67
▸ focus(): number
Executes a focus action, returning a predefined sleep time.
number
_sleepTime if successful, -1 otherwise.
_internal/classes/focus/_base.ts:76
▸ getCheckInterval(): number
Gets how often to check for task completion, defaults to this._checkInterval.
number
How often to check for task completion.
_internal/classes/focus/_base.ts:118
▸ getDetailText(): string
Returns value from preset field.
string
Value of this._detailField if set, "" otherwise
_internal/classes/focus/_base.ts:137
▸ getFocusTime(): number
Get time needed for task, defaults to this._sleepTime.
number
The time to sleep before running the manager again.
_internal/classes/focus/_base.ts:109
▸ getPriority(): number
Gets the current priority of the focusable action.
number
Current priority, with 0 being the highest.
_internal/classes/focus/_base.ts:60
▸ shouldContinueRunning(): boolean
Checks if the player is still working.
virtual Can be overridden, but run super.shouldContinueRunning if you do.
boolean
True if user is still working, false otherwise.
IFocusable.shouldContinueRunning
_internal/classes/focus/_base.ts:128
▸ shouldRunInBackground(): boolean
Checks if the action should run in the background, defaults to if priority is > 50.
boolean
True if this can run in the background, False if it needs to be in the foreground.