/// import { ArraySchema, MapSchema } from "@colyseus/schema"; import { Player } from "../player/player.js"; import { Entity } from "../traits/entity.js"; import { IdentityTrait } from "../traits/identity.js"; import { LabelTrait } from "../traits/label.js"; import { ParentTrait } from "../traits/parent.js"; import { PlayerViewPosition } from "../playerViewPosition.js"; import { GameClient } from "./client.js"; export declare class State = Record> extends Entity> { type: string; tableWidth: number; tableHeight: number; /** * Data of clients who are connected to the room. * A "client" is someone who just stopped by in this room * and not necessarily someone who is playing the game. * * Bots will also be reflected here, but not as direct references to them. * * Read-only. Writing to it may break things. */ clients: ArraySchema; /** * Games are turn-based by default. Each player takes their turns one by one. * Set this to `false` to allow simultaneous play. * Don't rely on `currentPlayer` value for non turn-based games. */ turnBased: boolean; /** * Current round number. Increased using `NextRound` command. */ round: number; /** * List of players - game participants, after the game starts. * * TODO: Make players have `idx` if you ever need them to change order mid-game */ players: ArraySchema; currentPlayerIdx: number; get currentPlayer(): Player; isGameStarted: boolean; isGameOver: boolean; /** * Describes which client-side UI component to reveal to which player. * KEY = uiElement, VALUE = clientID * * NOTE: It's a very simple example, for more advanced use (eg. UI element * visible for multiple certain players) feel free to * create your own ui handler in your State */ ui: MapSchema; /** * A construct describing how should player's "focused" items * be positioned in their view. Containers of other players * will not follow these rules. * Default is: center/bottom. */ playerViewPosition: PlayerViewPosition; /** * Current game's variant data. */ variantData: V; /** * ID of last known, registered Entity. */ private _lastID; /** * Map of every Entity in this state. */ private readonly _allEntities; constructor(); /** * Registers new entity to the game state. * @param entity * @private internal use only */ _registerEntity(entity: IdentityTrait): void; populateVariantData(variantDefaults: VariantsConfig["defaults"], variantData: V): void; } interface Mixin extends IdentityTrait, LabelTrait, ParentTrait { } export interface State extends Mixin { } export {};