mooball
    Preparing search index...

    Interface RoomState

    A class that defines the complete state of a room.

    interface RoomState {
        stadium: IStadium;
        kickRate_min: number;
        kickRate_rate: number;
        kickRate_max: number;
        timeLimit: number;
        scoreLimit: number;
        overtimeLimit: number;
        teamsLocked: boolean;
        directionActive: boolean;
        runDefaultGameLogic: boolean;
        clockPaused: boolean;
        goalTicksMax: number;
        pauseTicksMax: number;
        endTicksMax: number;
        gameState: GameState | null;
        players: Player[];
        name: string;
        teamColors: TeamColors[];
        gui: Gui;
        ext: RoomState | null;
        copy(): RoomState;
        getPlayer(id: number): Player | null;
        runSteps(count: number): void;
        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;
    }
    stadium: IStadium

    The stadium that the game is currently being played in.

    kickRate_min: number

    The min value of kick rate limit.

    kickRate_rate: number

    The rate value of kick rate limit.

    kickRate_max: number

    The max value of kick rate limit.

    timeLimit: number

    The time limit of this current RoomState in seconds. -1 = no limit.

    scoreLimit: number

    The score limit of this current RoomState. 0 = no limit.

    overtimeLimit: number

    The over-time limit of this current RoomState in seconds. -1 = no limit.

    teamsLocked: boolean

    Whether the teams are locked or not. The non-admin players are allowed to change teams only if this feature is disabled and the game is stopped.

    directionActive: boolean

    Whether player directions are active or not.

    runDefaultGameLogic: boolean

    Whether the game will run its default logic or not. If this value is false, you will probably want to write your own game logic from scratch in onGameTick.

    clockPaused: boolean

    Whether the clock is paused or not.

    goalTicksMax: number

    Number of ticks the physics engine waits after each goal before restarting the game.

    pauseTicksMax: number

    Number of ticks the physics engine waits after each pause before resuming the game.

    endTicksMax: number

    Number of ticks the physics engine waits after deciding that the game is over before ending the game.

    gameState: GameState | null

    Current state of the game, or null if the game is stopped.

    players: Player[]

    All players that are currently in this room.

    name: string

    Name of this room.

    teamColors: TeamColors[]

    The custom colors for each team. The 0th index has null because it's the Spectators team.

    gui: Gui

    Gui-related values of the room.

    ext: RoomState | null

    The extrapolated version of this RoomState, or null if the data is not available.

    • Returns a snapshot of the current room state. You can load the returned object directly into sandbox using its useSnapshot(roomState) function.

      Returns RoomState

      A complete snapshot of the current room state.

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

      Parameters

      • id: number

        The id of the player to be returned.

      Returns Player | null

      The Player object, or null if the player is not found.

    • Runs the simulation count steps. Use with extreme caution, especially on network rooms.

      Parameters

      • count: number

        Number of steps to run the simulation.

      Returns void

      void.

    • 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