Properties

players: Classes.Player[] = []

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.

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

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. The order of PromiseSettledResults is guaranteed to match the order of the players property of the Game.

    Parameters

    • gameid: number[]

      An array of game IDs to spectate.

    Returns Promise<PromiseSettledResult<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. The order of PromiseSettledResults is guaranteed to match the order of the input array.

    Parameters

    • targets: "all"

      The string "all" to spectate all players.

    Returns Promise<PromiseSettledResult<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. The order of PromiseSettledResults is guaranteed to match the order of the input array.

    Parameters

    • userid: String[]

      An array of user IDs to spectate.

    Returns Promise<PromiseSettledResult<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 boolean[]

    An array representing whether or not each unspectate was successful

    // 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 boolean[]

    An array representing whether or not each unspectate was successful

    // 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 boolean[]

    An array representing whether or not each unspectate was successful

    // 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