Hierarchy

Constructors

  • Returns default

Properties

event: IEventEmitter<default, IMultiplayerEvents>

Accessors

  • get areSyncChecksSuppressed(): boolean
  • Returns boolean

  • get isClient(): boolean
  • Returns boolean

  • get isConnected(): boolean
  • Returns boolean

  • get isPacketProcessingPaused(): boolean
  • Returns boolean

  • get isProcessingPacket(): boolean
  • Returns boolean

  • get isServer(): boolean
  • Returns boolean

Methods

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Returns Promise<void>

  • Returns void

  • Parameters

    • gameCode: string

    Returns ServerInfo

  • Parameters

    • timeoutTime: number

    Returns void

  • Parameters

    Returns void

  • Disconnects from multiplayer Callable from a server or client If a client is in a game, disconnectAndResetGameState should be called

    Returns

    True when it disconnected. False is there was nothing to disconnect

    Parameters

    • reason: DisconnectReason
    • args: any[] = []
    • unloadingOrResetGameState: boolean = false

    Returns Promise<boolean>

  • Parameters

    • enable: boolean

    Returns void

  • Executes a function while ensuring it is runs outside the context of any executing actions/multiplayer logic in order to prevent desyncs

    Parameters

    • lambda: (() => any)

      Function to execute

        • (): any
        • Returns any

    Returns void

  • Returns string[]

  • Three types of game codes:

    1. Dedicated server code - ex. 1.2.3.4:1234
    2. Steam lobby code - ex. steam:109775241017071190
    3. Global matchmaking server id - ex. 87287724-49aa-e556-4145-3ed96c649a20

    Returns undefined | string

  • Parameters

    • matchmakingServer: string
    • identifier: string = ...

    Returns IMatchmakingInfo

  • Returns string

  • Returns IServerMod[]

  • Returns boolean

  • Parameters

    • gameCode: string

    Returns boolean

  • Checks if a sync check is active and enabled. Active means there's a current sync check being recorded

    Parameters

    Returns boolean

  • Parameters

    • packetId: number
    • processing: boolean

    Returns void

  • Parameters

    • success: boolean
    • lobbyId: string

    Returns void

  • Parameters

    • lobbyId: string

    Returns void

  • Returns Promise<void>

  • Returns void

  • Parameters

    Returns void

  • Parameters

    • Optional options: {
          automaticallyRetry?: boolean;
          enableSteamNetworkConnections?: boolean;
          randomizeIdentifier?: boolean;
      }
      • Optional automaticallyRetry?: boolean
      • Optional enableSteamNetworkConnections?: boolean
      • Optional randomizeIdentifier?: boolean

    Returns Promise<boolean>

  • Parameters

    Returns void

  • Parameters

    • Optional waitId: string
    • Optional value: unknown

    Returns void

  • Returns void

  • Execute an async function while applying some temporary state changes

    Type Parameters

    • T = void

    Parameters

    Returns Promise<T>

  • Parameters

    Returns Promise<void>

  • Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • identifier: string
    • ban: boolean

    Returns boolean

  • Parameters

    Returns void

  • Parameters

    • identifier: string

    Returns void

  • Parameters

    • suppress: boolean

    Returns void

  • Returns Promise<void>

  • Sends a packet in a synchronized way to the server or clients

    When ran as a server, clientSide() is called and the packet data is sent to all the clients.

    When ran as a client, the packet is sent to the server. The server is expected to call this method, which in turn sends the packet back to the client. When the client receives the packet, this method a second time and clientSide() is called.

    Type Parameters

    • T = any

    Parameters

    • packet: IPacket<any>

      The packet

    • Optional clientSide: NullaryFunction<T>

      The method to run for the client or server.

    • Optional checkId: boolean

      When true, this packet will not be sent to the server/client if the same packet is already being processed. When false, this packet will not be sent if any packet is already being processed. Useful when dealing with methods that could end up sending multiple packets while a packet is already being processed.

    • Optional wait: number | true

      When true, the client will keep track of what packets it sent to the server. If the client calls this method again before the server responds, it will not send a duplicate packet. It will wait for the server to send the packet back before allowing another one to be sent. When true, it will keep track of duplicate packets based on the packet type. When it's a number, it will keep track of duplicate packets based on the packet type + the number.

    Returns PromiseOr<undefined | T>

  • Returns void

  • Parameters

    • oldPid: number
    • newPid: number

    Returns void

  • Sanity checks for the state of multiplayer

    Returns

    True when the state is invalid

    Returns boolean

Generated using TypeDoc