_internal.classes.focus._tmpl.TemplateFocusable - vladzaharia/bitburner GitHub Wiki

Class: TemplateFocusable

_internal/classes/focus/_tmpl.TemplateFocusable

Focusable managing <>.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new TemplateFocusable(ns, priority?)

Creates a focuser that manages <>.

Parameters

Name Type Default value Description
ns NS undefined The Netscript object.
priority number Infinity Priority this focuser should run at, defaults to <>.

Overrides

BaseFocusable.constructor

Defined in

_internal/classes/focus/_tmpl.ts:18

Properties

_ns

Protected _ns: NS

The Netscript object.

Inherited from

BaseFocusable._ns

Defined in

_internal/classes/focus/_base.ts:21


name

name: string

The name of the focusable.

Inherited from

BaseFocusable.name

Defined in

_internal/classes/focus/_base.ts:18

Methods

_focus

Protected _focus(): boolean

Execute focus using ns.singularity, must be implemented by subclass.

Returns

boolean

Whether the focus action was successful.

Overrides

BaseFocusable._focus

Defined in

_internal/classes/focus/_tmpl.ts:30


canFocus

canFocus(): boolean

Returns

boolean

Overrides

BaseFocusable.canFocus

Defined in

_internal/classes/focus/_tmpl.ts:26


focus

focus(): number

Executes a focus action, returning a predefined sleep time.

Returns

number

_sleepTime if successful, -1 otherwise.

Inherited from

BaseFocusable.focus

Defined in

_internal/classes/focus/_base.ts:76


getCheckInterval

getCheckInterval(): number

Gets how often to check for task completion, defaults to this._checkInterval.

Returns

number

How often to check for task completion.

Inherited from

BaseFocusable.getCheckInterval

Defined in

_internal/classes/focus/_base.ts:118


getDetailText

getDetailText(): string

Returns value from preset field.

Returns

string

Value of this._detailField if set, "" otherwise

Inherited from

BaseFocusable.getDetailText

Defined in

_internal/classes/focus/_base.ts:137


getFocusTime

getFocusTime(): number

Get time needed for task, defaults to this._sleepTime.

Returns

number

The time to sleep before running the manager again.

Overrides

BaseFocusable.getFocusTime

Defined in

_internal/classes/focus/_tmpl.ts:38


getPriority

getPriority(): number

Gets the current priority of the focusable action.

Returns

number

Current priority, with 0 being the highest.

Overrides

BaseFocusable.getPriority

Defined in

_internal/classes/focus/_tmpl.ts:22


shouldContinueRunning

shouldContinueRunning(): boolean

Checks if the player is still working.

virtual Can be overridden, but run super.shouldContinueRunning if you do.

Returns

boolean

True if user is still working, false otherwise.

Inherited from

BaseFocusable.shouldContinueRunning

Defined in

_internal/classes/focus/_base.ts:128


shouldRunInBackground

shouldRunInBackground(): boolean

Checks if the action should run in the background, defaults to if priority is > 50.

Returns

boolean

True if this can run in the background, False if it needs to be in the foreground.

Overrides

BaseFocusable.shouldRunInBackground

Defined in

_internal/classes/focus/_tmpl.ts:34

⚠️ **GitHub.com Fallback** ⚠️