mooball
    Preparing search index...

    Interface RoomBase

    interface RoomBase {
        addAuthBan(...auths: string[]): (number | null)[];
        addIpBan(...ips: (string | IPv4Range | IPv6Range)[]): (number | null)[];
        addLibrary(libraryObj: Library): void;
        addPlayerBan(playerId: number): number | null;
        addPlugin(pluginObj: Plugin): void;
        autoTeams(): void;
        banList: BanEntry[];
        blueScore: number | null;
        changeTeam(teamId: number): void;
        clearBan(id: number): void;
        clearBans(): void;
        clearEvents(): void;
        config: RoomConfig;
        currentFrameNo: number;
        currentPlayer: Player;
        currentPlayerId: number;
        debugDesync:
            | true
            | ((hostRoomState: RoomState, clientRoomState: RoomState) => void)
            | null;
        executeEvent(event: MooballEvent, byId: number): void;
        executeEventWithTarget(event: MooballEvent, targetId: number): void;
        extrapolate(milliseconds: number, ignoreMultipleCalls: boolean): RoomState;
        fakePassword: boolean | null;
        fixedPlayerCount: number | null;
        gameState: GameState | null;
        gameStateExt: GameState | null;
        geo: { flag: number; lat: number; lon: number };
        getBall(extrapolated?: boolean): Disc;
        getDisc(discId: number, extrapolated?: boolean): Disc;
        getDiscs(extrapolated?: boolean): Disc[];
        getKeyState(): number;
        getPlayer(id: number): Player;
        getPlayerDisc(playerId: number, extrapolated?: boolean): Disc;
        getPlayerDisc_exp(playerId: number): Disc;
        gui: Gui;
        hideIdentity: boolean;
        isGamePaused(): boolean;
        isHost: boolean;
        isRecording(): boolean;
        kickPlayer(
            playerId: number,
            reason: string | null,
            isBanning: boolean,
        ): void;
        leave(): void;
        libraries: Library[];
        librariesMap: object;
        link: string;
        lockTeams(): void;
        maxPlayerCount: number;
        mixConfig(roomConfig: RoomConfig): void;
        moveLibrary(libraryIndex: number, newIndex: number): void;
        movePlugin(pluginIndex: number, newIndex: number): void;
        name: string;
        password: string;
        pauseGame(): void;
        players: Player[];
        plugins: Plugin[];
        pluginsMap: object;
        randTeams(): void;
        redScore: number | null;
        removeBan(id: number): boolean;
        removeLibrary(libraryObj: Library): void;
        removePlugin(pluginObj: Plugin): void;
        renderer: Renderer | null;
        reorderPlayers(playerIdList: number[], moveToTop: boolean): void;
        requireRecaptcha: boolean;
        resetTeam(teamId: number): void;
        resetTeams(): void;
        scoreLimit: number;
        sdp: string;
        sendAnnouncement(
            msg: string,
            targetId?: number,
            color?: number,
            style?: string,
            sound?: number,
        ): void;
        sendBinaryCustomEvent(
            type: number,
            data: Uint8Array,
            targetId?: number,
        ): void;
        sendChat(msg: string, targetId: number | null): void;
        sendCustomConnectionError(playerId: number, errorString: string): void;
        sendCustomEvent(type: number, data: object, targetId?: number): void;
        setAvatar(avatar: string): void;
        setChatIndicatorActive(active: boolean): void;
        setConfig(roomConfig: RoomConfig): void;
        setCurrentStadium(stadium: IStadium): void;
        setDiscProperties(
            discId: number,
            properties: SetDiscPropertiesParams,
        ): void;
        setFakePassword(fakePwd: boolean | null): void;
        setHandicap(handicap: number): void;
        setKeyState(state: number, instant?: boolean): void;
        setKickRateLimit(min: number, rate: number, burst: number): void;
        setPlayerAdmin(playerId: number, isAdmin: boolean): void;
        setPlayerAvatar(id: number, value: string, headless: boolean): void;
        setPlayerDiscProperties(
            playerId: number,
            properties: SetDiscPropertiesParams,
        ): void;
        setPlayerIdentity(
            id: number,
            data: IdentityData,
            signature: ArrayBuffer,
            targetId?: number,
        ): void;
        setPlayerTeam(playerId: number, teamId: number): void;
        setPluginActive(name: string, active: boolean): void;
        setProperties(properties: SetRoomPropertiesParams): void;
        setRenderer(renderer: Renderer): void;
        setScoreLimit(value: number): void;
        setSync(value: boolean): void;
        setTeamColors(teamId: number, angle: number, ...colors: number[]): void;
        setTimeLimit(value: number): void;
        setUnlimitedPlayerCount(on: boolean): void;
        showInRoomList: boolean;
        stadium: IStadium;
        startGame(): void;
        startRecording(): boolean;
        startStreaming(
            params?: StartStreamingParams,
        ): StartStreamingReturnValue | null;
        state: RoomState;
        stateExt: RoomState | null;
        stopGame(): void;
        stopRecording(): Uint8Array<ArrayBufferLike> | null;
        stopStreaming(): void;
        takeSnapshot(): RoomState;
        timeElapsed: number | null;
        timeLimit: number;
        token: string;
        unlimitedPlayerCount: boolean;
        updateLibrary(libraryIndex: number, newLibraryObj: Library): void;
        updatePlugin(pluginIndex: number, newPluginObj: Plugin): void;
    }
    Index

    Properties

    banList: BanEntry[]

    The current list of banned players. read-only. host-only.

    blueScore: number | null

    Blue team's current score. null if game is not active. read-only.

    config: RoomConfig

    The current roomConfig object.

    currentFrameNo: number

    The current frame number of the room. read-only.

    currentPlayer: Player

    The current Player object.

    currentPlayerId: number

    Current player's id.

    debugDesync:
        | true
        | ((hostRoomState: RoomState, clientRoomState: RoomState) => void)
        | null

    For a host room, can be true. For a client room, can be a callback function with parameters hostRoomState and clientRoomState. (Look at https://github.com/wxyz-abcd/mooball/tree/main/examples/other/compareStates.js for the default implementation of desync checking.) This callback is called whenever a desync occurs if the host room's debugDesync value is also true. Defaults to null.

    fakePassword: boolean | null

    The current fake password value of the room. read-only. host-only.

    fixedPlayerCount: number | null

    The current fixed player count value of the room. read-only. host-only.

    gameState: GameState | null

    The object that holds the game state information. Returns null if game is not active.

    gameStateExt: GameState | null

    The object that holds the extrapolated game state information. Returns null if game is not active or no extrapolated data is available yet.

    geo: { flag: number; lat: number; lon: number }

    The current geolocation of the room. read-only. host-only.

    gui: Gui

    Gui-related values of the room. read-only.

    hideIdentity: boolean

    Whether to hide the owner of this room or not. read-only. host-only.

    isHost: boolean

    true for a host room, false for a client room.

    libraries: Library[]

    Array of all available libraries.

    librariesMap: object

    All available libraries mapped as librariesMap[library.name] = library, for meaningful communication between addons inside our custom addon codes.

    link: string

    The url of the room. read-only.

    maxPlayerCount: number

    The current maximum number of players of the room. read-only. host-only.

    name: string

    The name of the room. read-only.

    password: string

    The current password of the room. read-only. host-only.

    players: Player[]

    The list of players in the room. read-only.

    plugins: Plugin[]

    Array of all available plugins. This is used internally to restore the order of plugins while a plugin is being activated/deactivated.

    pluginsMap: object

    All available plugins mapped as pluginsMap[plugin.name] = plugin, for meaningful communication between addons inside our custom addon codes.

    redScore: number | null

    Red team's current score. null if game is not active. read-only.

    renderer: Renderer | null

    The current renderer object.

    requireRecaptcha: boolean

    The current join-recaptcha status of the room. host-only.

    scoreLimit: number

    The game's current score limit. read-only.

    sdp: string

    Session description value of the room's WebRTC connection. (only for client rooms)

    showInRoomList: boolean

    Whether the room is currently being shown in the room list of the backend server or not. read-only. host-only.

    stadium: IStadium

    The stadium object of the room. read-only.

    state: RoomState

    The object that holds the whole room state.

    stateExt: RoomState | null

    The object that holds the whole extrapolated room state. Returns null if no extrapolated data is available yet.

    timeElapsed: number | null

    Elapsed time in current game. null if game is not active. read-only.

    timeLimit: number

    The game's current time limit. read-only.

    token: string

    The current recaptcha token of the room. If changed, it will also refresh the room link. host-only.

    unlimitedPlayerCount: boolean

    Whether the room's player count checking is disabled or not. read-only. host-only.

    Methods

    • Bans all given auth(s) from joining the room. host-only.

      Parameters

      • ...auths: string[]

        The auth(s) to ban.

      Returns (number | null)[]

      An array that contains; for each auth parameter in the given order, the id of the new ban entry if successful, otherwise null.

    • Bans all given ip(range)(s) from joining the room. host-only.

      Parameters

      Returns (number | null)[]

      An array that contains; for each ip (range) parameter in the given order, the id of the new ban entry if successful, otherwise null.

    • Adds the libraryObj at the end of the libraries list and initializes it.

      Parameters

      • libraryObj: Library

        The Library object to be added.

      Returns void

      void.

    • Bans a player from joining the room. host-only.

      Parameters

      • playerId: number

        Id of the player to ban.

      Returns number | null

      Id of the new ban entry if successful, otherwise null.

    • Adds the pluginObj at the end of the plugins list, initializes and activates it if necessary.

      Parameters

      • pluginObj: Plugin

        The Plugin object to be added.

      Returns void

      void.

    • Removes the last two players from spectators and adds them to consecutive teams. The first is always added to red, the second is always blue. If there is only one player, it is added to a random team. admin-only.

      Returns void

      void.

    • Moves the current player to the team whose id is teamId. This operation is blocked by default if the current player is not admin and (the game is active or teams are locked).

      Parameters

      • teamId: number

        Id of the team that is desired to join.

      Returns void

      void.

    • Clears the ban of a player. host-only.

      Parameters

      • id: number

        Id of the player whose ban will be cleared.

      Returns void

      void.

    • Clears all bans. host-only.

      Returns void

      void.

    • Clears the event queue. Can be useful when the game engine is stuck.

      Returns void

      void.

    • Executes any event inside this room. host-only.

      Parameters

      • event: MooballEvent

        The event to be executed.

      • byId: number

        Id of the player of whom this event will be executed by.

      Returns void

      void.

    • Sends any event to the target player. If targetId is null; works the same as executeEvent. CAUTION: It will probably cause "intentional" desync for most events. host-only.

      Parameters

      • event: MooballEvent

        The event to be sent.

      • targetId: number

        Id of the player to whom this event will be sent to.

      Returns void

      void.

    • Extrapolates the current room state and sets the ext variables inside original objects to their newly calculated extrapolated states. Normally designed to be used in renderers.

      Parameters

      • milliseconds: number

        The time to extrapolate the state for in milliseconds. Defaults to 0.

      • ignoreMultipleCalls: boolean

        Whether to allow multiple calls in the same game tick. Should be true only while using it inside a renderer's render function. Defaults to false.

      Returns RoomState

      The extrapolated room state.

    • Returns the ball disc.

      Parameters

      • Optionalextrapolated: boolean

        Defaults to false.

        • true: return the latest extrapolated version if available, otherwise the original version.
        • false: return the original version.

      Returns Disc

      A Disc object.

    • Returns the disc whose id is discId.

      Parameters

      • discId: number

        Id of the disc to be returned.

      • Optionalextrapolated: boolean

        Defaults to false.

        • true: return the latest extrapolated version if available, otherwise the original version.
        • false: return the original version.

      Returns Disc

      A Disc object.

    • Returns the disc array of the current room.

      Parameters

      • Optionalextrapolated: boolean

        Defaults to false.

        • true: return the latest extrapolated version if available, otherwise the original version.
        • false: return the original version.

      Returns Disc[]

      An array that consists of Disc objects.

    • Returns the current player's key state value.

      Returns number

      An integer between 0 and 31 inclusive.

    • Returns the Player object for the player whose id is id.

      Parameters

      • id: number

        Id of the player.

      Returns Player

      A Player object.

    • Returns the disc that belongs to the player whose id is playerId.

      Parameters

      • playerId: number

        Id of the player whose disc is to be returned.

      • Optionalextrapolated: boolean

        Defaults to false.

        • true: return the latest extrapolated version if available, otherwise the original version.
        • false: return the original version.

      Returns Disc

      A Disc object.

    • Returns the disc that belongs to the player whose id is playerId. Faster than getPlayerDisc, but experimental. Use at your own risk.

      Parameters

      • playerId: number

        Id of the player whose disc is to be returned.

      Returns Disc

      A Disc object.

    • Returns true if game is paused.

      Returns boolean

      void.

    • Returns whether the replay recorder is active or not.

      Returns boolean

      true if replay recording is active; false otherwise.

    • Kicks or bans a player.

      Parameters

      • playerId: number

        Id of the player who is being kicked/banned.

      • reason: string | null

        The kick/ban reason. If null, it is interpreted as he/she leaving by himself/herself, and the ban value is ignored in that case.

      • isBanning: boolean

        If true, the player is being banned; otherwise, the player is being kicked.

      Returns void

      void.

    • Leaves the current room. Also releases the resources used by this object.

      Returns void

      void.

    • Locks or unlocks the ability for non-admin players to change teams while the game is not active. admin-only.

      Returns void

      void.

    • Adds all callbacks in roomConfig into the room's current RoomConfig object. If there is a callback with the same name, a new callback is created that calls both of them. (The current callback is called first.)

      Parameters

      • roomConfig: RoomConfig

        The RoomConfig object to be mixed with the current room's RoomConfig object.

      Returns void

      void.

    • Moves the Library at the specified libraryIndex to the index newIndex.

      Parameters

      • libraryIndex: number

        The index of the library that will be moved to a new index.

      • newIndex: number

        The new index that the library is desired to be at.

      Returns void

      void.

    • Moves the Plugin at the specified pluginIndex to the index newIndex.

      Parameters

      • pluginIndex: number

        The index of the plugin that will be moved to a new index.

      • newIndex: number

        The new index that the plugin is desired to be at.

      Returns void

      void.

    • Pauses or resumes the game. admin-only.

      Returns void

      void.

    • Removes the last two players from the spectators team and adds them to consecutive teams. The first is added to a random team, the second is added to the rival of the first team, etc. If there is only one player, it is added to a random team. admin-only.

      Returns void

      void.

    • Removes the ban entry with the given id. host-only.

      Parameters

      • id: number

        Id of the ban entry to remove.

      Returns boolean

      True if the ban entry was removed, otherwise false.

    • Removes the libraryObj from the libraries list and finalizes it.

      Parameters

      • libraryObj: Library

        The Library object to be removed.

      Returns void

      void.

    • Removes the pluginObj from the plugins list, deactivates and finalizes it if necessary.

      Parameters

      • pluginObj: Plugin

        The Plugin object to be removed.

      Returns void

      void.

    • Removes all of the players whose ids exist in the array playerIdList, and adds them back in the given order to the top or bottom of the player list depending on the moveToTop value. host-only.

      Parameters

      • playerIdList: number[]

        The ids of players that are desired to be removed from the room's players list, reordered to match the order in idList and added back to the room's players list.

      • moveToTop: boolean

        Whether to add the players to the top or bottom of the room's players list.

      Returns void

      void.

    • Moves every player in a team to the spectators team. admin-only.

      Parameters

      • teamId: number

        Id of the team whose whose players will be moved to the spectators team.

      Returns void

      void.

    • Moves every player to the spectators team. admin-only.

      Returns void

      void.

    • Sends an announcement message. host-only.

      Parameters

      • msg: string

        The announcement message that is desired to be sent. msg.length must be <= 1000.

      • OptionaltargetId: number

        If null, the message is sent to everyone; otherwise, only the player whose id is targetId will receive this announcement. Default value = null.

      • Optionalcolor: number

        The desired color of the announcement. Range: -1 <= color < 16777216. Default value = -1.

        • The color value can be converted into a rgba string via API's Utils.numberToColor function.
        • The special value -1 means transparent.
      • Optionalstyle: string

        The desired font style of the announcement. Default value = "normal". Must be one of the following:

        • normal: use document's default font style.
        • bold: fontWeight = "bold".
        • italic: fontStyle = "italic".
        • small: fontSize = "12px".
        • small-bold: fontWeight = "bold", fontSize = "12px".
        • small-italic: fontWeight = "italic", fontSize = "12px".
      • Optionalsound: number

        The desired sound of the announcement. Default value = 1. Must be one of the following:

        • 0: no sound.
        • 1: chat sound.
        • 2: highlight sound.

      Returns void

      void.

    • Creates a BinaryCustomEvent event message with given type and data properties and sends it. The values type and data completely depend on your custom event's order and logic.

      Parameters

      • type: number

        The type of the binary custom event.

      • data: Uint8Array

        Any custom binary data for this specific event.

      • OptionaltargetId: number

        If given, sends this event only to the player with this id if the player is using this modified client.

      Returns void

      void.

    • Sends a chat message.

      Parameters

      • msg: string

        The message that is desired to be sent. msg.length must be <= 140.

      • targetId: number | null

        If null, the message is sent to everyone; otherwise, only the player whose id is targetId will receive this chat message. host-only.

      Returns void

      void.

    • Sends a custom connection error string to a client. Shortly after this operation, the connection to the client will be lost, and the error will appear on the client's screen. This function must be called just after the client has joined the room, otherwise it will most likely fail.

      Parameters

      • playerId: number

        Id of the player that is expected to leave the room.

      • errorString: string

        The error message that the client will see on screen.

      Returns void

      The snapshot copy of the current room's state.

    • Creates a CustomEvent event message with given type and data properties and sends it. The values type and data completely depend on your custom event's order and logic.

      Parameters

      • type: number

        The type of the custom event.

      • data: object

        Any custom data for this specific event. This is converted to a string via JSON.stringify while being serialized.

      • OptionaltargetId: number

        If given, sends this event only to the player with this id if the player is using this modified client.

      Returns void

      void.

    • Sets the current player's client avatar value.

      Parameters

      • avatar: string

        The desired avatar value. avatar.length must be <= 2.

      Returns void

      void.

    • Sets the current player's chat indicator status.

      Parameters

      • active: boolean

        true activates the chat indicator, false deactivates it.

      Returns void

      void.

    • Sets the RoomConfig object that contains all the main callbacks of this room.

      Parameters

      • roomConfig: RoomConfig

        The new RoomConfig instance to be replaced with the room's current one.

      Returns void

      void.

    • Sets the current stadium to stadium. The game must be stopped first. admin-only.

      Parameters

      • stadium: IStadium

        The desired stadium to be set as the room's current stadium.

      Returns void

      void.

    • Sets the properties of a disc. host-only.

      Parameters

      • discId: number

        Id of the disc whose properties are desired to be set.

      • properties: SetDiscPropertiesParams

        The desired properties to set. This will not change the omitted keys of the disc. properties has the following structure:

        • x: number | null: The desired x coordinate of the disc.
        • y: number | null: The desired y coordinate of the disc.
        • xspeed: number | null: Desired x component of the speed of the disc.
        • yspeed: number | null: Desired y component of the speed of the disc.
        • xgravity: number | null: Desired x component of the gravity of the disc.
        • ygravity: number | null: Desired y component of the gravity of the disc.
        • radius: number | null: The desired radius of the disc.
        • bCoeff: number | null: The desired bouncing coefficient of the disc.
        • invMass: number | null: The desired inverse mass of the disc.
        • damping: number | null: The desired damping of the disc.
        • color: int | null: The desired color of the disc.
        • cMask: int | null: The desired collision mask of the disc.
        • cGroup: int | null: The desired collision group of the disc.

      Returns void

      void.

    • Fakes Mooball's backend by directly modifying the password-protectedness of the room. host-only.

      Parameters

      • fakePwd: boolean | null

        If fakePwd is true or false, the room will set its password-protected status to the passed fakePwd value regardless of the room's actual password value. Passing null returns to default behaviour. host-only.

      Returns void

      void.

    • Sets the current player's handicap value.

      Parameters

      • handicap: number

        The desired handicap value in msecs. 0 <= handicap <= 300.

      Returns void

      void.

    • Sets the current player's key state value.

      Parameters

      • state: number

        The desired key state value. 0 <= state <= 31.

      • Optionalinstant: boolean

        If true, sends the event immediately. This is introduced later to reduce input lag. Default value = true.

      Returns void

      void.

    • Sets the kick rate limit of the current room. admins-only.

      Parameters

      • min: number

        The desired min value of kick rate limit. 0 <= min <= 255.

      • rate: number

        The desired rate value of kick rate limit. 0 <= rate <= 255.

      • burst: number

        The desired burst value of kick rate limit. 0 <= burst <= 100.

      Returns void

      void.

    • Give/take away admin rights to/from a player. admin-only.

      Parameters

      • playerId: number

        Id of the player who will have his/her admin rights changed.

      • isAdmin: boolean

        Whether the player is desired to have admin rights or not.

      Returns void

      void.

    • Sets the avatar to value for the player whose id is id. host-only.

      Parameters

      • id: number

        Id of the player whose avatar is being changed.

      • value: string

        The desired avatar value. avatar.length must be <= 2.

      • headless: boolean

        If true, sets the headless avatar. Otherwise, sets the client avatar.

      Returns void

      void.

    • Sets the desired disc properties of any player. host-only.

      Parameters

      • playerId: number

        Id of the player whose disc properties are desired to be changed.

      • properties: SetDiscPropertiesParams

        The desired properties to set. This will not change the omitted keys of the disc. properties has the following structure:

        • x: number | null: The desired x coordinate of the disc.
        • y: number | null: The desired y coordinate of the disc.
        • xspeed: number | null: Desired x component of the speed of the disc.
        • yspeed: number | null: Desired y component of the speed of the disc.
        • xgravity: number | null: Desired x component of the gravity of the disc.
        • ygravity: number | null: Desired y component of the gravity of the disc.
        • radius: number | null: The desired radius of the disc.
        • bCoeff: number | null: The desired bouncing coefficient of the disc.
        • invMass: number | null: The desired inverse mass of the disc.
        • damping: number | null: The desired damping of the disc.
        • color: int | null: The desired color of the disc.
        • cMask: int | null: The desired collision mask of the disc.
        • cGroup: int | null: The desired collision group of the disc.

      Returns void

      void.

    • Creates an IdentityEvent event message with given player id and data properties and sends it. This event sets playerObject.identity value to the given data object for all clients.

      Parameters

      • id: number

        Id of the player whose identity data is being changed.

      • data: IdentityData

        The new identity data.

      • signature: ArrayBuffer

        Signature of the identity data.

      • OptionaltargetId: number

        If given, sends this event only to the player with this id if the player is using this modified client.

      Returns void

      void.

    • Moves a player to a different team. admin-only.

      Parameters

      • playerId: number

        Id of the player to be moved to a different team.

      • teamId: number

        Id of the team to move the player to.

      Returns void

      void.

    • Activate or deactivate the plugin whose name is name.

      Parameters

      • name: string

        Name of the plugin that is desired to be activated/deactivated.

      • active: boolean

        Whether to activate(active = true) the plugin or to deactivate(active = false) it.

      Returns void

      void.

    • Sets the room's properties. Only room host can use this function.

      Parameters

      • properties: SetRoomPropertiesParams

        An object that might have the following keys: (You might omit any key if you don't want to change its value.)

        • name: string | null: The desired name of the current room.
        • password: string | null: The desired password of the current room, or null to clear the password.
        • geo: GeoLocation | null: The desired geolocation of the current room.
        • playerCount: int | null: An integer value to fix the player count of the current room to that number, or null to return to normal behaviour. Original Mooball backend has the current restriction about this value: 0 <= playerCount <= 30. If the room does not satisfy this, it is not shown in the room list.
        • maxPlayerCount: int | null: The maximum player count value of the current room. Original Mooball backend has the current restriction about this value: 0 <= maxPlayerCount <= 30. If the room does not satisfy this, it is not shown in the room list.
        • fakePassword: boolean | null: If set to true or false, the room will set its password-protected status to your value. Passing null disables this behaviour.
        • unlimitedPlayerCount: boolean: If set to true, bypasses the player count checks, resulting in unlimited maximum player count. However, the default backend will not show the room in the room list if the player count > 30.
        • showInRoomList: boolean: Whether to show this room in the room list or not.
        • tintColor: uint32: Background tint color(to show in room list) of this room.
        • thumbnail: string: Thumbnail(to show in room list) of this room.
        • hideIdentity: booolean: Whether to hide the owner of this room or not.

      Returns void

      void.

    • Sets the Renderer object that will render the game. If exists, the old renderer is finalized and the new renderer is initialized.

      Parameters

      • renderer: Renderer

        The new Renderer object that will replace the old one.

      Returns void

      void.

    • Sets the score limit of the room. The game must be stopped first. admin-only.

      Parameters

      • value: number

        The desired score limit. 0 <= value <= 99. 0 means unlimited.

      Returns void

      void.

    • Sets the synchronization status of the current player.

      Parameters

      • value: boolean

        The desired synchronization status.

      Returns void

      void.

    • Sets the team colors for the team whose id is teamId. admins-only.

      Parameters

      • teamId: number

        Id of the team whose colors are desired to be changed. Can either be 1(red) or 2(blue).

      • angle: number

        The desired angle of stripes. Should be between -180 and 180.

      • ...colors: number[]

        Minimum 2, maximum 4 numeric (0 <= integer <= 16777215) color parameters. First parameter is the text color, and the others are stripe colors.

      Returns void

      void.

    • Sets the time limit of the room. The game must be stopped first. admin-only.

      Parameters

      • value: number

        The desired time limit. 0 <= value <= 99. 0 means unlimited.

      Returns void

      void.

    • When a player joins the room, the engine is first checking whether the current player count>=room's maximum player count value. This function enables or disables this check. host-only.

      Parameters

      • on: boolean

        Whether the unlimited player count feature is desired to be active or not.

      Returns void

      void.

    • Starts the game. admin-only.

      Returns void

      void.

    • Start recording replay. Recording should be stopped before calling this.

      Returns boolean

      true if succeeded, false otherwise.

    • Stops the game. admin-only.

      Returns void

      void.

    • Stop recording replay. Recording should be started before calling this.

      Returns Uint8Array<ArrayBufferLike> | null

      The recorded replay data if succeeded, null otherwise.

    • Stop streaming the game. Streaming should be started before calling this.

      Returns void

      void.

    • Returns a snapshot of the current room state. You can load this object directly into sandbox using its useSnapshot(roomState) function. Note that the values stored here are the currently active values, not the static and stored ones.

      Returns RoomState

      The snapshot copy of the current room's state.

    • Replaces the Library at the specified libraryIndex with the newLibraryObj library. The old library is finalized and the new library is initialized. The names of the libraries must be the same.

      Parameters

      • libraryIndex: number

        The index of the library that is about to be replaced with the new Library object.

      • newLibraryObj: Library

        The new Library object that will replace the old one.

      Returns void

      void.

    • Replaces the Plugin at the specified pluginIndex with the newPluginObj plugin. The old plugin is deactivated and finalized and the new plugin is initialized. If the old plugin was active before, the new plugin is also activated. The names of the plugins must be the same.

      Parameters

      • pluginIndex: number

        The index of the plugin that is about to be replaced with the new Plugin object.

      • newPluginObj: Plugin

        The new Plugin object that will replace the old one.

      Returns void

      void.