Properties

players: {
    engine: Engine;
    gameid: number;
    name: string;
    queue: Frame[];
    spectating: boolean;
    userid: string;
}[] = []

Data on all players in game, including the client. Note that the client's engine data is only the data acknowledged by the server, not the most recent gameplay information.

Type declaration

  • engine: Engine
  • gameid: number
  • name: string
  • queue: Frame[]

    Queue of unprocessed replay frames for this player. Do not modify.

  • spectating: boolean

    Whether the player is currently receiving replay frames (actively spectated)

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

The raw game config for all players, (possibly) including the client's own game config

self?: Self

The client's own game handler

fps: number = 60

The Frames Per Second of the TETR.IO engine

Accessors

  • get opponents(): {
        engine: Engine;
        gameid: number;
        name: string;
        queue: Frame[];
        spectating: boolean;
        userid: string;
    }[]
  • Returns {
        engine: Engine;
        gameid: number;
        name: string;
        queue: Frame[];
        spectating: boolean;
        userid: string;
    }[]

Methods

  • Internal

    Kill the game. This is called automatically by the Room class when a game ends/is aborted, you don't need to use this.

    Returns undefined

  • Spectate one or more players by their game ID or user ID, or spectate all players in the game.

    Parameters

    • gameid: number[]

      An array of game IDs to spectate.

    Returns void

    // Spectate a player by game ID
    client.game!.spectate([12344]);
  • Spectate one or more players by their game ID or user ID, or spectate all players in the game.

    Parameters

    • targets: "all"

      The string "all" to spectate all players.

    Returns void

    // Spectate all players in the game
    client.game!.spectate("all");
  • Spectate one or more players by their game ID or user ID, or spectate all players in the game.

    Parameters

    • userid: String[]

      An array of user IDs to spectate.

    Returns void

    // Spectate a player by user ID
    client.game!.spectate(["646f633d276f42a80ba44304"]);
  • Stop spectating one or more players by their game ID or user ID, or stop spectating all players in the game.

    Parameters

    • gameid: number[]

      An array of game IDs to stop spectating.

    Returns void

    // Stop spectating a player by game ID
    client.game!.unspectate([12344]);
  • Stop spectating one or more players by their game ID or user ID, or stop spectating all players in the game.

    Parameters

    • userid: "all"

      The string "all" to stop spectating all players.

    Returns void

    // Stop spectating all players in the game
    client.game!.unspectate("all");
  • Stop spectating one or more players by their game ID or user ID, or stop spectating all players in the game.

    Parameters

    • userid: String[]

      An array of user IDs to stop spectating.

    Returns void

    // Stop spectating a player by user ID
    client.game!.unspectate(["646f633d276f42a80ba44304"]);
  • Internal

    Parameters

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

    Returns Engine

  • Internal

    For internal use only.

    Parameters

    • msg: string
    • __namedParameters: {
          level: "error" | "info" | "warning";
      } = ...
      • level: "error" | "info" | "warning"

    Returns void