Constructors

  • Parameters

    • client: Client
    • players: {
          alive: boolean;
          gameid: number;
          naturalorder: number;
          options: ReadyOptions;
          userid: string;
      }[]

    Returns Self

Properties

The BotWrapper in use. When a BotWrapper is set, tick will not be called.

canTarget: boolean = true

Whether or not targeting is allowed (changed by server). Setting target while this is false will throw an error.

enemies: number[] = []

The gameids of the users targeting the client

engine: Engine

The client's engine

gameid: number

The client's gameid set by the server

keyQueue: Types.Game.Tick.Keypress[] = []

The keys the client has queued to press (allows for pressing keys in the future)

lastIGEFlush: number = ...

The last time IGEs were flushed

options: ReadyOptions

The raw game config sent by TETR.IO

serverTargets: number[] = []

The targets set by the server

startTime: null | number = null

The performance.now() timestamp when the gameplay started

tick?: Func

The tick function called every game tick

maxIGETimeout: number = 30000

The maximum amount of time before all IGEs are force-flushed

Accessors

  • get forcePauseIGEs(): boolean
  • Force stops the processing of all IGEs (garbage, etc). If left true for too long (~30s), IGEs will be automatically flushed to avoid a forced disconnect. Use sparingly.

    Returns boolean

  • set forcePauseIGEs(value): void
  • Parameters

    • value: boolean

    Returns void

  • get igesPaused(): boolean
  • Whether or not the Game is currently allowed to process IGEs.

    Returns boolean

  • get pauseIGEs(): boolean
  • Pauses accepting IGEs (garbage events) when the keyQueue has items, when pauseIGEs is set to true.

    Returns boolean

  • set pauseIGEs(value): void
  • Parameters

    • value: boolean

    Returns void

  • get target(): Types.Game.Target
  • The current targeting strategy. Setting a targeting strategy throws error if targeting is not allowed.

    Returns Types.Game.Target

  • set target(t): void
  • Parameters

    Returns void

Methods

  • Internal

    Stops the client's gameplay, when it dies. Does not destroy the game. You don't need to call this manually.

    Returns void

  • Initialize the client's game. You don't need to call this manually.

    Returns void