Перейти к основному содержанию

NetworkConnectedClientList

Class to work with definite couple of clients, bound by certain conditions.

Index

Constructors

constructor

  • Parameters

    • addToGlobalRefreshList: boolean

      if true, the object will be added to the global list for updating periodically, default is true

    Returns NetworkConnectedClientList

Methods

add

  • Adds given client to the list.


    Parameters

    Returns void

contains


  • Parameters

    Returns boolean

    Whether the list contains given client.

iterator


  • Returns Iterator<NetworkClient>

    Iterator across clients' objects that the list consists of.

remove

  • Removes given client from the list.


    Parameters

    Returns void

send

  • send(packetName: string, packetData: object): void
  • Sends packet to all clients from the following list.


    Parameters

    • packetName: string

      name of the packet to send

    • packetData: object

      packet data object

    Returns void

setupAllInDimensionPolicy

  • Sets up policy to add players from the same given dimension to the list.


    Parameters

    • dimensionID: number

      numeric ID of the dimension where the clients have to be located to be included into the list

    • updateRate: number

      how many milliseconds will have to pass between list updates

    Returns NetworkConnectedClientList

    Reference to itself to be used in sequential calls.

setupAllPlayersPolicy

  • Sets up policy to add all players to the list.


    Returns NetworkConnectedClientList

    Reference to itself to be used in sequential calls.

setupDistancePolicy

  • Condition to bound clients to the list. All clients in a given dimension at a distance of no more than maxDistance from x, y, z.


    Parameters

    • x: number

      X coord of the conditional centre point of the area where clients are located

    • y: number

      Y coord of the conditional centre point of the area where clients are located

    • z: number

      Z coord of the conditional centre point of the area where clients are located

    • dimensionID: number

      numeric ID of the dimension where clients are located

    • maxDistance: number

      max distance from the client to the conditional centre, to bound the client to the list

    Returns NetworkConnectedClientList

    Reference to itself to be used in sequential calls.