Options
All
  • Public
  • Public/Protected
  • All
Menu

Focusable managing the creation of new programs.

Hierarchy

Index

Constructors

  • Creates a focuser that manages program creation.

    Parameters

    • ns: NS

      The Netscript object.

    • priority: number = LOW_PRIORITY

      Priority this focuser should run at, defaults to 1.

    Returns ProgramFocusable

Properties

_currentProgram: undefined | Programs

Current program being worked on.

_focusTime: undefined | number

Internal focus store.

_ns: NS

The Netscript object.

name: string

The name of the focusable.

Methods

  • Check if a program can be created. Returns true if:

    • Program doesn't exist on disk
    • Program's hacking level is below our current level
    • If port opener, can't currently be bought on the darkweb

    Parameters

    Returns boolean

    Whether the program exists on disk.

  • _focus(): boolean
  • Create first available program.

    Returns boolean

    Time to sleep if a program was executed, false otherwise.

  • canFocus(): boolean
  • Checks whether any program is creatable.

    Returns boolean

    Whether we can currently create any program.

  • focus(): number
  • Executes a focus action, returning a predefined sleep time.

    Returns number

    _sleepTime if successful, -1 otherwise.

  • getCheckInterval(): number
  • Gets how often to check for task completion, defaults to this._checkInterval.

    Returns number

    How often to check for task completion.

  • getDetailText(): string
  • Returns value from preset field.

    Returns string

    Value of this._detailField if set, "" otherwise

  • getFocusTime(): number
  • Get time to focus, if set by program.

    Returns number

    Time to focus, set by program or default.

  • getPriority(): number
  • Returns default priority if openers can be created, Infinity otherwise.

    Returns number

    The priority of the action.

  • 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.

  • 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.

Generated using TypeDoc