interfaces room - wxyz-abcd/node-haxball GitHub Wiki

Room

The class/object that currently hosts all room operations. Can only be instantiated by either Room.join or Room.create.

1. Static Functions

These functions are used to create/join a room or room-like object.

  • Room.create(createParams: object, commonParams: HaxballClient): HaxballClient

    Creates a room with given parameters.

    Parameters:

    • createParams: object: An object that might have the following keys:
      • name: string: Name of the room.
      • password: string | null: A password string to protect the room, or null for no password.
      • token: string: In order to create a room, we have to solve a recaptcha challenge and write the resulting token into this key. The recaptcha token can be originally obtained from https://www.haxball.com/headlesstoken. However, this url will be different while using a custom backend server.
      • noPlayer: boolean: Determines whether a player object will be created for the room host or not.
      • geo: GeoLocation: The geolocation value of the room about to be created. (documentation)
      • playerCount: int | null: If set to an int, fixes the current player count to this specific value.
      • maxPlayerCount: int: The maximum allowed player count in the room.
      • 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.
      • 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.
      • showInRoomList: boolean: Whether to show this room in the room list or not.
      • onError: Function(error: HBError, playerId: int): Called when a exception is thrown by one of the client connections. playerId is the id of the player that caused the exception. The player's connection will be closed just after this callback is executed.
    • commonParams: HaxballClient: A custom HaxballClient-like object. (documentation)

    Return value: A custom HaxballClient object. (documentation)

  • join(joinParams: object, commonParams: HaxballClient): HaxballClient

    Tries to join a room using the given parameters.

    Parameters:

    • joinParams: object: An object that might have the following keys:
      • id: string: The id of the room to join. For example, if the room link is https://www.haxball.com/play?c=31IBNI3w4F0, the id of this room is 31IBNI3w4F0.
      • password: string | null: A password value to join the room if the room is password-protected.
      • token: string | null: If the room is recaptcha-protected, you have to use a client token. Currently there is not any other clean way of generating this token for Haxball's original backend except using the NW.js token generator project, so you might want to look at it.
      • authObj: Auth: An auth object that has to be initialized by Utils.generateAuth() or Utils.authFromKey() before being used here.
    • commonParams: object: A custom HaxballClient-like object. (documentation)

    Return value: A custom HaxballClient object. (documentation)

  • sandbox(callbacks: object, options: object): SandboxRoom

    Creates a sandbox room object.

    Parameters:

    • callbacks: object: An object that may have all callbacks defined in sections 2, 3.1, 4 and 6 of our event callbacks documentation. In addition, it is possible to use a render callback that has the same signature as defined in section 3 of our Renderer documentation.
    • options: object: An object that might have the following keys:
      • controlledPlayerId: int | null: Id of the player to be controlled.
      • requestAnimationFrame: ((callback: function, ...args: any[])=>number) | null: Override function for requestAnimationFrame. Omit to use library's default requestAnimationFrame.
      • cancelAnimationFrame: ((handle: number)=>void) | null: Override function for cancelAnimationFrame. Omit to use library's default cancelAnimationFrame.
      • fps_limit: int | null: Any positive number that will be used as the fps limit. (null = no limit)

    Return value: An instance of the SandboxRoom structure (documentation).

2. Properties

  • isHost: boolean: true for a host room, false for a client room.
  • client: HaxballClient: A reference to a HaxballClient(documentation) object that was created and returned from the call to Room.join or Room.create. This object is used internally.
  • currentPlayerId: int: 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)
  • kickTimeout: int: Time between releasing and re-pressing the kick key. kickTimeout <= 0 means that this feature is disabled. (in milliseconds, defaults to -1)
  • config: RoomConfig: The current roomConfig object.
  • renderer: Renderer | null: The current renderer object. Might be null.
  • plugins: Plugin[]: Array of all available plugins. This is used internally to restore the order of plugins while a plugin is being activated/deactivated.
  • activePlugins: Plugin[]: Array of currently active plugins. This is used internally for callbacks.
  • 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.
  • link: string: The url of the room. read-only.
  • timeLimit: int: The game's current time limit. read-only.
  • scoreLimit: int: The game's current score limit. read-only.
  • stadium: Stadium: The stadium object of the room. read-only.
  • players: Player[]: The list of players in the room. read-only.
  • redScore: int | null: Red team's current score. null if game is not active. read-only.
  • blueScore: int | null: Blue team's current score. null if game is not active. read-only.
  • timeElapsed: int | null: Elapsed time in current game. null if game is not active. read-only.
  • currentFrameNo: int: The current frame number of the room. read-only.
  • banList: ({ id: uint16, name: string, auth: string, conn: string, ips: string[] })[]: the current list of banned players. read-only. host-only.

3. Functions

  • leave(): void

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

    Parameters: None.

    Return value: void.

  • setProperties(properties: object): void

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

    Parameters:

    • properties: object: 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. (documentation)
      • 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 Haxball 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 Haxball 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.

    Return value: void.

  • setRecaptcha(on: boolean): void

    Enables or disables recaptcha-solving to join this room. host-only.

    Parameters:

    • on: boolean: The desired activation status of room's recaptcha mode.

    Return value: void.

  • setKickRateLimit(min: int, rate: int, burst: int): void

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

    Parameters:

    • min: int: The desired min value of kick rate limit. 0 <= min <= 255.
    • rate: int: The desired rate value of kick rate limit. 0 <= rate <= 255.
    • burst: int: The desired burst value of kick rate limit. 0 <= burst <= 100.

    Return value: void

  • setHandicap(handicap: int): void

    Sets the current player's handicap value.

    Parameters:

    • handicap: int: The desired handicap value in msecs. 0 <= handicap <= 300.

    Return value: void

  • setExtrapolation(extrapolation: int): void

    Sets the current player's extrapolation value.

    Parameters:

    • extrapolation: int: The desired extrapolation value in msecs. -200 <= extrapolation <= 200.

    Return value: void

  • clearBans(): void

    Clears all bans. host-only.

    Parameters: None

    Return value: void

  • clearBan(id: int): void

    Clears the ban of a player. host-only.

    Parameters:

    • id: int: Id of the player whose ban will be cleared.

    Return value: void

  • executeEvent(event: HaxballEvent, byId: int): void

    Executes any event inside this room. host-only.

    Parameters:

    • event: HaxballEvent: The event to be executed.
    • byId: int: Id of the player of whom this event will be executed by.

    Return value: void

  • clearEvents(): void

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

    Parameters: None

    Return value: void

  • setAvatar(avatar: string): void

    Sets the current player's client avatar value.

    Parameters:

    • avatar: string: The desired avatar value. avatar.length must be <= 2.

    Return value: void

  • setPlayerAvatar(id: int, value: string, headless: boolean): void

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

    Parameters:

    • id: int: 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.

    Return value: void

  • setChatIndicatorActive(active: boolean): void

    Sets the current player's chat indicator status.

    Parameters:

    • active: boolean: true activates the chat indicator, false deactivates it.

    Return value: void

  • setTeamColors(teamId: int, angle: int, ...colors: string): void

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

    Parameters:

    • teamId: int: Id of the team whose colors are desired to be changed. Can either be 1(red) or 2(blue).
    • angle: int: The desired angle of stripes. Should be between -180 and 180.
    • ...colors: string: Minimum 1, maximum 4 parseable(hex-rgb) color parameters. First parameter is the text color, and the others are stripe colors.

    Return value: void

  • setUnlimitedPlayerCount(on: boolean): 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.

    Return value: void

  • setFakePassword(fakePwd: boolean | null): void

    Fakes Haxball'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.

    Return value: void

  • sendChat(msg: string, targetId: int | null): void

    Sends a chat message.

    Parameters:

    • msg: string: The message that is desired to be sent. msg.length must be <= 140.
    • targetId: int | null: If null, the message is sent to everyone; otherwise, only the player whose id is targetId will receive this chat message. host-only.

    Return value: void

  • sendAnnouncement(msg: string, targetId: int | null, color: int, style: int, sound: int): void

    Sends an announcement message. host-only.

    Parameters:

    • msg: string: The announcement message that is desired to be sent. msg.length must be <= 1000.
    • targetId: int | null: If null, the message is sent to everyone; otherwise, only the player whose id is targetId will receive this announcement.
    • color: int: The desired color of the announcement. 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.
    • style: int: The desired font style of the announcement. 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: int: The desired sound of the announcement. Must be one of the following:
      • 0: no sound.
      • 1: chat sound.
      • 2: highlight sound.

    Return value: void

  • setDiscProperties(discId: int, properties: object): void

    Sets the properties of a disc. host-only.

    Parameters:

    • discId: int: Id of the disc whose properties are desired to be set.
    • properties: object: 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.

    Return value: void

  • setPlayerDiscProperties(playerId: int, properties: object): void

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

    Parameters:

    • playerId: int: Id of the player whose disc properties are desired to be changed.
    • properties: object: 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.

    Return value: void

  • reorderPlayers(playerIdList: int[], moveToTop: boolean): 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: int[]: 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.

    Return value: void

  • sendCustomEvent(type: int, data: object): 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. Note that the message can only be received by the users of this modified client.

    Parameters:

    • type: int: 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.

    Return value: void

  • getKeyState(): int

    Returns the current player's key state value.

    Parameters: None

    Return value: An integer between 0 and 31 inclusive.

  • setKeyState(state: int): void

    Sets the current player's key state value.

    Parameters:

    • state: int: The desired key state value. 0 <= state <= 31.

    Return value: void

  • startGame(): void

    Starts the game. admin-only.

    Parameters: None

    Return value: void

  • stopGame(): void

    Stops the game. admin-only.

    Parameters: None

    Return value: void

  • pauseGame(): void

    Pauses or resumes the game. admin-only.

    Parameters: None

    Return value: void

  • isGamePaused(): boolean

    Returns true if game is paused.

    Parameters: None

    Return value: boolean

  • autoTeams(): 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.

    Parameters: None

    Return value: void

  • lockTeams(): void

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

    Parameters: None

    Return value: void

  • resetTeams(): void

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

    Parameters: None

    Return value: void

  • randTeams(): 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.

    Parameters: None

    Return value: void

  • resetTeam(teamId: int): void

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

    Parameters:

    • teamId: int: Id of the team whose whose players will be moved to the spectators team.

    Return value: void

  • setSync(value: boolean): void

    Sets the synchronization status of the current player.

    Parameters:

    • value: boolean: The desired synchronization status.

    Return value: void

  • setCurrentStadium(stadium: Stadium, onError: Function): void

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

    Parameters:

    • stadium: Stadium: The desired stadium to be set as the room's current stadium.
    • onError: Function: The function to be called if an error occurs.

    Return value: void

  • setTimeLimit(value: int): void

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

    Parameters:

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

    Return value: void

  • setScoreLimit(value: int): void

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

    Parameters:

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

    Return value: void

  • changeTeam(teamId: int): 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: int: Id of the team that is desired to join.

    Return value: void

  • setPlayerTeam(playerId: int, teamId: int): void

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

    Parameters:

    • playerId: int: Id of the player to be moved to a different team.
    • teamId: int: Id of the team to move the player to.

    Return value: void

  • setPlayerAdmin(playerId: int, isAdmin: boolean): void

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

    Parameters:

    • playerId: int: 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.

    Return value: void

  • kickPlayer(playerId: int, reason: string | null, isBanning: boolean): void

    Kicks or bans a player.

    Parameters:

    • playerId: int: Id of the player who is being kicked/banned.
    • reason: string: 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.

    Return value: void

  • getPlayer(id: int): Player

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

    Parameters:

    • id: int: Id of the player.

    Return value: A Player object.

  • getBall(extrapolated: boolean = true): Disc

    Returns the ball disc.

    Parameters:

    • extrapolated: boolean = true:
      • true: return the latest extrapolated version.
      • false: return the original version.

    Return value: A Disc object.

  • getDiscs(extrapolated: boolean = true): Disc[]

    Returns the disc array of the current room.

    Parameters:

    • extrapolated: boolean = true:
      • true: return the latest extrapolated version.
      • false: return the original version.

    Return value: An array that consists of Disc objects.

  • getDisc(discId: int, extrapolated: boolean = true): Disc

    Returns the disc whose id is discId.

    Parameters:

    • discId: int: Id of the disc to be returned.
    • extrapolated: boolean = true:
      • true: return the latest extrapolated version.
      • false: return the original version.

    Return value: A Disc object.

  • getPlayerDisc(playerId: int, extrapolated: boolean = true): Disc

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

    Parameters:

    • playerId: int: Id of the player whose disc is to be returned.
    • extrapolated: boolean = true:
      • true: return the latest extrapolated version.
      • false: return the original version.

    Return value: A Disc object.

  • getPlayerDisc_exp(playerId: int): Disc

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

    Parameters:

    • playerId: int: Id of the player whose disc is to be returned.

    Return value: A Disc object.

  • setPluginActive(name: string, active: boolean): void

    Activate or deactivate the plugin whose name is name.

    Parameters:

    • name: string: Name of the plugin that is desired to be activated/deactivated.
    • active: boolean: Whether to activate(active = true) the plugin or to deactivate(active = false) it.

    Return value: void

  • startRecording(): boolean

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

    Parameters: None

    Return value: true if succeeded, false otherwise.

  • stopRecording(): UInt8Array | null

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

    Parameters: None

    Return value: The recorded UInt8Array replay data if succeeded, null otherwise.

  • isRecording(): boolean

    Returns whether the replay recorder is active or not.

    Parameters: None

    Return value: true if replay recording is active; false otherwise.

  • setConfig(roomConfig: RoomConfig): void

    Sets the RoomConfig object that contains all the main callbacks of this room. The old roomConfig is finalized and the new roomConfig is initialized.

    Parameters:

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

    Return value: void

  • mixConfig(roomConfig: RoomConfig): 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.

    Return value: void

  • updatePlugin(pluginIndex: int, newPluginObj: Plugin): 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: int: 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.

    Return value: void

  • setRenderer(renderer: Renderer): 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.

    Return value: void

  • updateLibrary(libraryIndex: int, newLibraryObj: Library): 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: int: 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.

    Return value: void

4. Sandbox Mode Functions

These functions are not supported by the original Haxball client. You would need to create CustomEvents to use them within a synchronized(network) environment. For now, the game must NOT be stopped for these functions to work.

  • takeSnapshot(): RoomState

    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.

    Parameters: None.

    Return value: The snapshot copy of the current room's state.

  • exportStadium(): object

    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.

    Parameters: None.

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

  • createVertex(data: object): Vertex

    Creates a vertex object in memory and returns it.

    Parameters:

    • data: object: 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.

    Return value: A Vertex object.

  • createSegment(data: object): Segment

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

    Return value: A Segment object.

  • createSegmentFromObj(data: object): Segment

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

    Parameters:

    • data: object: 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.

    Return value: A Segment object.

  • createGoal(data: object): Goal

    Creates a goal object in memory and returns it.

    Parameters:

    • data: object: 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.

    Return value: A Goal object.

  • createPlane(data: object): Plane

    Creates a plane object in memory and returns it.

    Parameters:

    • data: object: 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.

    Return value: A Plane object.

  • createDisc(data: object): Disc

    Creates a disc object in memory and returns it.

    Parameters:

    • data: object: 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.

    Return value: A Disc object.

  • createJoint(data: object): Joint

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

    Parameters:

    • data: object: 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.

    Return value: A Joint object.

  • createJointFromObj(data: object): Joint

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

    Parameters:

    • data: object: 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.

    Return value: A Joint object.

  • addVertex(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • addSegment(data: object): 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: object: 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.

    Return value: void

  • addGoal(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • addPlane(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • addDisc(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • addJoint(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • addSpawnPoint(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • addPlayer(data: object): void

    Adds a player with given properties to the current stadium.

    Parameters:

    • data: object: 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".

    Return value: void

  • findVertexIndicesOfSegmentObj(obj: Segment): int[]

    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.

    Return value: 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.

  • findVertexIndicesOfSegment(idx: int): int[] | null

    Returns the indices of vertices that form a segment.

    Parameters:

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

    Return value: 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.

  • updateVertex(idx: int, data: object): void

    Updates the idxth vertex's only the given values.

    Parameters:

    • idx: int: Index of the vertex that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updateSegment(idx: int, data: object): void

    Updates the idxth segment's only the given values.

    Parameters:

    • idx: int: Index of the segment that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updateGoal(idx: int, data: object): void

    Updates the idxth goal's only the given values.

    Parameters:

    • idx: int: Index of the goal that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updatePlane(idx: int, data: object): void

    Updates the idxth plane's only the given values.

    Parameters:

    • idx: int: Index of the plane that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updateDisc(idx: int, data: object): void

    Updates the idxth disc's only the given values.

    Parameters:

    • idx: int: Index of the disc that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updateDiscObj(discObj: Disc, data: object): void

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

    Parameters:

    • discObj: Disc: The disc that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updateJoint(idx: int, data: object): void

    Parameters:

    Updates the idxth joint's only the given values.

    • idx: int: Index of the joint that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updateSpawnPoint(idx: int, team: "red" | "blue", data: object): void

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

    Parameters:

    • idx: int: Index of the spawn point that is desired to be updated.
    • team: "red" | "blue": Current team of the spawn point that is desired to be updated.
    • data: object: 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.

    Return value: void

  • updatePlayer(playerId: int, data: object): void

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

    Parameters:

    • playerId: int: Id of the player that is desired to be updated.
    • data: object: 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.

    Return value: void

  • removeVertex(idx: int): void

    Removes a vertex from the current room.

    Parameters:

    • idx: int: Index of the vertex to remove.

    Return value: void

  • removeSegment(idx: int): void

    Removes a segment from the current room.

    Parameters:

    • idx: int: Index of the segment to remove.

    Return value: void

  • removeGoal(idx: int): void

    Removes a goal from the current room.

    Parameters:

    • idx: int: Index of the goal to remove.

    Return value: void

  • removePlane(idx: int): void

    Removes a plane from the current room.

    Parameters:

    • idx: int: Index of the plane to remove.

    Return value: void

  • removeDisc(idx: int): void

    Removes a disc from the current room.

    Parameters:

    • idx: int: Index of the disc to remove.

    Return value: void

  • removeJoint(idx: int): void

    Removes a joint from the current room.

    Parameters:

    • idx: int: Index of the joint to remove.

    Return value: void

  • removeSpawnPoint(idx: int, team: string): void

    Removes a spawn point from the current room.

    Parameters:

    • idx: int: Index of the spawn point to remove.
    • team: "red" | "blue": The team that the spawn point belongs to.

    Return value: void

  • removePlayer(playerId: int): void

    Removes a player from the current room.

    Parameters:

    • playerId: int: Id of the player to remove.

    Return value: void

  • updateStadiumPlayerPhysics(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • updateStadiumBg(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

  • updateStadiumGeneral(data: object): void

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

    Parameters:

    • data: object: 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.

    Return value: void

5. Fake Event Triggers

These functions are intended to be used in host mode to create/control in-memory bot players that will run much more efficiently than standard networking bot players. They also work for normal player objects, and can be used to create some events belonging to a player that did not originate from that player. Most of these fake events also trigger an onOperationReceived call before being sent to clients.

  • fakePlayerJoin(id: int, name: string, flag: string, avatar: string, conn: string, auth: string): 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: int: 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.

    Return value: void

  • fakePlayerLeave(id: int): object

    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: int: Id of the player leaving. id=0 will cause desync on clients. (Because there's a special check for this case in original clients.)

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

  • fakeSendPlayerInput(input: int, byId: int): void

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

    Parameters:

    • input: int: New input value of the player. 0<=input<=31.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSendPlayerChat(msg: string, byId: int): void

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

    Parameters:

    • msg: string: The chat message.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetPlayerChatIndicator(value: boolean, byId: int): 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetPlayerAvatar(value: string, byId: int): 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetPlayerAdmin(playerId: int, value: boolean, byId: int): 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: int: 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetPlayerSync(value: boolean, byId: int): 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetStadium(value: Stadium, byId: int): 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: Stadium: The new stadium of the current room.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeStartGame(byId: int): void

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

    Parameters:

    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeStopGame(byId: int): 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetGamePaused(value: boolean, byId: int): 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetScoreLimit(value: int, byId: int): void

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

    Parameters:

    • value: int: The new score limit of the current room. The game must be stopped first. 0 means unlimited. 0<=value<=99.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetTimeLimit(value: int, byId: int): void

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

    Parameters:

    • value: int: The new time limit of the current room. The game must be stopped first. 0 means unlimited. 0<=value<=99.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetTeamsLock(value: boolean, byId: int): 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeAutoTeams(byId: int): void

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

    Parameters:

    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetPlayerTeam(playerId: int, teamId: int, byId: int): 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: int: Id of the player whose team is being changed.
    • teamId: int: Id of the desired team of the player. 0: specetator, 1: red, 2: blue.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetKickRateLimit(min: int, rate: int, burst: int, byId: int): void

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

    Parameters:

    • min: int: The new min part of kick rate limit. min>=0.
    • rate: int: The new rate part of kick rate limit. rate>=0.
    • burst: int: The new burst part of kick rate limit. burst>=0.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeSetTeamColors(teamId: int, angle: int, colors: int[], byId: int): 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: int: Id of the team whose colors are desired to change.
    • angle: int: The angle of stripes for the inner colors. Should be between 0 and 180.
    • colors: int[]: This array can contain minimum 1, maximum 4 integers; where 0 <= each integer <= 16777215. The first element is the text color and the rest are inner stripe colors.
    • byId: int: Id of the player who will look like he/she sent this event.

    Return value: void

  • fakeKickPlayer(playerId: int, reason: string | null, ban: boolean, byId: int): 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: int: 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: int: Id of the player who will look like he/she sent this event.

    Return value: void

⚠️ **GitHub.com Fallback** ⚠️