mooball
    Preparing search index...

    Interface IRoom

    interface IRoom {
        isHost: boolean;
        currentPlayerId: number;
        currentPlayer: Player;
        state: RoomState;
        stateExt: RoomState | null;
        gameState: GameState | null;
        gameStateExt: GameState | null;
        sdp: string;
        config: RoomConfig;
        renderer: Renderer | null;
        plugins: Plugin[];
        pluginsMap: object;
        libraries: Library[];
        librariesMap: object;
        name: string;
        gui: Gui;
        link: string;
        timeLimit: number;
        scoreLimit: number;
        stadium: IStadium;
        players: Player[];
        redScore: number | null;
        blueScore: number | null;
        timeElapsed: number | null;
        currentFrameNo: number;
        banList: BanEntry[];
        password: string;
        geo: { flag: number; lat: number; lon: number };
        maxPlayerCount: number;
        fakePassword: boolean | null;
        fixedPlayerCount: number | null;
        showInRoomList: boolean;
        unlimitedPlayerCount: boolean;
        hideIdentity: boolean;
        token: string;
        requireRecaptcha: boolean;
        debugDesync:
            | true
            | ((hostRoomState: RoomState, clientRoomState: RoomState) => void)
            | null;
        leave(): void;
        setProperties(properties: SetRoomPropertiesParams): void;
        setKickRateLimit(min: number, rate: number, burst: number): void;
        setHandicap(handicap: number): void;
        addPlayerBan(playerId: number): number | null;
        addIpBan(...ips: (string | IPv4Range | IPv6Range)[]): (number | null)[];
        addAuthBan(...auths: string[]): (number | null)[];
        removeBan(id: number): boolean;
        clearBans(): void;
        clearBan(id: number): void;
        executeEvent(event: MooballEvent, byId: number): void;
        executeEventWithTarget(event: MooballEvent, targetId: number): void;
        clearEvents(): void;
        setAvatar(avatar: string): void;
        setPlayerAvatar(id: number, value: string, headless: boolean): void;
        setChatIndicatorActive(active: boolean): void;
        setTeamColors(teamId: number, angle: number, ...colors: number[]): void;
        setUnlimitedPlayerCount(on: boolean): void;
        setFakePassword(fakePwd: boolean | null): void;
        sendChat(msg: string, targetId: number | null): void;
        sendAnnouncement(
            msg: string,
            targetId?: number,
            color?: number,
            style?: string,
            sound?: number,
        ): void;
        setDiscProperties(
            discId: number,
            properties: SetDiscPropertiesParams,
        ): void;
        setPlayerDiscProperties(
            playerId: number,
            properties: SetDiscPropertiesParams,
        ): void;
        reorderPlayers(playerIdList: number[], moveToTop: boolean): void;
        sendCustomEvent(type: number, data: object, targetId?: number): void;
        sendBinaryCustomEvent(
            type: number,
            data: Uint8Array,
            targetId?: number,
        ): void;
        setPlayerIdentity(
            id: number,
            data: IdentityData,
            signature: ArrayBuffer,
            targetId?: number,
        ): void;
        getKeyState(): number;
        setKeyState(state: number, instant?: boolean): void;
        startGame(): void;
        stopGame(): void;
        pauseGame(): void;
        isGamePaused(): boolean;
        autoTeams(): void;
        lockTeams(): void;
        resetTeams(): void;
        randTeams(): void;
        resetTeam(teamId: number): void;
        setSync(value: boolean): void;
        setCurrentStadium(stadium: IStadium): void;
        setTimeLimit(value: number): void;
        setScoreLimit(value: number): void;
        changeTeam(teamId: number): void;
        setPlayerTeam(playerId: number, teamId: number): void;
        setPlayerAdmin(playerId: number, isAdmin: boolean): void;
        kickPlayer(
            playerId: number,
            reason: string | null,
            isBanning: boolean,
        ): void;
        getPlayer(id: number): Player;
        getBall(extrapolated?: boolean): Disc;
        getDiscs(extrapolated?: boolean): Disc[];
        getDisc(discId: number, extrapolated?: boolean): Disc;
        getPlayerDisc(playerId: number, extrapolated?: boolean): Disc;
        getPlayerDisc_exp(playerId: number): Disc;
        setPluginActive(name: string, active: boolean): void;
        startRecording(): boolean;
        stopRecording(): Uint8Array<ArrayBufferLike> | null;
        startStreaming(
            params?: StartStreamingParams,
        ): StartStreamingReturnValue | null;
        stopStreaming(): void;
        isRecording(): boolean;
        extrapolate(milliseconds: number, ignoreMultipleCalls: boolean): RoomState;
        setConfig(roomConfig: RoomConfig): void;
        mixConfig(roomConfig: RoomConfig): void;
        addPlugin(pluginObj: Plugin): void;
        movePlugin(pluginIndex: number, newIndex: number): void;
        updatePlugin(pluginIndex: number, newPluginObj: Plugin): void;
        removePlugin(pluginObj: Plugin): void;
        setRenderer(renderer: Renderer): void;
        addLibrary(libraryObj: Library): void;
        moveLibrary(libraryIndex: number, newIndex: number): void;
        updateLibrary(libraryIndex: number, newLibraryObj: Library): void;
        removeLibrary(libraryObj: Library): void;
        takeSnapshot(): RoomState;
        sendCustomConnectionError(playerId: number, errorString: string): void;
        onBeforeRoomLink?(link: string): any;
        onAfterRoomLink?(link: string, customData?: any): void;
        onBeforeBansClear?(): any;
        onAfterBansClear?(customData?: any): void;
        onBeforeBanClear?(id: number): any;
        onAfterBanClear?(id: number, customData?: any): void;
        onBeforeRoomRecaptchaModeChange?(on: boolean): any;
        onAfterRoomRecaptchaModeChange?(on: boolean, customData?: any): void;
        onBeforeRoomTokenChange?(token: string): any;
        onAfterRoomTokenChange?(token: string, customData?: any): void;
        onBeforeAnnouncement?(
            msg: string,
            color: number,
            style: number,
            sound: number,
        ): any;
        onAfterAnnouncement?(
            msg: string,
            color: number,
            style: number,
            sound: number,
            customData?: any,
        ): void;
        onBeforePlayerHeadlessAvatarChange?(id: number, value: string): any;
        onAfterPlayerHeadlessAvatarChange?(
            id: number,
            value: string,
            customData?: any,
        ): void;
        onBeforePlayersOrderChange?(idList: number[], moveToTop: boolean): any;
        onAfterPlayersOrderChange?(
            idList: number[],
            moveToTop: boolean,
            customData?: any,
        ): void;
        onBeforeSetDiscProperties?(
            id: number,
            type: number,
            data1: number[],
            data2: number[],
        ): any;
        onAfterSetDiscProperties?(
            id: number,
            type: number,
            data1: number[],
            data2: number[],
            customData?: any,
        ): void;
        onBeforePingData?(array: number[]): any;
        onAfterPingData?(array: number[], customData?: any): void;
        onBeforeRoomPropertiesChange?(props: UpdatedRoomProps): any;
        onAfterRoomPropertiesChange?(
            props: UpdatedRoomProps,
            customData?: any,
        ): void;
        onBeforeRunDefaultGameLogicChange?(value: boolean): any;
        onAfterRunDefaultGameLogicChange?(value: boolean, customData?: any): void;
        onBeforeAnnouncement2?(
            msg: string,
            cssVar?: string,
            sound?: string,
            targetId?: number,
        ): any;
        onAfterAnnouncement2?(
            msg: string,
            cssVar?: string,
            sound?: string,
            targetId?: number,
            customData?: any,
        ): void;
        onBeforePlayerSkinChange?(id: number, skin: Texture | null): any;
        onAfterPlayerSkinChange?(
            id: number,
            skin: Texture | null,
            customData?: any,
        ): void;
        onBeforePlayerCssVarChange?(id: number, cssVar: string | null): any;
        onAfterPlayerCssVarChange?(
            id: number,
            cssVar: string | null,
            customData?: any,
        ): void;
        onBeforeStadiumAddObject?(type: number, value: object): any;
        onAfterStadiumAddObject?(
            type: number,
            value: object,
            customData?: any,
        ): void;
        onBeforeStadiumUpdateObject?(type: number, id: number, value: object): any;
        onAfterStadiumUpdateObject?(
            type: number,
            id: number,
            value: object,
            customData?: any,
        ): void;
        onBeforeStadiumRemoveObject?(type: number, id: number): any;
        onAfterStadiumRemoveObject?(
            type: number,
            id: number,
            customData?: any,
        ): void;
        onBeforeClockPausedChange?(value: number): any;
        onAfterClockPausedChange?(value: number, customData?: any): void;
        onBeforeDirectionActiveChange?(value: number): any;
        onAfterDirectionActiveChange?(value: number, customData?: any): void;
        onBeforePlayerEnergyChange?(id: number, data: number[]): any;
        onAfterPlayerEnergyChange?(
            id: number,
            data: number[],
            customData?: any,
        ): void;
        onBeforeControls?(type: number, params: any[]): any;
        onAfterControls?(type: number, params: any[], customData?: any): void;
        onBeforeUpdateCssVar?(name: string, value: string): any;
        onAfterUpdateCssVar?(name: string, value: string, customData?: any): void;
        onBeforePlayCustomSound?(soundName: string): any;
        onAfterPlayCustomSound?(soundName: string, customData?: any): void;
        onBeforeRoomNameChange?(name: string): any;
        onAfterRoomNameChange?(name: string, customData?: any): void;
        onBeforeElapsedTimeChange?(value: number): any;
        onAfterElapsedTimeChange?(value: number, customData?: any): void;
        onBeforeMaxGoalTicksChange?(value: number): any;
        onAfterMaxGoalTicksChange?(value: number, customData?: any): void;
        onBeforeMaxPauseTicksChange?(value: number): any;
        onAfterMaxPauseTicksChange?(value: number, customData?: any): void;
        onBeforeMaxEndTicksChange?(value: number): any;
        onAfterMaxEndTicksChange?(value: number, customData?: any): void;
        onBeforeTeamScoreChange?(teamId: number, value: number): any;
        onAfterTeamScoreChange?(
            teamId: number,
            value: number,
            customData?: any,
        ): void;
        onBeforePingChange?(
            instantPing: number,
            averagePing: number,
            maxPing: number,
        ): any;
        onAfterPingChange?(
            instantPing: number,
            averagePing: number,
            maxPing: number,
            customData?: any,
        ): void;
        onBeforePlayerBallKick?(playerId: number): any;
        onAfterPlayerBallKick?(playerId: number, customData?: any): void;
        onBeforeTeamGoal?(
            teamId: number,
            goalId: number,
            goal: Goal,
            ballDiscId: number,
            ballDisc: Disc,
        ): any;
        onAfterTeamGoal?(
            teamId: number,
            goalId: number,
            goal: Goal,
            ballDiscId: number,
            ballDisc: Disc,
            customData?: any,
        ): void;
        onBeforeGameEnd?(winningTeamId: number): any;
        onAfterGameEnd?(winningTeamId: number, customData?: any): void;
        onBeforeGameTick?(): any;
        onAfterGameTick?(customData?: any): void;
        onBeforeKickOff?(): any;
        onAfterKickOff?(customData?: any): void;
        onBeforeTimeIsUp?(): any;
        onAfterTimeIsUp?(customData?: any): void;
        onBeforePositionsReset?(): any;
        onAfterPositionsReset?(customData?: any): void;
        onBeforeCollisionDiscVsDisc?(
            discId1: number,
            discPlayerId1: number,
            discId2: number,
            discPlayerId2: number,
        ): any;
        onAfterCollisionDiscVsDisc?(
            discId1: number,
            discPlayerId1: number,
            discId2: number,
            discPlayerId2: number,
            customData?: any,
        ): void;
        onBeforeCollisionDiscVsSegment?(
            discId: number,
            discPlayerId: number,
            segmentId: number,
        ): any;
        onAfterCollisionDiscVsSegment?(
            discId: number,
            discPlayerId: number,
            segmentId: number,
            customData?: any,
        ): void;
        onBeforeCollisionDiscVsPlane?(
            discId: number,
            discPlayerId: number,
            planeId: number,
        ): any;
        onAfterCollisionDiscVsPlane?(
            discId: number,
            discPlayerId: number,
            planeId: number,
            customData?: any,
        ): void;
        onBeforeHandicapChange?(value: number): any;
        onAfterHandicapChange?(value: number, customData?: any): void;
        onBeforeRoomRecordingChange?(value: true | ArrayBuffer): any;
        onAfterRoomRecordingChange?(
            value: true | ArrayBuffer,
            customData?: any,
        ): void;
        onBeforePluginActiveChange?(plugin: Plugin): any;
        onAfterPluginActiveChange?(plugin: Plugin, customData?: any): void;
        onBeforeConfigUpdate?(
            oldRoomConfigObj: RoomConfig,
            newRoomConfigObj: RoomConfig,
        ): any;
        onAfterConfigUpdate?(
            oldRoomConfigObj: RoomConfig,
            newRoomConfigObj: RoomConfig,
            customData?: any,
        ): void;
        onBeforeRendererUpdate?(
            oldRendererObj: Renderer,
            newRendererObj: Renderer,
        ): any;
        onAfterRendererUpdate?(
            oldRendererObj: Renderer,
            newRendererObj: Renderer,
            customData?: any,
        ): void;
        onBeforePluginAdd?(pluginObj: Plugin): any;
        onAfterPluginAdd?(pluginObj: Plugin, customData?: any): void;
        onBeforePluginUpdate?(oldPluginObj: Plugin, newPluginObj: Plugin): any;
        onAfterPluginUpdate?(
            oldPluginObj: Plugin,
            newPluginObj: Plugin,
            customData?: any,
        ): void;
        onBeforePluginRemove?(pluginObj: Plugin): any;
        onAfterPluginRemove?(pluginObj: Plugin, customData?: any): void;
        onBeforeLibraryAdd?(libraryObj: Library): any;
        onAfterLibraryAdd?(libraryObj: Library, customData?: any): void;
        onBeforeLibraryMove?(libraryObj: Library): any;
        onAfterLibraryMove?(libraryObj: Library, customData?: any): void;
        onBeforeLibraryUpdate?(oldLibraryObj: Library, newLibraryObj: Library): any;
        onAfterLibraryUpdate?(
            oldLibraryObj: Library,
            newLibraryObj: Library,
            customData?: any,
        ): void;
        onBeforeLibraryRemove?(libraryObj: Library): any;
        onAfterLibraryRemove?(libraryObj: Library, customData?: any): void;
        onBeforeLanguageChange?(abbr: string): any;
        onAfterLanguageChange?(abbr: string, customData?: any): void;
        onBeforeVariableValueChange?(
            addonObject: Addon,
            variableName: string,
            oldValue: any,
            newValue: any,
        ): any;
        onAfterVariableValueChange?(
            addonObject: Addon,
            variableName: string,
            oldValue: any,
            newValue: any,
            customData?: any,
        ): void;
        onBeforePlayerSyncChange?(playerId: number, value: boolean): any;
        onAfterPlayerSyncChange?(
            playerId: number,
            value: boolean,
            customData?: any,
        ): void;
        onBeforeAutoTeams?(
            playerId1: number,
            teamId1: number,
            playerId2: number | null,
            teamId2: number | null,
            byId: number,
        ): any;
        onAfterAutoTeams?(
            playerId1: number,
            teamId1: number,
            playerId2: number | null,
            teamId2: number | null,
            byId: number,
            customData?: any,
        ): void;
        onBeforeScoreLimitChange?(value: number, byId: number): any;
        onAfterScoreLimitChange?(
            value: number,
            byId: number,
            customData?: any,
        ): void;
        onBeforeTimeLimitChange?(value: number, byId: number): any;
        onAfterTimeLimitChange?(
            value: number,
            byId: number,
            customData?: any,
        ): void;
        onBeforeOvertimeLimitChange?(value: number): any;
        onAfterOvertimeLimitChange?(value: number, customData?: any): void;
        onBeforePlayerDirectionChange?(id: number, value: number): any;
        onAfterPlayerDirectionChange?(
            id: number,
            value: number,
            customData?: any,
        ): void;
        onBeforePlayerAdminChange?(id: number, isAdmin: boolean, byId: number): any;
        onAfterPlayerAdminChange?(
            id: number,
            isAdmin: boolean,
            byId: number,
            customData?: any,
        ): void;
        onBeforePlayerAvatarChange?(id: number, value: string): any;
        onAfterPlayerAvatarChange?(
            id: number,
            value: string,
            customData?: any,
        ): void;
        onBeforePlayerTeamChange?(id: number, teamId: number, byId: number): any;
        onAfterPlayerTeamChange?(
            id: number,
            teamId: number,
            byId: number,
            customData?: any,
        ): void;
        onBeforeStadiumChange?(stadium: IStadium, byId: number): any;
        onAfterStadiumChange?(
            stadium: IStadium,
            byId: number,
            customData?: any,
        ): void;
        onBeforeTeamsLockChange?(value: boolean, byId: number): any;
        onAfterTeamsLockChange?(
            value: boolean,
            byId: number,
            customData?: any,
        ): void;
        onBeforePlayerObjectCreated?(playerObj: Player): any;
        onAfterPlayerObjectCreated?(playerObj: Player, customData?: any): void;
        onBeforePlayerDiscCreated?(playerObj: Player): any;
        onAfterPlayerDiscCreated?(playerObj: Player, customData?: any): void;
        onBeforePlayerDiscDestroyed?(playerObj: Player): any;
        onAfterPlayerDiscDestroyed?(playerObj: Player, customData?: any): void;
        onBeforePlayerJoin?(playerObj: Player): any;
        onAfterPlayerJoin?(playerObj: Player, customData?: any): void;
        onBeforeGamePauseChange?(isPaused: boolean, byId: number): any;
        onAfterGamePauseChange?(
            isPaused: boolean,
            byId: number,
            customData?: any,
        ): void;
        onBeforePlayerChat?(id: number, message: string): any;
        onAfterPlayerChat?(id: number, message: string, customData?: any): void;
        onBeforePlayerInputChange?(id: number, value: number): any;
        onAfterPlayerInputChange?(
            id: number,
            value: number,
            customData?: any,
        ): void;
        onBeforePlayerChatIndicatorChange?(id: number, value: boolean): any;
        onAfterPlayerChatIndicatorChange?(
            id: number,
            value: boolean,
            customData?: any,
        ): void;
        onBeforePlayerLeave?(
            playerObj: Player,
            reason: string | null,
            isBanned: boolean,
            byId: number,
        ): any;
        onAfterPlayerLeave?(
            playerObj: Player,
            reason: string | null,
            isBanned: boolean,
            byId: number,
            customData?: any,
        ): void;
        onBeforeTeamColorsChange?(
            teamId: number,
            value: TeamColors,
            byId: number,
        ): any;
        onAfterTeamColorsChange?(
            teamId: number,
            value: TeamColors,
            byId: number,
            customData?: any,
        ): void;
        onBeforeKickRateLimitChange?(
            min: number,
            rate: number,
            burst: number,
            byId: number,
        ): any;
        onAfterKickRateLimitChange?(
            min: number,
            rate: number,
            burst: number,
            byId: number,
            customData?: any,
        ): void;
        onBeforeGameStart?(byId: number): any;
        onAfterGameStart?(byId: number, customData?: any): void;
        onBeforeGameStop?(byId: number): any;
        onAfterGameStop?(byId: number, customData?: any): void;
        modifyPlayerDataBefore?(
            playerId: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
        ):
            | [
                [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
                customData: any,
            ]
            | Promise<
                [
                    [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
                    customData: any,
                ],
            >
            | null;
        modifyPlayerDataAfter?(
            playerId: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
            customData?: any,
        ):
            | [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]
            | Promise<
                [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
            >
            | null;
        modifyPlayerPingBefore?(playerId: number, ping: number): number;
        modifyPlayerPingAfter?(
            playerId: number,
            ping: number,
            customData?: any,
        ): number;
        modifyClientPingBefore?(ping: number): number;
        modifyClientPingAfter?(ping: number, customData?: any): number;
        onBeforeOperationReceived?(
            type: OperationType,
            msg: MooballEvent,
            globalFrameNo: number,
            clientFrameNo: number,
        ): boolean;
        onAfterOperationReceived?(
            type: OperationType,
            msg: MooballEvent,
            globalFrameNo: number,
            clientFrameNo: number,
            customData?: any,
        ): boolean;
        onBeforeCustomEvent?(type: number, data: object, byId: number): any;
        onAfterCustomEvent?(
            type: number,
            data: object,
            byId: number,
            customData?: any,
        ): void;
        onBeforeBinaryCustomEvent?(
            type: number,
            data: Uint8Array,
            byId: number,
        ): any;
        onAfterBinaryCustomEvent?(
            type: number,
            data: Uint8Array,
            byId: number,
            customData?: any,
        ): void;
        onBeforeIdentityEvent?(id: number, data: object, byId: number): any;
        onAfterIdentityEvent?(
            id: number,
            data: object,
            byId: number,
            customData?: any,
        ): void;
        onRoomLink?(link: string, customData?: any): any;
        onBansClear?(customData?: any): any;
        onBanClear?(id: number, customData?: any): any;
        onRoomRecaptchaModeChange?(on: boolean, customData?: any): any;
        onRoomTokenChange?(token: string, customData?: any): any;
        onAnnouncement?(
            msg: string,
            color: number,
            style: number,
            sound: number,
            customData?: any,
        ): any;
        onPlayerHeadlessAvatarChange?(
            id: number,
            value: string,
            customData?: any,
        ): any;
        onPlayersOrderChange?(
            idList: number[],
            moveToTop: boolean,
            customData?: any,
        ): any;
        onSetDiscProperties?(
            id: number,
            type: number,
            data1: number[],
            data2: number[],
            customData?: any,
        ): any;
        onPingData?(array: number[], customData?: any): any;
        onRoomPropertiesChange?(props: UpdatedRoomProps, customData?: any): any;
        onRunDefaultGameLogicChange?(value: boolean, customData?: any): any;
        onAnnouncement2?(
            msg: string,
            cssVar?: string,
            sound?: string,
            targetId?: number,
            customData?: any,
        ): any;
        onPlayerSkinChange?(
            id: number,
            skin: Texture | null,
            customData?: any,
        ): any;
        onPlayerCssVarChange?(
            id: number,
            cssVar: string | null,
            customData?: any,
        ): any;
        onStadiumAddObject?(type: number, value: object, customData?: any): any;
        onStadiumUpdateObject?(
            type: number,
            id: number,
            value: object,
            customData?: any,
        ): any;
        onStadiumRemoveObject?(type: number, id: number, customData?: any): any;
        onClockPausedChange?(value: number, customData?: any): any;
        onDirectionActiveChange?(value: number, customData?: any): any;
        onPlayerEnergyChange?(id: number, data: number[], customData?: any): any;
        onControls?(type: number, params: any[], customData?: any): any;
        onUpdateCssVar?(name: string, value: string, customData?: any): any;
        onPlayCustomSound?(soundName: string, customData?: any): any;
        onRoomNameChange?(name: string, customData?: any): any;
        onElapsedTimeChange?(value: number, customData?: any): any;
        onMaxGoalTicksChange?(value: number, customData?: any): any;
        onMaxPauseTicksChange?(value: number, customData?: any): any;
        onMaxEndTicksChange?(value: number, customData?: any): any;
        onTeamScoreChange?(teamId: number, value: number, customData?: any): any;
        onPingChange?(
            instantPing: number,
            averagePing: number,
            maxPing: number,
            customData?: any,
        ): any;
        onPlayerBallKick?(playerId: number, customData?: any): any;
        onTeamGoal?(
            teamId: number,
            goalId: number,
            goal: Goal,
            ballDiscId: number,
            ballDisc: Disc,
            customData?: any,
        ): any;
        onGameEnd?(winningTeamId: number, customData?: any): any;
        onGameTick?(customData?: any): any;
        onKickOff?(customData?: any): any;
        onTimeIsUp?(customData?: any): any;
        onPositionsReset?(customData?: any): any;
        onCollisionDiscVsDisc?(
            discId1: number,
            discPlayerId1: number,
            discId2: number,
            discPlayerId2: number,
            customData?: any,
        ): any;
        onCollisionDiscVsSegment?(
            discId: number,
            discPlayerId: number,
            segmentId: number,
            customData?: any,
        ): any;
        onCollisionDiscVsPlane?(
            discId: number,
            discPlayerId: number,
            planeId: number,
            customData?: any,
        ): any;
        onHandicapChange?(value: number, customData?: any): any;
        onRoomRecordingChange?(value: true | ArrayBuffer, customData?: any): any;
        onPluginActiveChange?(plugin: Plugin, customData?: any): any;
        onConfigUpdate?(
            oldRoomConfigObj: RoomConfig,
            newRoomConfigObj: RoomConfig,
            customData?: any,
        ): any;
        onRendererUpdate?(
            oldRendererObj: Renderer,
            newRendererObj: Renderer,
            customData?: any,
        ): any;
        onPluginAdd?(pluginObj: Plugin, customData?: any): any;
        onPluginMove?(pluginObj: Plugin, customData?: any): any;
        onPluginUpdate?(
            oldPluginObj: Plugin,
            newPluginObj: Plugin,
            customData?: any,
        ): any;
        onPluginRemove?(pluginObj: Plugin, customData?: any): any;
        onLibraryAdd?(libraryObj: Library, customData?: any): any;
        onLibraryMove?(libraryObj: Library, customData?: any): any;
        onLibraryUpdate?(
            oldLibraryObj: Library,
            newLibraryObj: Library,
            customData?: any,
        ): any;
        onLibraryRemove?(libraryObj: Library, customData?: any): any;
        onLanguageChange?(abbr: string, customData?: any): any;
        onVariableValueChange?(
            addonObject: Addon,
            variableName: string,
            oldValue: any,
            newValue: any,
            customData?: any,
        ): any;
        onPlayerSyncChange?(
            playerId: number,
            value: boolean,
            customData?: any,
        ): any;
        onAutoTeams?(
            playerId1: number,
            teamId1: number,
            playerId2: number | null,
            teamId2: number | null,
            byId: number,
            customData?: any,
        ): any;
        onScoreLimitChange?(value: number, byId: number, customData?: any): any;
        onTimeLimitChange?(value: number, byId: number, customData?: any): any;
        onOvertimeLimitChange?(value: number, customData?: any): any;
        onPlayerDirectionChange?(id: number, value: number, customData?: any): any;
        onPlayerAdminChange?(
            id: number,
            isAdmin: boolean,
            byId: number,
            customData?: any,
        ): any;
        onPlayerAvatarChange?(id: number, value: string, customData?: any): any;
        onPlayerTeamChange?(
            id: number,
            teamId: number,
            byId: number,
            customData?: any,
        ): any;
        onStadiumChange?(stadium: IStadium, byId: number, customData?: any): any;
        onTeamsLockChange?(value: boolean, byId: number, customData?: any): any;
        onPlayerObjectCreated?(playerObj: Player, customData?: any): any;
        onPlayerDiscCreated?(playerObj: Player, customData?: any): any;
        onPlayerDiscDestroyed?(playerObj: Player, customData?: any): any;
        onPlayerJoin?(playerObj: Player, customData?: any): any;
        onGamePauseChange?(isPaused: boolean, byId: number, customData?: any): any;
        onPlayerChat?(id: number, message: string, customData?: any): any;
        onPlayerInputChange?(id: number, value: number, customData?: any): any;
        onPlayerChatIndicatorChange?(
            id: number,
            value: boolean,
            customData?: any,
        ): any;
        onPlayerLeave?(
            playerObj: Player,
            reason: string | null,
            isBanned: boolean,
            byId: number,
            customData?: any,
        ): any;
        onTeamColorsChange?(
            teamId: number,
            value: TeamColors,
            byId: number,
            customData?: any,
        ): any;
        onKickRateLimitChange?(
            min: number,
            rate: number,
            burst: number,
            byId: number,
            customData?: any,
        ): any;
        onGameStart?(byId: number, customData?: any): any;
        onGameStop?(byId: number, customData?: any): any;
        modifyPlayerData?(
            playerId: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
            customData?: any,
        ):
            | [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]
            | Promise<
                [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
            >
            | null;
        modifyPlayerPing?(playerId: number, ping: number, customData?: any): number;
        modifyClientPing?(ping: number, customData?: any): number;
        onOperationReceived?(
            type: OperationType,
            msg: MooballEvent,
            globalFrameNo: number,
            clientFrameNo: number,
            customData?: any,
        ): boolean;
        onCustomEvent?(
            type: number,
            data: object,
            byId: number,
            customData?: any,
        ): any;
        onBinaryCustomEvent?(
            type: number,
            data: Uint8Array,
            byId: number,
            customData?: any,
        ): any;
        onIdentityEvent?(
            id: number,
            data: object,
            byId: number,
            customData?: any,
        ): any;
        exportStadium(): object;
        createVertex(data: CreateVertexParams): Vertex;
        createSegment(data: CreateSegmentParams): Segment;
        createSegmentFromObj(data: CreateSegmentFromObjParams): Segment;
        createGoal(data: CreateGoalParams): Goal;
        createPlane(data: CreatePlaneParams): Plane;
        createDisc(data: CreateDiscParams): Disc;
        createJoint(data: CreateJointParams): Joint;
        createJointFromObj(data: CreateJointFromObjParams): Joint;
        addVertex(data: AddVertexParams): void;
        addSegment(data: AddSegmentParams): void;
        addGoal(data: AddGoalParams): void;
        addPlane(data: AddPlaneParams): void;
        addDisc(data: AddDiscParams): void;
        addJoint(data: AddJointParams): void;
        addSpawnPoint(data: AddSpawnPointParams): void;
        addPlayer(data: AddPlayerParams): void;
        findVertexIndicesOfSegmentObj(obj: Segment): number[];
        findVertexIndicesOfSegment(idx: number): number[] | null;
        updateVertex(idx: number, data: UpdateVertexParams): void;
        updateSegment(idx: number, data: UpdateSegmentParams): void;
        updateGoal(idx: number, data: UpdateGoalParams): void;
        updatePlane(idx: number, data: UpdatePlaneParams): void;
        updateDisc(idx: number, data: UpdateDiscParams): void;
        updateDiscObj(discObj: Disc, data: UpdateDiscObjParams): void;
        updateJoint(idx: number, data: UpdateJointParams): void;
        updateSpawnPoint(
            idx: number,
            team: UnparsedTeam2,
            data: UpdateSpawnPointParams,
        ): void;
        updatePlayer(playerId: number, data: UpdatePlayerParams): void;
        removeVertex(idx: number): void;
        removeSegment(idx: number): void;
        removeGoal(idx: number): void;
        removePlane(idx: number): void;
        removeDisc(idx: number): void;
        removeJoint(idx: number): void;
        removeSpawnPoint(idx: number, team: UnparsedTeam2): void;
        removePlayer(playerId: number): void;
        updateStadiumPlayerPhysics(data: UpdateStadiumPlayerPhysicsParams): void;
        updateStadiumBg(data: UpdateStadiumBgParams): void;
        updateStadiumGeneral(data: UpdateStadiumGeneralParams): void;
        playerDirection(value: number): void;
        setRunDefaultGameLogic(value: boolean): void;
        sendAnnouncement2(
            msg: string,
            cssVar?: string,
            sound?: string,
            targetId?: number,
        ): void;
        setPlayerSkin(id: number, skin: Texture | null): void;
        setPlayerCssVar(id: number, cssVar: string | null): void;
        addStadiumObject(type: number, value: object): void;
        updateStadiumObject(type: number, id: number, value: object): void;
        removeStadiumObject(type: number, id: number): void;
        setOvertimeLimit(value: number): void;
        setPlayerEnergy(id: number, data: number[]): void;
        setPlayerDirection(id: number, value: number): void;
        addControl(name: string, keys: number[]): void;
        removeControl(name: string): void;
        updateCssVar(name: string, value: string): void;
        playCustomSound(soundName: string): void;
        setRoomName(name: string): void;
        setElapsedTime(value: number): void;
        setMaxGoalTicks(value: number): void;
        setMaxPauseTicks(value: number): void;
        setMaxEndTicks(value: number): void;
        setClockPaused(value: number): void;
        setDirectionActive(value: number): void;
        setTeamScore(teamId: number, value: number): void;
        sendDirection(value: number): void;
        fakePlayerJoin(
            id: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
        ): void;
        fakePlayerLeave(
            id: number,
        ): {
            auth: string;
            avatar: string;
            conn: string;
            flag: string;
            id: number;
            name: string;
        };
        fakeSendPlayerInput(input: number, byId: number): void;
        fakeSendPlayerChat(msg: string, byId: number): void;
        fakeSetPlayerChatIndicator(value: boolean, byId: number): void;
        fakeSetPlayerAvatar(value: string, byId: number): void;
        fakeSetPlayerAdmin(playerId: number, value: boolean, byId: number): void;
        fakeSetPlayerSync(value: boolean, byId: number): void;
        fakeSetStadium(value: IStadium, byId: number): void;
        fakeStartGame(byId: number): void;
        fakeStopGame(byId: number): void;
        fakeSetGamePaused(value: boolean, byId: number): void;
        fakeSetScoreLimit(value: number, byId: number): void;
        fakeSetTimeLimit(value: number, byId: number): void;
        fakeSetTeamsLock(value: boolean, byId: number): void;
        fakeAutoTeams(byId: number): void;
        fakeSetPlayerTeam(playerId: number, teamId: number, byId: number): void;
        fakeSetKickRateLimit(
            min: number,
            rate: number,
            burst: number,
            byId: number,
        ): void;
        fakeSetTeamColors(
            teamId: number,
            angle: number,
            colors: number[],
            byId: number,
        ): void;
        fakeKickPlayer(
            playerId: number,
            reason: string | null,
            ban: boolean,
            byId: number,
        ): void;
    }
    isHost: boolean

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

    currentPlayerId: number

    Current player's id.

    currentPlayer: Player

    The current Player object.

    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.

    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.

    sdp: string

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

    config: RoomConfig

    The current roomConfig object.

    renderer: Renderer | null

    The current renderer object.

    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.

    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.

    name: string

    The name of the room. read-only.

    gui: Gui

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

    link: string

    The url of the room. read-only.

    timeLimit: number

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

    scoreLimit: number

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

    stadium: IStadium

    The stadium object of the room. read-only.

    players: Player[]

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

    redScore: number | null

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

    blueScore: number | null

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

    timeElapsed: number | null

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

    currentFrameNo: number

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

    banList: BanEntry[]

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

    password: string

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

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

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

    maxPlayerCount: number

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

    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.

    showInRoomList: boolean

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

    unlimitedPlayerCount: boolean

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

    hideIdentity: boolean

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

    token: string

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

    requireRecaptcha: boolean

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

    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.

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

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

    • Sets the current player's handicap value.

      Parameters

      • handicap: number

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

      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.

    • 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.

    • 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.

    • 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.

    • Clears all bans. host-only.

      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.

    • 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.

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

      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 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 current player's chat indicator status.

      Parameters

      • active: boolean

        true activates the chat indicator, false deactivates it.

      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.

    • 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.

    • 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.

    • 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 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • Returns the current player's key state value.

      Returns number

      An integer between 0 and 31 inclusive.

    • 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.

    • Starts the game. admin-only.

      Returns void

      void.

    • Stops the game. admin-only.

      Returns void

      void.

    • Pauses or resumes the game. admin-only.

      Returns void

      void.

    • Returns true if game is paused.

      Returns boolean

      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.

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

      Returns void

      void.

    • Moves every player to the spectators team. 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.

    • 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.

    • Sets the synchronization status of the current player.

      Parameters

      • value: boolean

        The desired synchronization status.

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

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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 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 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 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 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.

    • 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.

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

      Returns boolean

      true if succeeded, false otherwise.

    • 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 whether the replay recorder is active or not.

      Returns boolean

      true if replay recording is active; false otherwise.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

    • 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.

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

      Parameters

      • libraryObj: Library

        The Library object to be removed.

      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.

    • 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.

    • The room link was received from moo-hoo.com. Called some time after a room is created successfully. Also called when your room stops sending signal to moo-hoo.com, and starts it again after some time. This can happen if your connection gets interrupted or the room somehow becomes unstable due to bugs.

      Parameters

      • link: string

        The room link that was just received.

      Returns any

      void or a custom data to pass to the next callback.

    • The room link was received from moo-hoo.com. Called some time after a room is created successfully. Also called when your room stops sending signal to moo-hoo.com, and starts it again after some time. This can happen if your connection gets interrupted or the room somehow becomes unstable due to bugs.

      Parameters

      • link: string

        The room link that was just received.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after all bans have been cleared using room.clearBans().

      Parameters

      • OptionalcustomData: any

      Returns void

      void.

    • Called just after the ban of a player has been cleared using room.clearBan(id).

      Parameters

      • id: number

        Id of the player whose ban has just been cleared.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ban of a player has been cleared using room.clearBan(id).

      Parameters

      • id: number

        Id of the player whose ban has just been cleared.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's recaptcha mode was changed using room.requireRecaptcha = value.

      Parameters

      • on: boolean

        The new value; whether to request recaptcha or not while joining the room.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's recaptcha mode was changed using room.requireRecaptcha = value.

      Parameters

      • on: boolean

        The new value; whether to request recaptcha or not while joining the room.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just a little after the room's token was changed using room.token = value.

      Parameters

      • token: string

        The new token of the room.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just a little after the room's token was changed using room.token = value.

      Parameters

      • token: string

        The new token of the room.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after an announcement was made by the room host.

      Parameters

      • msg: string

        The announcement message.

      • color: number

        The color of the announcement message. Range: -1 <= color < 16777216.

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

        The style of the announcement message. Must be one of the following:

        • 0: use document's default font style.
        • 1: fontWeight = "bold".
        • 2: fontStyle = "italic".
        • 3: fontSize = "12px".
        • 4: fontWeight = "bold", fontSize = "12px".
        • 5: fontWeight = "italic", fontSize = "12px".
      • sound: number

        The sound of the announcement message. Must be one of the following:

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

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an announcement was made by the room host.

      Parameters

      • msg: string

        The announcement message.

      • color: number

        The color of the announcement message. Range: -1 <= color < 16777216.

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

        The style of the announcement message. Must be one of the following:

        • 0: use document's default font style.
        • 1: fontWeight = "bold".
        • 2: fontStyle = "italic".
        • 3: fontSize = "12px".
        • 4: fontWeight = "bold", fontSize = "12px".
        • 5: fontWeight = "italic", fontSize = "12px".
      • sound: number

        The sound of the announcement message. Must be one of the following:

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

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player has changed his/her headless avatar.

      Parameters

      • id: number

        Id of the player who triggered this event.

      • value: string

        The new headless avatar value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has changed his/her headless avatar.

      Parameters

      • id: number

        Id of the player who triggered this event.

      • value: string

        The new headless avatar value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the order of players have been changed.

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

      Parameters

      • idList: number[]

        The ids of players that were 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 any

      void or a custom data to pass to the next callback.

    • Called just after the order of players have been changed.

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

      Parameters

      • idList: number[]

        The ids of players that were 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.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a disc's properties have been modified.

      Parameters

      • id: number

        The id of player or disc whose disc properties have changed.

      • type: number

        The type of object. Must be one of the following:

        • 0: disc.
        • 1: player.
      • data1: number[]

        Must consist of the following properties of the disc in the same order: [x, y, xspeed, yspeed, xgravity, ygravity, radius, bCoeff, invMass, damping].

      • data2: number[]

        Must consist of the following properties of the disc in the same order: [color, cMask, cGroup].

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a disc's properties have been modified.

      Parameters

      • id: number

        The id of player or disc whose disc properties have changed.

      • type: number

        The type of object. Must be one of the following:

        • 0: disc.
        • 1: player.
      • data1: number[]

        Must consist of the following properties of the disc in the same order: [x, y, xspeed, yspeed, xgravity, ygravity, radius, bCoeff, invMass, damping].

      • data2: number[]

        Must consist of the following properties of the disc in the same order: [color, cMask, cGroup].

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the ping values for all players have been updated.

      Parameters

      • array: number[]

        The updated list of ping values for each player in the same order as the player list in the current room's RoomState object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ping values for all players have been updated.

      Parameters

      • array: number[]

        The updated list of ping values for each player in the same order as the player list in the current room's RoomState object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's properties have been changed, and just before any other callback has been called.

      Parameters

      • props: UpdatedRoomProps

        The properties that were changed. The current structure of this object is as follows:

        props = {
        name: string | null,
        password: string | null,
        fakePassword: boolean | null,
        geo: GeoLocation | null,
        playerCount: int | null,
        maxPlayerCount: int | null
        }

        Note that only the changed keys will show up in props.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's properties have been changed.

      Parameters

      • props: UpdatedRoomProps

        The properties that were changed. The current structure of this object is as follows:

        props = {
        name: string | null,
        password: string | null,
        fakePassword: boolean | null,
        geo: GeoLocation | null,
        playerCount: int | null,
        maxPlayerCount: int | null
        }

        Note that only the changed keys will show up in props. *

      • OptionalcustomData: any

        the custom data that was returned from the previous callback. * *

      Returns void

      void.

    • Called just after room.runDefaultGameLogic has changed.

      Parameters

      • value: boolean

        Whether the default game logic is active(1) or passive(0).

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room.runDefaultGameLogic has changed.

      Parameters

      • value: boolean

        Whether the default game logic is active(1) or passive(0).

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after an announcement has been sent using the improved announcement api.

      Parameters

      • msg: string

        The announcement message. ( max length = 1000 )

      • OptionalcssVar: string

        The cssVar of the announcement message.

      • Optionalsound: string

        The sound of the announcement message.

      • OptionaltargetId: number

        Id of the player who will receive this announcement. If this value is null, the announcement is sent to everyone.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an announcement has been sent using the improved announcement api.

      Parameters

      • msg: string

        The announcement message. ( max length = 1000 )

      • OptionalcssVar: string

        The cssVar of the announcement message.

      • Optionalsound: string

        The sound of the announcement message.

      • OptionaltargetId: number

        Id of the player who will receive this announcement. If this value is null, the announcement is sent to everyone.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current skin(textureId) of a player has been updated.

      Parameters

      • id: number

        Id of the player whose skin will be modified.

      • skin: Texture | null

        New skin value of the player.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current skin(textureId) of a player has been updated.

      Parameters

      • id: number

        Id of the player whose skin will be modified.

      • skin: Texture | null

        New skin value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the cssVar attribute of a player has been changed.

      Parameters

      • id: number

        Id of the player whose cssVar will be modified.

      • cssVar: string | null

        New cssVar value of the player.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the cssVar attribute of a player has been changed.

      Parameters

      • id: number

        Id of the player whose cssVar will be modified.

      • cssVar: string | null

        New cssVar value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after a new stadium object has been added.

      Parameters

      • type: number

        Type of the object to be added.

      • value: object

        An object that is supposed to contain all parameters required to add that type of object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a new stadium object has been added.

      Parameters

      • type: number

        Type of the object to be added.

      • value: object

        An object that is supposed to contain all parameters required to add that type of object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after an existing stadium object has been updated.

      Parameters

      • type: number

        Type of the object to be updated.

      • id: number

        Id of the object to be updated.

      • value: object

        An object that is supposed to contain all parameters required to update that type of object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an existing stadium object has been updated.

      Parameters

      • type: number

        Type of the object to be updated.

      • id: number

        Id of the object to be updated.

      • value: object

        An object that is supposed to contain all parameters required to update that type of object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after an existing stadium object has been removed.

      Parameters

      • type: number

        Type of the object to be removed.

      • id: number

        Id of the object to be removed.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an existing stadium object has been removed.

      Parameters

      • type: number

        Type of the object to be removed.

      • id: number

        Id of the object to be removed.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the game clock has been paused/resumed.

      Parameters

      • value: number

        Whether the game will be paused(1) or resumed(0).

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game clock has been paused/resumed.

      Parameters

      • value: number

        Whether the game will be paused(1) or resumed(0).

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after room.directionActive has been changed.

      Parameters

      • value: number

        New directionActive value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the energy of an individual player has been altered manually.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • data: number[]

        New values. Order of values is supposed to be: [energy, kEnergyGain, kEnergyDrain]. null means no change for each value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the energy of an individual player has been altered manually.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • data: number[]

        New values. Order of values is supposed to be: [energy, kEnergyGain, kEnergyDrain]. null means no change for each value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after game input controls have been modified.

      Parameters

      • type: number

        Type of the operation. (0: add, 1: remove)

      • params: any[]

        Parameters for the specific operation.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after game input controls have been modified.

      Parameters

      • type: number

        Type of the operation. (0: add, 1: remove)

      • params: any[]

        Parameters for the specific operation.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current contents of a css variable has been altered.

      Parameters

      • name: string

        Name of the css variable..

      • value: string

        New value of the css variable.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current contents of a css variable has been altered.

      Parameters

      • name: string

        Name of the css variable..

      • value: string

        New value of the css variable.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after a custom sound has been played.

      Parameters

      • soundName: string

        Name of the sound to be played.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a custom sound has been played.

      Parameters

      • soundName: string

        Name of the sound to be played.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the name of the room has been changed.

      Parameters

      • name: string

        The new room name.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the name of the room has been changed.

      Parameters

      • name: string

        The new room name.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current elapsed time has been changed.

      Parameters

      • value: number

        New elapsed time value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current elapsed time has been changed.

      Parameters

      • value: number

        New elapsed time value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current max goal ticks has been changed.

      Parameters

      • value: number

        New max goal ticks value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current max goal ticks has been changed.

      Parameters

      • value: number

        New max goal ticks value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current max pause ticks has been changed.

      Parameters

      • value: number

        New max pause ticks value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current max pause ticks has been changed.

      Parameters

      • value: number

        New max pause ticks value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current max end ticks has been changed.

      Parameters

      • value: number

        New max end ticks value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current max end ticks has been changed.

      Parameters

      • value: number

        New max end ticks value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the current team scores has been changed.

      Parameters

      • teamId: number

        Id of the team whose score is desired to be changed.

      • value: number

        New score for the team.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current team scores has been changed.

      Parameters

      • teamId: number

        Id of the team whose score is desired to be changed.

      • value: number

        New score for the team.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void or a custom data to pass to the next callback.

    • Called just after the ping value of the current player has been calculated.

      Parameters

      • instantPing: number

        the instant ping value at that moment

      • averagePing: number

        the calculated average ping value in a period of time

      • maxPing: number

        the calculated maximum ping value in a period of time

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ping value of the current player has been calculated.

      Parameters

      • instantPing: number

        the instant ping value at that moment

      • averagePing: number

        the calculated average ping value in a period of time

      • maxPing: number

        the calculated maximum ping value in a period of time

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the ball has been kicked.

      Parameters

      • playerId: number

        Id of the player who kicked the ball.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ball has been kicked.

      Parameters

      • playerId: number

        Id of the player who kicked the ball.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a goal has been scored.

      Parameters

      • teamId: number

        Id of the team that scored the goal.

      • goalId: number

        Id of the goal object that the ball went in.

      • goal: Goal

        The goal object that the ball went in.

      • ballDiscId: number

        Id of the ball disc that caused the goal.

      • ballDisc: Disc

        The ball disc that caused the goal.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a goal has been scored.

      Parameters

      • teamId: number

        Id of the team that scored the goal.

      • goalId: number

        Id of the goal object that the ball went in.

      • goal: Goal

        The goal object that the ball went in.

      • ballDiscId: number

        Id of the ball disc that caused the goal.

      • ballDisc: Disc

        The ball disc that caused the goal.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the game has ended.

      Parameters

      • winningTeamId: number

        Id of the team that has won the game.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has ended.

      Parameters

      • winningTeamId: number

        Id of the team that has won the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a game tick has occurred. This will run a lot of times per second. Be careful not to make too many calculations here, otherwise the game might slow down.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a game tick has occurred. This will run a lot of times per second. Be careful not to make too many calculations here, otherwise the game might slow down.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a kick-off event has occurred.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a kick-off event has occurred.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the game has ended by timeout.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has ended by timeout.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the player positions have been reset. This event happens just after a new game has been started or a goal has been scored. The player positions are reset to their corresponding spawn points defined in the current room's Stadium object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the player positions have been reset. This event happens just after a new game has been started or a goal has been scored. The player positions are reset to their corresponding spawn points defined in the current room's Stadium object.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a collision has happened between two discs.

      Parameters

      • discId1: number

        Id of the first collided disc.

      • discPlayerId1: number

        The player's id that the first disc belongs to. If the disc is not a player's disc, this value will be null.

      • discId2: number

        Id of the second collided disc.

      • discPlayerId2: number

        The player's id that the second disc belongs to. If the disc is not a player's disc, this value will be null.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a collision has happened between two discs.

      Parameters

      • discId1: number

        Id of the first collided disc.

      • discPlayerId1: number

        The player's id that the first disc belongs to. If the disc is not a player's disc, this value will be null.

      • discId2: number

        Id of the second collided disc.

      • discPlayerId2: number

        The player's id that the second disc belongs to. If the disc is not a player's disc, this value will be null.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a collision has happened between a disc and a segment.

      Parameters

      • discId: number

        Id of the collided disc.

      • discPlayerId: number

        The player's id that the disc belongs to. If the disc is not a player's disc, this value will be null.

      • segmentId: number

        Id of the collided segment.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a collision has happened between a disc and a segment.

      Parameters

      • discId: number

        Id of the collided disc.

      • discPlayerId: number

        The player's id that the disc belongs to. If the disc is not a player's disc, this value will be null.

      • segmentId: number

        Id of the collided segment.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a collision has happened between a disc and a plane.

      Parameters

      • discId: number

        Id of the collided disc.

      • discPlayerId: number

        The player's id that the disc belongs to. If the disc is not a player's disc, this value will be null.

      • planeId: number

        Id of the collided plane.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a collision has happened between a disc and a plane.

      Parameters

      • discId: number

        Id of the collided disc.

      • discPlayerId: number

        The player's id that the disc belongs to. If the disc is not a player's disc, this value will be null.

      • planeId: number

        Id of the collided plane.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the local ping handicap value has been changed.

      Parameters

      • value: number

        The new ping handicap value in milliseconds. Range: 0 <= value <= 300.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the local ping handicap value has been changed.

      Parameters

      • value: number

        The new ping handicap value in milliseconds. Range: 0 <= value <= 300.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after room recording has been started or stopped.

      Parameters

      • value: true | ArrayBuffer

        If true, recording has just been started,

        • Else, the recording has just stopped and the recorded data is returned in value as an ArrayBuffer. You might want to write the contents to a version-3 replay file.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room recording has been started or stopped.

      Parameters

      • value: true | ArrayBuffer

        If true, recording has just been started,

        • Else, the recording has just stopped and the recorded data is returned in value as an ArrayBuffer. You might want to write the contents to a version-3 replay file.
      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a plugin has been activated or deactivated.

      Parameters

      • plugin: Plugin

        The plugin which was activated or deactivated. This property stores the current activation status of the plugin: plugin.active.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin has been activated or deactivated.

      Parameters

      • plugin: Plugin

        The plugin which was activated or deactivated. This property stores the current activation status of the plugin: plugin.active.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's config object has been replaced by a new one.

      Parameters

      • oldRoomConfigObj: RoomConfig

        The old RoomConfig object.

      • newRoomConfigObj: RoomConfig

        The new RoomConfig object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's config object has been replaced by a new one.

      Parameters

      • oldRoomConfigObj: RoomConfig

        The old RoomConfig object.

      • newRoomConfigObj: RoomConfig

        The new RoomConfig object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's renderer object has been replaced by a new one.

      Parameters

      • oldRendererObj: Renderer

        The old Renderer object.

      • newRendererObj: Renderer

        The new Renderer object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's renderer object has been replaced by a new one.

      Parameters

      • oldRendererObj: Renderer

        The old Renderer object.

      • newRendererObj: Renderer

        The new Renderer object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a plugin object has been added.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin object has been added.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after an old plugin object has been replaced by a new one.

      Parameters

      • oldPluginObj: Plugin

        The old Plugin object.

      • newPluginObj: Plugin

        The new Plugin object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an old plugin object has been replaced by a new one.

      Parameters

      • oldPluginObj: Plugin

        The old Plugin object.

      • newPluginObj: Plugin

        The new Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a plugin object has been removed.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin object has been removed.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a library object has been added.

      Parameters

      • libraryObj: Library

        The Library object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a library object has been added.

      Parameters

      • libraryObj: Library

        The Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a library object has been moved.

      Parameters

      • libraryObj: Library

        The Library object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a library object has been moved.

      Parameters

      • libraryObj: Library

        The Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after an old library object has been replaced by a new one.

      Parameters

      • oldLibraryObj: Library

        The old Library object.

      • newLibraryObj: Library

        The new Library object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an old library object has been replaced by a new one.

      Parameters

      • oldLibraryObj: Library

        The old Library object.

      • newLibraryObj: Library

        The new Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a library object has been removed.

      Parameters

      • libraryObj: Library

        The Library object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a library object has been removed.

      Parameters

      • libraryObj: Library

        The Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the API's language has been changed.

      Parameters

      • abbr: string

        The new language's abbreviation value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the API's language has been changed.

      Parameters

      • abbr: string

        The new language's abbreviation value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the value of a variable has been changed.

      Parameters

      • addonObject: Addon

        The Addon object that the variable belongs to.

      • variableName: string

        The name of the variable whose value has been changeed.

      • oldValue: any

        The old value of the variable.

      • newValue: any

        The new value of the variable.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the value of a variable has been changed.

      Parameters

      • addonObject: Addon

        The Addon object that the variable belongs to.

      • variableName: string

        The name of the variable whose value has been changeed.

      • oldValue: any

        The old value of the variable.

      • newValue: any

        The new value of the variable.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player's synchronization status has changed.

      Parameters

      • playerId: number

        Id of the player whose synchronization status has changed.

      • value: boolean

        The new synchronization status.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player's synchronization status has changed.

      Parameters

      • playerId: number

        Id of the player whose synchronization status has changed.

      • value: boolean

        The new synchronization status.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after an "auto" event has been triggered to automatically move at least one, at most two players from spectators to teams.

      Parameters

      • playerId1: number

        Id of the first player affected by this event.

      • teamId1: number

        Id of the team which the first player was moved into.

      • playerId2: number | null

        Id of the second player affected by this event, or null if there was only one spectator when this event was triggered.

      • teamId2: number | null

        Id of the team which the second player was moved into, or null if there was only one spectator when this event was triggered.

      • byId: number

        Id of the player who has triggered the event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an "auto" event has been triggered to automatically move at least one, at most two players from spectators to teams.

      Parameters

      • playerId1: number

        Id of the first player affected by this event.

      • teamId1: number

        Id of the team which the first player was moved into.

      • playerId2: number | null

        Id of the second player affected by this event, or null if there was only one spectator when this event was triggered.

      • teamId2: number | null

        Id of the team which the second player was moved into, or null if there was only one spectator when this event was triggered.

      • byId: number

        Id of the player who has triggered the event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the score limit has been changed.

      Parameters

      • value: number

        The new score limit value.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the score limit has been changed.

      Parameters

      • value: number

        The new score limit value.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the time limit has been changed.

      Parameters

      • value: number

        The new time limit value.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the time limit has been changed.

      Parameters

      • value: number

        The new time limit value.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after room's overtime limit has been changed.

      Parameters

      • value: number

        The desired overtime limit of the game.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room's overtime limit has been changed.

      Parameters

      • value: number

        The desired overtime limit of the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the direction of an individual player was changed. room.state.directionActive must be true for this to work.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • value: number

        New direction value of the player.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the direction of an individual player was changed. room.state.directionActive must be true for this to work.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • value: number

        New direction value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player's admin rights have been given/taken.

      Parameters

      • id: number

        Id of the player whose admin rights have been given/taken.

      • isAdmin: boolean

        The new admin rights status of the player whose id is id.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player's admin rights have been given/taken.

      Parameters

      • id: number

        Id of the player whose admin rights have been given/taken.

      • isAdmin: boolean

        The new admin rights status of the player whose id is id.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player has changed his/her avatar.

      Parameters

      • id: number

        Id of the player who has changed his/her avatar.

      • value: string

        The new avatar value.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has changed his/her avatar.

      Parameters

      • id: number

        Id of the player who has changed his/her avatar.

      • value: string

        The new avatar value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player has been moved to a different team.

      Parameters

      • id: number

        Id of the player who has been moved to a different team.

      • teamId: number

        Id of the player's new team.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has been moved to a different team.

      Parameters

      • id: number

        Id of the player who has been moved to a different team.

      • teamId: number

        Id of the player's new team.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's current stadium has been changed.

      Parameters

      • stadium: IStadium

        The room's new Stadium object.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's current stadium has been changed.

      Parameters

      • stadium: IStadium

        The room's new Stadium object.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's teams have been locked/unlocked.

      Parameters

      • value: boolean

        The room's new teams lock value.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's teams have been locked/unlocked.

      Parameters

      • value: boolean

        The room's new teams lock value.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player object has been created. This callback can be used to define custom properties inside all player objects.

      Parameters

      • playerObj: Player

        The new Player object that has just been created.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player object has been created. This callback can be used to define custom properties inside all player objects.

      Parameters

      • playerObj: Player

        The new Player object that has just been created.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a disc object has been assigned to a player object.

      Parameters

      • playerObj: Player

        The new Player object that has just been assigned a disc object.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a disc object has been assigned to a player object.

      Parameters

      • playerObj: Player

        The new Player object that has just been assigned a disc object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a disc object has been removed from a player object.

      Parameters

      • playerObj: Player

        The Player object whose disc object has just been removed.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a disc object has been removed from a player object.

      Parameters

      • playerObj: Player

        The Player object whose disc object has just been removed.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player has joined the room.

      Parameters

      • playerObj: Player

        The data representation of the player that has just joined the room.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has joined the room.

      Parameters

      • playerObj: Player

        The data representation of the player that has just joined the room.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the game has been paused or resumed.

      Parameters

      • isPaused: boolean

        Whether the game has been paused or not.

      • byId: number

        Id of the player who has triggered this event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has been paused or resumed.

      Parameters

      • isPaused: boolean

        Whether the game has been paused or not.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a chat message has been received.

      Parameters

      • id: number

        Id of the player who has sent the chat message.

      • message: string

        The chat message.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a chat message has been received.

      Parameters

      • id: number

        Id of the player who has sent the chat message.

      • message: string

        The chat message.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player's input has been changed.

      Parameters

      • id: number

        Id of the player whose input has been changed.

      • value: number

        The new input value of the player.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player's input has been changed.

      Parameters

      • id: number

        Id of the player whose input has been changed.

      • value: number

        The new input value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player has activated or deactivated his/her chat indicator. This happens when a player focuses/loses focus on the chat input component in the website.

      Parameters

      • id: number

        Id of the player whose chat indicator has been activated/deactivated.

      • value: boolean

        Whether the chat indicator has been activated or not.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has activated or deactivated his/her chat indicator. This happens when a player focuses/loses focus on the chat input component in the website.

      Parameters

      • id: number

        Id of the player whose chat indicator has been activated/deactivated.

      • value: boolean

        Whether the chat indicator has been activated or not.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a player has left the room.

      Parameters

      • playerObj: Player

        The player who has left the room.

      • reason: string | null

        The reason of leaving the room. If null, the player has left by himself/herself.

      • isBanned: boolean

        Whether the player has been banned or not. If reason is null, this value is ignored.

      • byId: number

        Id of the player who has kicked/banned the player. If reason is null, this value is ignored.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has left the room.

      Parameters

      • playerObj: Player

        The player who has left the room.

      • reason: string | null

        The reason of leaving the room. If null, the player has left by himself/herself.

      • isBanned: boolean

        Whether the player has been banned or not. If reason is null, this value is ignored.

      • byId: number

        Id of the player who has kicked/banned the player. If reason is null, this value is ignored.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after a team's colors have been changed.

      Parameters

      • teamId: number

        The team whose colors have been changed.

      • value: TeamColors

        The new team colors value.

      • byId: number

        Id of the player who has changed the team colors.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a team's colors have been changed.

      Parameters

      • teamId: number

        The team whose colors have been changed.

      • value: TeamColors

        The new team colors value.

      • byId: number

        Id of the player who has changed the team colors.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the room's kick rate limit has been changed.

      Parameters

      • min: number

        The new min part of kick rate limit.

      • rate: number

        The new rate part of kick rate limit.

      • burst: number

        The new burst part of kick rate limit.

      • byId: number

        Id of the player who has changed the kick rate limit.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's kick rate limit has been changed.

      Parameters

      • min: number

        The new min part of kick rate limit.

      • rate: number

        The new rate part of kick rate limit.

      • burst: number

        The new burst part of kick rate limit.

      • byId: number

        Id of the player who has changed the kick rate limit.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the game has been started.

      Parameters

      • byId: number

        Id of the player who has started the game.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has been started.

      Parameters

      • byId: number

        Id of the player who has started the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just after the game has been stopped.

      Parameters

      • byId: number

        Id of the player who has stopped the game.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has been stopped.

      Parameters

      • byId: number

        Id of the player who has stopped the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns void

      void.

    • Called just before the player has joined the room. Using this callback, you may block all players or modify all players' name, flag and avatar properties just before they join the room.

      Parameters

      • playerId: number

        Id of the new player who is about to join the room.

      • name: string

        Name of the new player who is about to join the room.

      • flag: string

        Country code of the new player who is about to join the room.

      • avatar: string

        Avatar of the new player who is about to join the room.

      • conn: string

        Connection string of the new player who is about to join the room.

      • auth: string

        Auth string of the new player who is about to join the room.

      Returns
          | [
              [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
              customData: any,
          ]
          | Promise<
              [
                  [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
                  customData: any,
              ],
          >
          | null

      • null: Blocks the player from joining the room.
        • [[modifiedName: string, modifiedFlag: string, modifiedAvatar: string], customData: any]: Modifies the name, flag and avatar values.
        • Promise<[[modifiedName: string, modifiedFlag: string, modifiedAvatar: string], customData: any]>: Modifies the name, flag and avatar values after the promise might be resolved.
    • Called just before the player has joined the room. Using this callback, you may block all players or modify all players' name, flag and avatar properties just before they join the room.

      Parameters

      • playerId: number

        Id of the new player who is about to join the room.

      • name: string

        Name of the new player who is about to join the room.

      • flag: string

        Country code of the new player who is about to join the room.

      • avatar: string

        Avatar of the new player who is about to join the room.

      • conn: string

        Connection string of the new player who is about to join the room.

      • auth: string

        Auth string of the new player who is about to join the room.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns
          | [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]
          | Promise<
              [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
          >
          | null

      • null: Blocks the player from joining the room.
        • [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]: Modifies the name, flag and avatar values.
        • Promise<[modifiedName: string, modifiedFlag: string, modifiedAvatar: string]>: Modifies the name, flag and avatar values after the promise might be resolved.
    • If defined, runs for all players except host in a host room. Modifies the ping value of the player whose id is playerId. Host player's ping will not change using this callback. In order to change host player's ping, you need to modify room.hostPing value directly.

      Parameters

      • playerId: number

        Id of the current player.

      • ping: number

        Current ping value of the current player.

      Returns number

      The new ping value of the current player.

    • If defined, runs for all players except host in a host room. Modifies the ping value of the player whose id is playerId. Host player's ping will not change using this callback. In order to change host player's ping, you need to modify room.hostPing value directly.

      Parameters

      • playerId: number

        Id of the current player.

      • ping: number

        Current ping value of the current player.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns number

      The new ping value of the current player.

    • If defined, runs only for the current player in a client room and modifies its ping value.

      Parameters

      • ping: number

        Current ping value of the current player.

      Returns number

      The new ping value of the current player.

    • If defined, runs only for the current player in a client room and modifies its ping value.

      Parameters

      • ping: number

        Current ping value of the current player.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns number

      The new ping value of the current player.

    • If defined, runs for each message received from all clients in a host room, before they are processed and sent to all clients. This is the most important callback inside a host room; all permission logic should reside here. You are also allowed to freely modify the contents of all messages here.

      Parameters

      • type: OperationType

        Type of the received message. We have to look it up in the global OperationType object to understand what type of message it actually is.

      • msg: MooballEvent

        The original message object. We can directly modify all contents of this object here as we wish.

      • globalFrameNo: number

        The global frame no that host's physics engine is at, at the time that the message is received.

      • clientFrameNo: number

        The frame no that this client's physics engine is at, at the time that the message is received.

      Returns boolean

      • true: accept event.
        • false: block message from being processed.
        • throw exception: break the connection of the sender of this message.
    • If defined, runs for each message received from all clients in a host room, before they are processed and sent to all clients. This is the most important callback inside a host room; all permission logic should reside here. You are also allowed to freely modify the contents of all messages here.

      Parameters

      • type: OperationType

        Type of the received message. We have to look it up in the global OperationType object to understand what type of message it actually is.

      • msg: MooballEvent

        The original message object. We can directly modify all contents of this object here as we wish.

      • globalFrameNo: number

        The global frame no that host's physics engine is at, at the time that the message is received.

      • clientFrameNo: number

        The frame no that this client's physics engine is at, at the time that the message is received.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns boolean

      • true: accept event.
        • false: block message from being processed.
        • throw exception: break the connection of the sender of this message.
    • Called just after a custom event has been triggered.

      Parameters

      • type: number

        Any integer value to hold the type of the custom event.

      • data: object

        Any JSON object to store the properties of the custom event. This object is converted to a string and sent/received by Mooball's original event mechanism.

      • byId: number

        Id of the player who has triggered this custom event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a custom event has been triggered.

      Parameters

      • type: number

        Any integer value to hold the type of the custom event.

      • data: object

        Any JSON object to store the properties of the custom event. This object is converted to a string and sent/received by Mooball's original event mechanism.

      • byId: number

        Id of the player who has triggered this custom event.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns void

      void.

    • Called just after a binary custom event has been triggered.

      Parameters

      • type: number

        Any integer value to hold the type of the custom event.

      • data: Uint8Array

        Any Uint8Array to store the properties of the custom event. This object is directly sent/received by Mooball's original event mechanism.

      • byId: number

        Id of the player who has triggered this custom event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a binary custom event has been triggered.

      Parameters

      • type: number

        Any integer value to hold the type of the custom event.

      • data: Uint8Array

        Any Uint8Array to store the properties of the custom event. This object is directly sent/received by Mooball's original event mechanism.

      • byId: number

        Id of the player who has triggered this custom event.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns void

      void.

    • Called just after an identity event has been triggered.

      Parameters

      • id: number

        Id of the player whose identity data is desired to be changed.

      • data: object

        The identity data that should be received from the backend. It can be any JSON object.

      • byId: number

        Id of the player who has triggered this custom event.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an identity event has been triggered.

      Parameters

      • id: number

        Id of the player whose identity data is desired to be changed.

      • data: object

        The identity data that should be received from the backend. It can be any JSON object.

      • byId: number

        Id of the player who has triggered this custom event.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns void

      void.

    • The room link was received from moo-hoo.com. Called some time after a room is created successfully. Also called when your room stops sending signal to moo-hoo.com, and starts it again after some time. This can happen if your connection gets interrupted or the room somehow becomes unstable due to bugs.

      Parameters

      • link: string

        The room link that was just received.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after all bans have been cleared using room.clearBans().

      Parameters

      • OptionalcustomData: any

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ban of a player has been cleared using room.clearBan(id).

      Parameters

      • id: number

        Id of the player whose ban has just been cleared.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's recaptcha mode was changed using room.requireRecaptcha = on.

      Parameters

      • on: boolean

        The new value; whether to request recaptcha or not while joining the room.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just a little after the room's token was changed using room.token = value.

      Parameters

      • token: string

        The new token of the room.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an announcement was made by the room host.

      Parameters

      • msg: string

        The announcement message.

      • color: number

        The color of the announcement message. Range: -1 <= color < 16777216.

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

        The style of the announcement message. Must be one of the following:

        • 0: use document's default font style.
        • 1: fontWeight = "bold".
        • 2: fontStyle = "italic".
        • 3: fontSize = "12px".
        • 4: fontWeight = "bold", fontSize = "12px".
        • 5: fontWeight = "italic", fontSize = "12px".
      • sound: number

        The sound of the announcement message. Must be one of the following:

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

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has changed his/her headless avatar.

      Parameters

      • id: number

        Id of the player who triggered this event.

      • value: string

        The new headless avatar value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the order of players have been changed.

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

      Parameters

      • idList: number[]

        The ids of players that were 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.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a disc's properties have been modified.

      Parameters

      • id: number

        The id of player or disc whose disc properties have changed.

      • type: number

        The type of object. Must be one of the following:

        • 0: disc.
        • 1: player.
      • data1: number[]

        Must consist of the following properties of the disc in the same order: [x, y, xspeed, yspeed, xgravity, ygravity, radius, bCoeff, invMass, damping].

      • data2: number[]

        Must consist of the following properties of the disc in the same order: [color, cMask, cGroup].

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ping values for all players have been updated.

      Parameters

      • array: number[]

        The updated list of ping values for each player in the same order as the player list in the current room's RoomState object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's properties have been changed.

      Parameters

      • props: UpdatedRoomProps

        The properties that were changed. The current structure of this object is as follows:

        props = {
        name: string | null,
        password: string | null,
        fakePassword: boolean | null,
        geo: GeoLocation | null,
        playerCount: int | null,
        maxPlayerCount: int | null
        }

        Note that only the changed keys will show up in props.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room.runDefaultGameLogic has changed.

      Parameters

      • value: boolean

        Whether the default game logic is active(1) or passive(0).

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an announcement has been sent using the improved announcement api.

      Parameters

      • msg: string

        The announcement message. ( max length = 1000 )

      • OptionalcssVar: string

        The cssVar of the announcement message.

      • Optionalsound: string

        The sound of the announcement message.

      • OptionaltargetId: number

        Id of the player who will receive this announcement. If this value is null, the announcement is sent to everyone.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current skin(textureId) of a player has been updated.

      Parameters

      • id: number

        Id of the player whose skin will be modified.

      • skin: Texture | null

        New skin value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the cssVar attribute of a player has been changed.

      Parameters

      • id: number

        Id of the player whose cssVar will be modified.

      • cssVar: string | null

        New cssVar value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a new stadium object has been added.

      Parameters

      • type: number

        Type of the object to be added.

      • value: object

        An object that is supposed to contain all parameters required to add that type of object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an existing stadium object has been updated.

      Parameters

      • type: number

        Type of the object to be updated.

      • id: number

        Id of the object to be updated.

      • value: object

        An object that is supposed to contain all parameters required to update that type of object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an existing stadium object has been removed.

      Parameters

      • type: number

        Type of the object to be removed.

      • id: number

        Id of the object to be removed.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game clock has been paused/resumed.

      Parameters

      • value: number

        Whether the game will be paused(1) or resumed(0).

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room.directionActive has been changed.

      Parameters

      • value: number

        New directionActive value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the energy of an individual player has been altered manually.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • data: number[]

        New values. Order of values is supposed to be: [energy, kEnergyGain, kEnergyDrain]. null means no change for each value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after game input controls have been modified.

      Parameters

      • type: number

        Type of the operation. (0: add, 1: remove)

      • params: any[]

        Parameters for the specific operation.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current contents of a css variable has been altered.

      Parameters

      • name: string

        Name of the css variable..

      • value: string

        New value of the css variable.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a custom sound has been played.

      Parameters

      • soundName: string

        Name of the sound to be played.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the name of the room has been changed.

      Parameters

      • name: string

        The new room name.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current elapsed time has been changed.

      Parameters

      • value: number

        New elapsed time value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current max goal ticks has been changed.

      Parameters

      • value: number

        New max goal ticks value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current max pause ticks has been changed.

      Parameters

      • value: number

        New max pause ticks value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current max end ticks has been changed.

      Parameters

      • value: number

        New max end ticks value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the current team scores has been changed.

      Parameters

      • teamId: number

        Id of the team whose score is desired to be changed.

      • value: number

        New score for the team.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ping value of the current player has been calculated.

      Parameters

      • instantPing: number

        the instant ping value at that moment

      • averagePing: number

        the calculated average ping value in a period of time

      • maxPing: number

        the calculated maximum ping value in a period of time

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the ball has been kicked.

      Parameters

      • playerId: number

        Id of the player who kicked the ball.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a goal has been scored.

      Parameters

      • teamId: number

        Id of the team that scored the goal.

      • goalId: number

        Id of the goal object that the ball went in.

      • goal: Goal

        The goal object that the ball went in.

      • ballDiscId: number

        Id of the ball disc that caused the goal.

      • ballDisc: Disc

        The ball disc that caused the goal.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has ended.

      Parameters

      • winningTeamId: number

        Id of the team that won the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a game tick has occurred. This will run a lot of times per second. Be careful not to make too many calculations here, otherwise the game might slow down.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a kick-off event has occurred.

      Parameters

      • OptionalcustomData: any

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has ended by timeout.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the player positions have been reset. This event happens just after a new game has been started or a goal has been scored. The player positions are reset to their corresponding spawn points defined in the current room's Stadium object.

      Parameters

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a collision has happened between two discs.

      Parameters

      • discId1: number

        Id of the first collided disc.

      • discPlayerId1: number

        The player's id that the first disc belongs to. If the disc is not a player's disc, this value will be null.

      • discId2: number

        Id of the second collided disc.

      • discPlayerId2: number

        The player's id that the second disc belongs to. If the disc is not a player's disc, this value will be null.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a collision has happened between a disc and a segment.

      Parameters

      • discId: number

        Id of the collided disc.

      • discPlayerId: number

        The player's id that the disc belongs to. If the disc is not a player's disc, this value will be null.

      • segmentId: number

        Id of the collided segment.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a collision has happened between a disc and a plane.

      Parameters

      • discId: number

        Id of the collided disc.

      • discPlayerId: number

        The player's id that the disc belongs to. If the disc is not a player's disc, this value will be null.

      • planeId: number

        Id of the collided plane.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the local ping handicap value has been changed.

      Parameters

      • value: number

        The new ping handicap value in milliseconds. Range: 0 <= value <= 300.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room recording has been started or stopped.

      Parameters

      • value: true | ArrayBuffer

        If true, recording has just been started,

        • Else, the recording has just stopped and the recorded data is returned in value as an ArrayBuffer. You might want to write the contents to a version-3 replay file.
      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin has been activated or deactivated.

      Parameters

      • plugin: Plugin

        The plugin which was activated or deactivated. This property stores the current activation status of the plugin: plugin.active.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's config object has been replaced by a new one.

      Parameters

      • oldRoomConfigObj: RoomConfig

        The old RoomConfig object.

      • newRoomConfigObj: RoomConfig

        The new RoomConfig object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's renderer object has been replaced by a new one.

      Parameters

      • oldRendererObj: Renderer

        The old Renderer object.

      • newRendererObj: Renderer

        The new Renderer object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin object has been added.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin object has been moved.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an old plugin object has been replaced by a new one.

      Parameters

      • oldPluginObj: Plugin

        The old Plugin object.

      • newPluginObj: Plugin

        The new Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a plugin object has been removed.

      Parameters

      • pluginObj: Plugin

        The Plugin object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a library object has been added.

      Parameters

      • libraryObj: Library

        The Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a library object has been moved.

      Parameters

      • libraryObj: Library

        The Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an old library object has been replaced by a new one.

      Parameters

      • oldLibraryObj: Library

        The old Library object.

      • newLibraryObj: Library

        The new Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a library object has been removed.

      Parameters

      • libraryObj: Library

        The Library object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the API's language has been changed.

      Parameters

      • abbr: string

        The new language's abbreviation value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the value of a variable has been changed.

      Parameters

      • addonObject: Addon

        The Addon object that the variable belongs to.

      • variableName: string

        The name of the variable whose value has been changeed.

      • oldValue: any

        The old value of the variable.

      • newValue: any

        The new value of the variable.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player's synchronization status has changed.

      Parameters

      • playerId: number

        Id of the player whose synchronization status has changed.

      • value: boolean

        The new synchronization status.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an "auto" event has been triggered to automatically move at least one, at most two players from spectators to teams.

      Parameters

      • playerId1: number

        Id of the first player affected by this event.

      • teamId1: number

        Id of the team which the first player was moved into.

      • playerId2: number | null

        Id of the second player affected by this event, or null if there was only one spectator when this event was triggered.

      • teamId2: number | null

        Id of the team which the second player was moved into, or null if there was only one spectator when this event was triggered.

      • byId: number

        Id of the player who has triggered the event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the score limit has been changed.

      Parameters

      • value: number

        The new score limit value.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the time limit has been changed.

      Parameters

      • value: number

        The new time limit value.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after room's overtime limit has been changed.

      Parameters

      • value: number

        The desired overtime limit of the game.

      • OptionalcustomData: any

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the direction of an individual player was changed. room.state.directionActive must be true for this to work.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • value: number

        New direction value of the player.

      • OptionalcustomData: any

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player's admin rights have been given/taken.

      Parameters

      • id: number

        Id of the player whose admin rights have been given/taken.

      • isAdmin: boolean

        The new admin rights status of the player whose id is id.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has changed his/her avatar.

      Parameters

      • id: number

        Id of the player who has changed his/her avatar.

      • value: string

        The new avatar value.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has been moved to a different team.

      Parameters

      • id: number

        Id of the player who has been moved to a different team.

      • teamId: number

        Id of the player's new team.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's current stadium has been changed.

      Parameters

      • stadium: IStadium

        The room's new Stadium object.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's teams have been locked/unlocked.

      Parameters

      • value: boolean

        The room's new teams lock value.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player object has been created. This callback can be used to define custom properties inside all player objects.

      Parameters

      • playerObj: Player

        The new Player object that has just been created.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a disc object has been assigned to a player object.

      Parameters

      • playerObj: Player

        The new Player object that has just been assigned a disc object.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a disc object has been removed from a player object.

      Parameters

      • playerObj: Player

        The Player object whose disc object has just been removed.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has joined the room.

      Parameters

      • playerObj: Player

        The data representation of the player that has just joined the room.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has been paused or resumed.

      Parameters

      • isPaused: boolean

        Whether the game has been paused or not.

      • byId: number

        Id of the player who has triggered this event.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a chat message has been received.

      Parameters

      • id: number

        Id of the player who has sent the chat message.

      • message: string

        The chat message.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player's input has been changed.

      Parameters

      • id: number

        Id of the player whose input has been changed.

      • value: number

        The new input value of the player.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has activated or deactivated his/her chat indicator. This happens when a player focuses/loses focus on the chat input component in the website.

      Parameters

      • id: number

        Id of the player whose chat indicator has been activated/deactivated.

      • value: boolean

        Whether the chat indicator has been activated or not.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a player has left the room.

      Parameters

      • playerObj: Player

        The player who has left the room.

      • reason: string | null

        The reason of leaving the room. If null, the player has left by himself/herself.

      • isBanned: boolean

        Whether the player has been banned or not. If reason is null, this value is ignored.

      • byId: number

        Id of the player who has kicked/banned the player. If reason is null, this value is ignored.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a team's colors have been changed.

      Parameters

      • teamId: number

        The team that colors have been changed.

      • value: TeamColors

        The new team colors value.

      • byId: number

        Id of the player who has changed the team colors.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the room's kick rate limit has been changed.

      Parameters

      • min: number

        The new min part of kick rate limit.

      • rate: number

        The new rate part of kick rate limit.

      • burst: number

        The new burst part of kick rate limit.

      • byId: number

        Id of the player who has changed the kick rate limit.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has been started.

      Parameters

      • byId: number

        Id of the player who has started the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after the game has been stopped.

      Parameters

      • byId: number

        Id of the player who has stopped the game.

      • OptionalcustomData: any

        the custom data that was returned from the previous callback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just before the player has joined the room. Using this callback, you may block all players or modify all players' name, flag and avatar properties just before they join the room.

      Parameters

      • playerId: number

        Id of the new player who is about to join the room.

      • name: string

        Name of the new player who is about to join the room.

      • flag: string

        Country code of the new player who is about to join the room.

      • avatar: string

        Avatar of the new player who is about to join the room.

      • conn: string

        Connection string of the new player who is about to join the room.

      • auth: string

        Auth string of the new player who is about to join the room.

      • OptionalcustomData: any

      Returns
          | [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]
          | Promise<
              [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
          >
          | null

      • null: Blocks the player from joining the room.
        • [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]: Modifies the name, flag and avatar values.
        • Promise<[modifiedName: string, modifiedFlag: string, modifiedAvatar: string]>: Modifies the name, flag and avatar values after the promise might be resolved.
      (sync)
      this.modifyPlayerData = function(playerId, name, flag, avatar, conn, auth){
      if (name=="abc")
      return null; // block anyone trying to join the room with name "abc", before he can join the room.
      return [
      "[" + playerId + "] " + name, // prefix everyone's name with [playerId]
      "tr", // set everyone's flag to tr
      avatar // do not change avatars
      ];
      };
      (async)
      this.modifyPlayerData = async function(playerId, name, flag, avatar, conn, auth){
      // connect to whatever database you want
      var dbPlayerSpecs = await db.getPlayerSpecs(conn, auth);
      if (!dbPlayerSpecs)
      return null; // blocked.
      return [
      "[" + playerId + "] {" + dbPlayerSpecs.name + "}" + name, // prefix everyone's name with [playerId] and then player's name in the database.
      dbPlayerSpecs.flag, // always use player's flag in the database.
      dbPlayerSpecs.avatar // always use player's avatar in the database.
      ];
      };
    • If defined, runs for all players except host in a host room. Modifies the ping value of the player whose id is playerId. Host player's ping will not change using this callback. In order to change host player's ping, you need to modify room.hostPing value directly.

      Parameters

      • playerId: number

        Id of the current player.

      • ping: number

        Current ping value of the current player.

      • OptionalcustomData: any

      Returns number

      The new ping value of the current player.

      this.modifyPlayerPing = function(playerId, ping){
      return 100000 + ping*ping*ping; // set everybody(except host)'s ping to 100000 + its original value cubed.
      };
    • If defined, runs only for the current player in a client room and modifies its ping value.

      Parameters

      • ping: number

        Current ping value of the current player.

      • OptionalcustomData: any

      Returns number

      The new ping value of the current player.

      this.modifyClientPing = (ping)=>(100000+ping**3); // set your ping to 100000 + its original value cubed;
      
    • If defined, runs for each message received from all clients in a host room, before they are processed and sent to all clients. This is the most important callback inside a host room; all permission logic should reside here. You are also allowed to freely modify the contents of all messages here.

      Parameters

      • type: OperationType

        Type of the received message. We have to look it up in the global OperationType object to understand what type of message it actually is.

      • msg: MooballEvent

        The original message object. We can directly modify all contents of this object here as we wish.

      • globalFrameNo: number

        The global frame no that host's physics engine is at, at the time that the message is received.

      • clientFrameNo: number

        The frame no that this client's physics engine is at, at the time that the message is received.

      • OptionalcustomData: any

      Returns boolean

      • true: accept event.
        • false: block message from being processed.
        • throw exception: break the connection of the sender of this message.
      this.onOperationReceived = function(type, msg, globalFrameNo, clientFrameNo, customData){
      switch (type){
      case OperationType.KickBanPlayer: { // if someone is leaving or being kicked/banned by someone else
      var reason = msg.reason; // get the reason. this is null if the player is leaving by himself/herself.
      if (reason!=null && playerId!=0) // if any player sends a kick/ban event message other than room host
      return false; // block the event message
      break;
      }
      }
      return true;
      };
    • Called just after a custom event has been triggered.

      Parameters

      • type: number

        Any integer value to hold the type of the custom event.

      • data: object

        Any JSON object to store the properties of the custom event. This object is converted to a string and sent/received by Mooball's original event mechanism.

      • byId: number

        Id of the player who has triggered this custom event.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after a binary custom event has been triggered.

      Parameters

      • type: number

        Any integer value to hold the type of the custom event.

      • data: Uint8Array

        Any Uint8Array to store the properties of the custom event. This object is directly sent/received by Mooball's original event mechanism.

      • byId: number

        Id of the player who has triggered this custom event.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns any

      void or a custom data to pass to the next callback.

    • Called just after an identity event has been triggered.

      Parameters

      • id: number

        Id of the player whose identity data is desired to be changed.

      • data: object

        The identity data that should be received from the backend. It can be any JSON object.

      • byId: number

        Id of the player who has triggered this custom event.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns any

      void or a custom data to pass to the next callback.

    • Returns all current game objects in hbs/json format. Note that the values written here are the currently active values, not the static and stored ones.

      Returns object

      A json object that represents all objects in the current stadium.

    • Creates a vertex object in memory and returns it.

      Parameters

      • data: CreateVertexParams

        An object with the following structure:

        • x: number: The x component of the position of the new vertex.
        • y: number: The y component of the position of the new vertex.
        • bCoef: number | null: The bouncing coefficient of the new vertex.
        • cMask: string[] | null: The collision mask of the new vertex.
        • cGroup: string[] | null: The collision group of the new vertex.

      Returns Vertex

      A Vertex object.

    • Creates a segment object in memory using vertex indices and returns it. The vertices must exist at the given indices in the vertices array of the current room.

      Parameters

      • data: CreateSegmentParams

        An object with the following structure:

        • v0: int: Index of the first vertex of the new segment.
        • v1: int: Index of the second vertex of the new segment.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: Color of the new segment.
        • bias: number | null: Bias of the new segment.
        • curve: number | null: Curve of the new segment. (unit: angles)
        • curveF: number | null: Curve of the new segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.
        • vis: boolean | null: Visibility of the new segment.
        • bCoef: number | null: Bouncing coefficient of the new segment.
        • cMask: string[] | null: Collision mask of the new segment.
        • cGroup: string[] | null: Collision group of the new segment.

      Returns Segment

      A Segment object.

    • Creates a segment object in memory using vertex objects and returns it.

      Parameters

      • data: CreateSegmentFromObjParams

        An object with the following structure:

        • v0: Vertex: First vertex of the new segment.
        • v1: Vertex: Second vertex of the new segment.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: Color of the new segment.
        • bias: number | null: Bias of the new segment.
        • curve: number | null: Curve of the new segment. (unit: angles)
        • curveF: number | null: Curve of the new segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.
        • vis: boolean | null: Visibility of the new segment.
        • bCoef: number | null: Bouncing coefficient of the new segment.
        • cMask: string[] | null: Collision mask of the new segment.
        • cGroup: string[] | null: Collision group of the new segment.

      Returns Segment

      A Segment object.

    • Creates a goal object in memory and returns it.

      Parameters

      • data: CreateGoalParams

        An object with the following structure:

        • p0: [x: number, y: number]: The starting point of the new goal object.
        • p1: [x: number, y: number]: The ending point of the new goal object.
        • team: "red" | "blue": The team of the new goal object.

      Returns Goal

      A Goal object.

    • Creates a plane object in memory and returns it.

      Parameters

      • data: CreatePlaneParams

        An object with the following structure:

        • normal: [x: number, y: number]: The normal of the new plane. This value is normalized automatically.
        • dist: number: The distance of the new plane to the origin(0,0).
        • bCoef: number | null: The bouncing coefficient of the new plane.
        • cMask: string[] | null: The collision mask of the new plane.
        • cGroup: string[] | null: The collision group of the new plane.

      Returns Plane

      A Plane object.

    • Creates a disc object in memory and returns it.

      Parameters

      • data: CreateDiscParams

        An object with the following structure:

        • pos: [x: number, y: number]: The position of the new disc.
        • speed: [x: number, y: number] | null: The speed of the new disc.
        • gravity: [x: number, y: number] | null: The gravity (acceleration) of the new disc.
        • radius: number: The radius of the new disc.
        • invMass: number | null: The inverse mass of the new disc.
        • damping: number | null: The damping of the new disc.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new disc.
        • bCoef: number | null: The bouncing coefficient of the new disc.
        • cMask: string[] | null: The collision mask of the new disc.
        • cGroup: string[] | null: The collision group of the new disc.

      Returns Disc

      A Disc object.

    • Creates a joint object in memory using disc indices and returns it.

      Parameters

      • data: CreateJointParams

        An object with the following structure:

        • d0: int: The first disc index of the new joint.
        • d1: int: The second disc index of the new joint.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new joint.
        • strength: "rigid" | number | null: The strengh of the new joint.
        • length: number | [min: number, max: number] | null: The length of the new joint.

      Returns Joint

      A Joint object.

    • Creates a joint object in memory using disc objects and returns it.

      Parameters

      • data: CreateJointFromObjParams

        An object with the following structure:

        • d0: Disc: The first disc of the new joint.
        • d1: Disc: The second disc of the new joint.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new joint.
        • strength: "rigid" | number | null: The strength of the new joint.
        • length: number | [min: number, max: number] | null: The length of the new joint.

      Returns Joint

      A Joint object.

    • Creates a vertex object and adds it to the current stadium.

      Parameters

      • data: AddVertexParams

        An object with the following structure:

        • x: number: The x component of the position of the new vertex.
        • y: number: The y component of the position of the new vertex.
        • bCoef: number | null: The bouncing coefficient of the new vertex.
        • cMask: string[] | null: The collision mask of the new vertex.
        • cGroup: string[] | null: The collision group of the new vertex.

      Returns void

      void.

    • Creates a segment object using vertex indices and adds it to the current stadium. The vertices must exist at the given indices in the vertices array of the current room.

      Parameters

      • data: AddSegmentParams

        An object with the following structure:

        • v0: int: Index of the first vertex of the new segment.
        • v1: int: Index of the second vertex of the new segment.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: Color of the new segment.
        • bias: number | null: Bias of the new segment.
        • curve: number | null: Curve of the new segment. (unit: angles)
        • curveF: number | null: Curve of the new segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.
        • vis: boolean | null: Visibility of the new segment.
        • bCoef: number | null: Bouncing coefficient of the new segment.
        • cMask: string[] | null: Collision mask of the new segment.
        • cGroup: string[] | null: Collision group of the new segment.

      Returns void

      void.

    • Creates a goal object and adds it to the current stadium.

      Parameters

      • data: AddGoalParams

        An object with the following structure:

        • p0: [x: number, y: number]: The starting point of the new goal object.
        • p1: [x: number, y: number]: The ending point of the new goal object.
        • team: "red" | "blue": The team of the new goal object.

      Returns void

      void.

    • Creates a plane object and adds it to the current stadium.

      Parameters

      • data: AddPlaneParams

        An object with the following structure:

        • normal: [x: number, y: number]: The normal of the new plane. This value is normalized automatically.
        • dist: number: The distance of the new plane to the origin(0,0).
        • bCoef: number | null: The bouncing coefficient of the new plane.
        • cMask: string[] | null: The collision mask of the new plane.
        • cGroup: string[] | null: The collision group of the new plane.

      Returns void

      void.

    • Creates a disc object and adds it to the current stadium.

      Parameters

      • data: AddDiscParams

        An object with the following structure:

        • pos: [x: number, y: number]: The position of the new disc.
        • speed: [x: number, y: number] | null: The speed of the new disc.
        • gravity: [x: number, y: number] | null: The gravity (acceleration) of the new disc.
        • radius: number: The radius of the new disc.
        • invMass: number | null: The inverse mass of the new disc.
        • damping: number | null: The damping of the new disc.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new disc.
        • bCoef: number | null: The bouncing coefficient of the new disc.
        • cMask: string[] | null: The collision mask of the new disc.
        • cGroup: string[] | null: The collision group of the new disc.

      Returns void

      void.

    • Creates a joint object and adds it to the current stadium.

      Parameters

      • data: AddJointParams

        An object with the following structure:

        • d0: int: The first disc index of the new joint.
        • d1: int: The second disc index of the new joint.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The color of the new joint.
        • strength: "rigid" | number | null: The strengh of the new joint.
        • length: number | [min: number, max: number] | null: The length of the new joint.

      Returns void

      void.

    • Adds a spawn point with given coordinate to the given team in the current stadium.

      Parameters

      • data: AddSpawnPointParams

        An object with the following structure:

        • x: number: The x coordinate of the new spawn point.
        • y: number: The y coordinate of the new spawn point.
        • team: "red" | "blue": The team of the new spawn point.

      Returns void

      void.

    • Adds a player with given properties to the current stadium.

      Parameters

      • data: AddPlayerParams

        An object with the following structure:

        • id: int: The id the new player. Already existing ids should not be used. 0 < id < 65535.
        • name: string: The name of the new player.
        • avatar: string: The avatar of the new player.
        • flag: string: The country code of the new player.
        • team: "spec" | "red" | "blue": The team of the new player. If this is "spec", the keys after this are ignored. Otherwise, player is moved to the specified team, a player disc is automatically generated and the below values are applied to the new disc.
        • pos: [x: number, y: number] | null: The position of the new player. Team must not be "spec".
        • speed: [x: number, y: number] | null: The speed of the new player. Team must not be "spec".
        • gravity: [x: number, y: number] | null: The gravity (acceleration) of the new player. Team must not be "spec".
        • radius: number | null: The radius of the new player. Team must not be "spec".
        • invMass: number | null: The inverse mass of the new player. Team must not be "spec".
        • damping: number | null: The damping of the new player. Team must not be "spec".
        • bCoef: number | null: The bouncing coefficient of the new player. Team must not be "spec".
        • cMask: string[] | null: The collision mask of the new player. Team must not be "spec".
        • cGroup: string[] | null: The collision group of the new player. Team must not be "spec".

      Returns void

      void.

    • Returns the indices of vertices that form a segment.

      Parameters

      • obj: Segment

        The segment that contain the vertices whose indices we are trying to find.

      Returns number[]

      An array in this format: [index1: int, index2: int]. index1 and index2 are the indices of the 1st and 2nd vertices of the queried segment.

    • Returns the indices of vertices that form a segment.

      Parameters

      • idx: number

        The index of the segment that contain the vertices whose indices we are trying to find.

      Returns number[] | null

      An array in this format: [index1: int, index2: int]. index1 and index2 are the indices of the 1st and 2nd vertices of the queried segment. Returns null if the segment does not exist.

    • Updates the idxth vertex's only the given values.

      Parameters

      • idx: number

        Index of the vertex that is desired to be updated.

      • data: UpdateVertexParams

        An object with the following structure:

        • x: number | null: The new x coordinate of the vertex.
        • y: number | null: The new y coordinate of the vertex.
        • bCoef: number | null: The new bouncing coefficient of the vertex.
        • cMask: string[] | null: The new collision mask of the vertex.
        • cGroup: string[] | null: The new collision group of the vertex.

      Returns void

      void.

    • Updates the idxth segment's only the given values.

      Parameters

      • idx: number

        Index of the segment that is desired to be updated.

      • data: UpdateSegmentParams

        An object with the following structure:

        • v0: int | null: The new first vertex index of the segment.
        • v1: int | null: The new second vertex index of the segment.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the segment.
        • bias: number | null: The new bias of the segment.
        • curve: number | null: The new curve of the segment. (unit: degrees)
        • curveF: number | null: The new curve of the segment. (unit: radians) While modifying this, the engine does not update some values. Only use this if you know what you are doing.
        • vis: boolean | null: The new visibility of the segment.
        • bCoef: number | null: The new bouncing coefficient of the segment.
        • cMask: string[] | null: The new collision mask of the segment.
        • cGroup: string[] | null: The new collision group of the segment.

      Returns void

      void.

    • Updates the idxth goal's only the given values.

      Parameters

      • idx: number

        Index of the goal that is desired to be updated.

      • data: UpdateGoalParams

        An object with the following structure:

        • p0: [x: number, y: number] | null: The new first point of the goal.
        • p1: [x: number, y: number] | null: The new second point of the goal.
        • team: "red" | "blue" | null: The new team of the goal.

      Returns void

      void.

    • Updates the idxth plane's only the given values.

      Parameters

      • idx: number

        Index of the plane that is desired to be updated.

      • data: UpdatePlaneParams

        An object with the following structure:

        • normal: [x: number, y: number] | null: The new normal of the plane. This value is normalized automatically.
        • dist: number | null: The new distance of the plane to the origin. (0, 0)
        • bCoef: number | null: The new bouncing coefficient of the plane.
        • cMask: string[] | null: The new collision mask of the plane.
        • cGroup: string[] | null: The new collision group of the plane.

      Returns void

      void.

    • Updates the idxth disc's only the given values.

      Parameters

      • idx: number

        Index of the disc that is desired to be updated.

      • data: UpdateDiscParams

        An object with the following structure:

        • pos: [x: number, y: number] | null: The new position of the disc.
        • speed: [x: number, y: number] | null: The new speed of the disc.
        • gravity: [x: number, y: number] | null: The new gravity (acceleration) of the disc.
        • radius: number | null: The new radius of the disc.
        • invMass: number | null: The new inverse mass of the disc.
        • damping: number | null: The new damping of the disc.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the disc.
        • bCoef: number | null: The new bouncing coefficient of the disc.
        • cMask: string[] | null: The new collision mask of the disc.
        • cGroup: string[] | null: The new collision group of the disc.

      Returns void

      void.

    • Updates the given disc object(discObj)'s only the given values.

      Parameters

      • discObj: Disc

        The disc that is desired to be updated.

      • data: UpdateDiscObjParams

        An object with the following structure:

        • pos: [x: number, y: number] | null: The new position of the disc.
        • speed: [x: number, y: number] | null: The new speed of the disc.
        • gravity: [x: number, y: number] | null: The new gravity (acceleration) of the disc.
        • radius: number | null: The new radius of the disc.
        • invMass: number | null: The new inverse mass of the disc.
        • damping: number | null: The new damping of the disc.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the disc.
        • bCoef: number | null: The new bouncing coefficient of the disc.
        • cMask: string[] | null: The new collision mask of the disc.
        • cGroup: string[] | null: The new collision group of the disc.

      Returns void

      void.

    • Updates the idxth joint's only the given values.

      Parameters

      • idx: number

        Index of the joint that is desired to be updated.

      • data: UpdateJointParams

        An object with the following structure:

        • d0: int | null: The new first disc index of the joint.
        • d1: int | null: The new second disc index of the joint.
        • color: "transparent" | string | [r: int, g: int, b: int] | null: The new color of the joint.
        • strength: "rigid" | number | null: The new strength of the joint.
        • length: number | [min: number, max: number] | null: The new length of the joint.

      Returns void

      void.

    • Updates the idxth spawn point in team(team) using only the given values.

      Parameters

      • idx: number

        Index of the spawn point that is desired to be updated.

      • team: UnparsedTeam2

        Current team of the spawn point that is desired to be updated.

      • data: UpdateSpawnPointParams

        An object with the following structure:

        • x: number | null: The new x coordinate of the spawn point.
        • y: number | null: The new y coordinate of the spawn point.
        • team: "red" | "blue" | null: The new team of the spawn point.

      Returns void

      void.

    • Updates the player(playerId)'s only the given values.

      Parameters

      • playerId: number

        Id of the player that is desired to be updated.

      • data: UpdatePlayerParams

        An object with the following structure:

        • name: string | null: The new name of the player.
        • avatar: string | null: The new avatar of the player.
        • flag: string | null: The new flag of the player.
        • team: "spec" | "red" | "blue" | null: The new team of the player.
        • pos: [x: number, y: number] | null: The new position of the player.
        • speed: [x: number, y: number] | null: The new speed of the player.
        • gravity: [x: number, y: number] | null: The new gravity (acceleration) of the player.
        • radius: number | null: The new radius of the player.
        • invMass: number | null: The new inverse mass of the player.
        • damping: number | null: The new damping of the player.
        • bCoef: number | null: The new bouncing coefficient of the player.
        • cMask: string[] | null: The new collision mask of the player.
        • cGroup: string[] | null: The new collision group of the player.

      Returns void

      void.

    • Removes a vertex from the current room.

      Parameters

      • idx: number

        Index of the vertex to remove.

      Returns void

      void.

    • Removes a segment from the current room.

      Parameters

      • idx: number

        Index of the segment to remove.

      Returns void

      void.

    • Removes a goal from the current room.

      Parameters

      • idx: number

        Index of the goal to remove.

      Returns void

      void.

    • Removes a plane from the current room.

      Parameters

      • idx: number

        Index of the plane to remove.

      Returns void

      void.

    • Removes a disc from the current room.

      Parameters

      • idx: number

        Index of the disc to remove.

      Returns void

      void.

    • Removes a joint from the current room.

      Parameters

      • idx: number

        Index of the joint to remove.

      Returns void

      void.

    • Removes a spawn point from the current room.

      Parameters

      • idx: number

        Index of the spawn point to remove.

      • team: UnparsedTeam2

        The team that the spawn point belongs to.

      Returns void

      void.

    • Removes a player from the current room.

      Parameters

      • playerId: number

        Id of the player to remove.

      Returns void

      void.

    • Updates the current stadium's only the given player physics values.

      Parameters

      • data: UpdateStadiumPlayerPhysicsParams

        An object with the following structure:

        • radius: number | null: The new radius value of the player physics of the current stadium.
        • gravity: [x: number, y: number] | null: The new gravity (acceleration) value of the player physics of the current stadium.
        • invMass: number | null: The new inverse mass value of the player physics of the current stadium.
        • bCoef: number | null: The new bouncing coefficient value of the player physics of the current stadium.
        • cGroup: string[] | null: The new collision group value of the player physics of the current stadium.
        • damping: number | null: The new damping value of the player physics of the current stadium.
        • kickingDamping: number | null: The new kicking damping value of the player physics of the current stadium.
        • acceleration: number | null: The new acceleration value of the player physics of the current stadium.
        • kickingAcceleration: number | null: The new kickingAcceleration value of the player physics of the current stadium.
        • kickStrength: number | null: The new kick strength value of the player physics of the current stadium.
        • kickback: number | null: The new kick back value of the player physics of the current stadium.

      Returns void

      void.

    • Updates the current stadium's only the given background values.

      Parameters

      • data: UpdateStadiumBgParams

        An object with the following structure:

        • type: 0 | 1 | 2 | null: The new background type of the current stadium. (0: "none", 1: "grass", 2: "hockey")
        • width: number | null: The new background width of the current stadium.
        • height: number | null: The new background height of the current stadium.
        • kickOffRadius: number | null: The new kick-off radius of the current stadium.
        • cornerRadius: number | null: The new background corner radius of the current stadium.
        • color: "transparent" | string | [r: number, g: number, b: number] | null: The new background color of the current stadium.
        • goalLine: number | null: The new goal line distance of the current stadium.

      Returns void

      void.

    • Updates the current stadium's only the given general values.

      Parameters

      • data: UpdateStadiumGeneralParams

        An object with the following structure:

        • name: string | null: The new name of the current stadium.
        • width: number | null: The new width of the current stadium.
        • height: number | null: The new height of the current stadium.
        • maxViewWidth: number | null: The new max view width of the current stadium.
        • cameraFollow: 0 | 1 | null: The new camera follow value of the current stadium. (0: "", 1: "player")
        • spawnDistance: number | null: The new spawn distance value of the current stadium.
        • kickOffReset: boolean | null: The new kick-off reset value of the current stadium. true: "full", false: "partial"
        • canBeStored: boolean | null: The new can-be-stored value of the current stadium.

      Returns void

      void.

    • Sets the player's current direction. room.state.directionActive must be true for this to work.

      Parameters

      • value: number

        New direction value of the current player.

      Returns void

      void.

    • Sets whether to use default game logic or not.

      Parameters

      • value: boolean

        Whether the default game logic is active(1) or passive(0).

      Returns void

      void.

    • Sends an announcement using the improved announcement api.

      Parameters

      • msg: string

        The announcement message. ( max length = 1000 )

      • OptionalcssVar: string

        The cssVar of the announcement message.

      • Optionalsound: string

        The sound of the announcement message.

      • OptionaltargetId: number

        Id of the player who will receive this announcement. If this value is null, the announcement is sent to everyone.

      Returns void

      void.

    • Updates the current skin(textureId) of a player.

      Parameters

      • id: number

        Id of the player whose skin will be modified.

      • skin: Texture | null

        New skin value of the player.

      Returns void

      void.

    • Sets the cssVar attribute of a player to change its appearance in the room gui.

      Parameters

      • id: number

        Id of the player whose cssVar will be modified.

      • cssVar: string | null

        New cssVar value of the player.

      Returns void

      void.

    • Adds a new stadium object.

      Parameters

      • type: number

        Type of the object to be added.

      • value: object

        An object that is supposed to contain all parameters required to add that type of object.

      Returns void

      void.

    • Updates an existing stadium object.

      Parameters

      • type: number

        Type of the object to be updated.

      • id: number

        Id of the object to be updated.

      • value: object

        An object that is supposed to contain all parameters required to update that type of object.

      Returns void

      void.

    • Removes an existing stadium object.

      Parameters

      • type: number

        Type of the object to be removed.

      • id: number

        Id of the object to be removed.

      Returns void

      An instance of StadiumRemoveObjectEvent.

    • Sets the overtime limit.

      Parameters

      • value: number

        The desired overtime limit of the game.

      Returns void

      void.

    • Manually changes the energy of an individual player.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • data: number[]

        New values. Order of values is supposed to be: [energy, kEnergyGain, kEnergyDrain]. null means no change for each value.

      Returns void

      void.

    • Manually change the direction of an individual player. room.state.directionActive must be true for this to work.

      Parameters

      • id: number

        Id of the player whose energy values will be modified.

      • value: number

        New direction value of the player.

      Returns void

      void.

    • Introduces a new game input control and assigns it to the next bit of player.input value.

      Parameters

      • name: string

        Unique name of the input control.

      • keys: number[]

        Keycodes for the default keys of this input control.

      Returns void

      void.

    • Remove an existing game input control. This function might break the game input logic completely.

      Parameters

      • name: string

        Unique name of the input control to be removed.

      Returns void

      void.

    • Updates the current contents of a css variable.

      Parameters

      • name: string

        Name of the css variable..

      • value: string

        New value of the css variable.

      Returns void

      void.

    • Plays a custom sound.

      Parameters

      • soundName: string

        Name of the sound to be played.

      Returns void

      void.

    • Changes the name of the room.

      Parameters

      • name: string

        The new room name.

      Returns void

      void.

    • Manually sets the current elapsed time.

      Parameters

      • value: number

        New elapsed time value.

      Returns void

      void.

    • Manually sets the current max goal ticks.

      Parameters

      • value: number

        New max goal ticks value.

      Returns void

      void.

    • Manually set the current max pause ticks.

      Parameters

      • value: number

        New max pause ticks value.

      Returns void

      void.

    • Manually set the current max end ticks.

      Parameters

      • value: number

        New max end ticks value.

      Returns void

      void.

    • Manually pause/resume the game clock.

      Parameters

      • value: number

        Whether the game will be paused(1) or resumed(0).

      Returns void

      void.

    • Manually set whether direction is active or not.

      Parameters

      • value: number

        New directionActive value.

      Returns void

      void.

    • Manually set the current team scores.

      Parameters

      • teamId: number

        Id of the team whose score is desired to be changed.

      • value: number

        New score for the team.

      Returns void

      void.

    • Sets the player's current direction. room.state.directionActive must be true for this to work.

      Parameters

      • value: number

        New direction value of the current player.

      Returns void

      void

    • Triggers a fake join room event; which in turn creates a new in-memory player object. If there was a player before with this id, old resources are automatically reassigned to this new player object, and that player will wake up.

      Parameters

      • id: number

        Id of the player. 0 <= id <= 65535

      • name: string

        Name of the player.

      • flag: string

        Country code of the player.

      • avatar: string

        Avatar of the player.

      • conn: string

        Connection string of the player.

      • auth: string

        Auth string of the player.

      Returns void

      void.

    • Triggers a fake leave room event. The player, although seemingly leaving the room, still watches the room, waiting for a new fake player join event. All parameters except id may be different in the new fakePlayerJoin call, which allows player's name, flag, avatar, conn and auth to change without the player entirely leaving the room.

      • Returns the player's properties so that you may pass them to fakePlayerJoin at a later time to re-insert that player.

      Parameters

      • id: number

        Id of the player leaving. id=0 will cause desync on clients. (Because there's a special check for this case in original clients.)

      Returns {
          auth: string;
          avatar: string;
          conn: string;
          flag: string;
          id: number;
          name: string;
      }

      An object that has the following strucure: { id: uint16, name: string, flag: string, avatar: string, conn: string, auth: string }.

    • Triggers a fake input(keys) event that apparently originated from the player whose id is byId.

      Parameters

      • input: number

        New input value of the player. 0<=input<=31.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake chat event that apparently originated from the player whose id is byId.

      Parameters

      • msg: string

        The chat message.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake chat indicator change event that apparently originated from the player whose id is byId.

      Parameters

      • value: boolean

        The new chat indicator status of the player.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake avatar change event that apparently originated from the player whose id is byId.

      Parameters

      • value: string

        The new avatar of the player.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake admin status change event for the player whose id is playerId that apparently originated from the player whose id is byId.

      Parameters

      • playerId: number

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

      • value: boolean

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

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake player sync status change event that apparently originated from the player whose id is byId.

      Parameters

      • value: boolean

        The new synchronization status of the player.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake stadium change event that apparently originated from the player whose id is byId. The game must be stopped first.

      Parameters

      • value: IStadium

        The new stadium of the current room.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

    • Triggers a fake game start event that apparently originated from the player whose id is byId.

      Parameters

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake game stop event that apparently originated from the player whose id is byId. The game must be started first.

      Parameters

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake game pause/resume event that apparently originated from the player whose id is byId. The game must be started first.

      Parameters

      • value: boolean

        value=true: pause, false: resume.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake score limit change event that apparently originated from the player whose id is byId.

      Parameters

      • value: number

        The new score limit of the current room. The game must be stopped first. 0 means unlimited. 0<=value<=99.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake time limit change event that apparently originated from the player whose id is byId.

      Parameters

      • value: number

        The new time limit of the current room. The game must be stopped first. 0 means unlimited. 0<=value<=99.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake teams lock change event that apparently originated from the player whose id is byId.

      Parameters

      • value: boolean

        The new teams lock value of the current room.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake auto teams event that apparently originated from the player whose id is byId.

      Parameters

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake player team change event for the player whose id is playerId that apparently originated from the player whose id is byId.

      Parameters

      • playerId: number

        Id of the player whose team is being changed.

      • teamId: number

        Id of the desired team of the player. 0: specetator, 1: red, 2: blue.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake kick rate limit change event that apparently originated from player(byId).

      Parameters

      • min: number

        The new min part of kick rate limit. min>=0.

      • rate: number

        The new rate part of kick rate limit. rate>=0.

      • burst: number

        The new burst part of kick rate limit. burst>=0.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a team color change event for the team whose id is teamId that apparently originated from the player whose id is byId.

      Parameters

      • teamId: number

        Id of the team whose colors are desired to change.

      • angle: number

        The angle of stripes for the inner colors. Should be between 0 and 180.

      • colors: number[]

        This array can contain minimum 2, maximum 4 numeric (0 <= integer <= 16777215) values. The first element is the text color and the rest are inner stripe colors.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.

    • Triggers a fake leave/kick/ban event for the player whose id is playerId that apparently originated from the player whose id is byId.

      Parameters

      • playerId: number

        Id of the player who will leave the room. (Or get kicked/banned from the room.)

      • reason: string | null

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

      • ban: boolean

        Whether the player is being banned or not.

      • byId: number

        Id of the player who will look like he/she sent this event.

      Returns void

      void.