Options
All
  • Public
  • Public/Protected
  • All
Menu

Manages IFocusable objects, executing based on priority.

implements

IFocusable

Hierarchy

  • FocusManager

Implements

Index

Constructors

  • Creates a new manager capable of handling multiple IFocusables.

    Parameters

    • ns: NS

      The Netscript object

    Returns FocusManager

Properties

_currentFocusable: undefined | IFocusable

Currently executing focusable.

_ns: NS

The Netscript object.

_registered: IFocusable[] = []

All registered focus actions.

_sleepTime: undefined | number

Sleep time left.

name: string = "Manager"

The name of the focusable.

Methods

  • canFocus(): boolean
  • Returns whether any registered focus actions are executable.

    Returns boolean

    True if any registered actions are available, false otherwise.

  • clearFocus(): void
  • Clear current focus.

    Returns void

  • decrementFocusTime(decrement?: number): number
  • Decrement focus time and return the new value.

    Parameters

    • decrement: number = ...

    Returns number

    New focus time after decrementing.

  • focus(): number
  • Executes focus() on highest priority item which canFocus().

    Returns number

    Whether the focus action was successful.

  • getCheckInterval(): number
  • Gets the check interval from the focusable, defaults to DEFAULT_CHECK_INTERVAL

    Returns number

    Amount of time to wait in between soft-sleep checks.

  • getDetailText(): string
  • Not applicable to the FocusManager.

    Returns string

  • getFocusTime(): number
  • Gets the focus time left, can be decremented using decrementFocusTime.

    Returns number

    Time left to focus.

  • getPriority(): number
  • Not applicable to the FocusManager.

    Returns number

  • isWorking(): boolean
  • Check whether the player is focusing on something.

    Returns boolean

    Whether the player is focusing on something.

  • Registers a new IFocusable with this manager.

    Parameters

    Returns void

  • shouldContinueRunning(): boolean
  • Check if current focusable needs to continue running.

    Returns boolean

    True if it should continue, false otherwise.

  • shouldRunInBackground(): boolean

Generated using TypeDoc