Enfusion Script API
Loading...
Searching...
No Matches
ServerInfo Interface Reference

Object containing info and interaction methods for game servers. More...

Public Member Functions

proto external string GetId ()
 Returns unique ID of this server.
 
proto external string GetName ()
 Returns name of this server.
 
proto external string GetDescription ()
 Returns description of this server.
 
proto external EServerType GetServerType ()
 Returns type of the server which specifies how it was hosted.
 
proto external int GetMaxPlayers ()
 Returns count of max players that can be connected to the server.
 
proto external int GetPlayerCount ()
 Returns count of currently connected players on the server.
 
proto external bool IsOnline ()
 Returns true if server is indicated as currently online (running)
 
proto external void SetFavorite (notnull BackendCallback callback, bool isFavorite)
 Will request change for favorite mark state for this server.
 
proto external bool IsFavorite ()
 Returns true if client has this server marked as favorite.
 
proto external int GetSecondsSinceLastJoin ()
 Returns how long ago user last joined this server in seconds.
 
proto external bool IsVisible ()
 Returns true if server is configured to be visible in ServerCatalogue.
 
proto external bool IsJoinable ()
 Returns true if server is in state in which clients can join it.
 
proto external bool IsMyPlatformSupported ()
 Returns true if platform of the client is supported by the server.
 
proto external bool IsCrossPlatform ()
 Returns true if server supports my and at least one more platform.
 
proto external bool IsPasswordProtected ()
 Returns true if server requires password for further requests to more detailed info about the server or to request join to the server.
 
proto external void SetPassword (string password)
 Sets password for this server.
 
proto external string GetPassword ()
 Returns currently set password for joining the server.
 
proto external int GetModCount ()
 Returns count of how many mods is server using.
 
proto external void RequestJoin (notnull BackendCallback callback, func onDetails=null)
 Will request join to the server which will assign slot for player and provide authentication tokens for encrypted communication with the server.
 
proto external void RequestDetails (notnull BackendCallback callback)
 Will request full details about the server which are not automatically provided when browsing in the catalogue.
 

Detailed Description

Object containing info and interaction methods for game servers.

They are initialized, managed and cleared by native systems and script should only interact with those provided by ServerCatalogueApi.

Member Function Documentation

◆ GetDescription()

proto external string ServerInfo.GetDescription ( )

Returns description of this server.

Note
Details needs to be fetched at least once via RequestDetails() otherwise this will not provide any data.

◆ GetId()

proto external string ServerInfo.GetId ( )

Returns unique ID of this server.

◆ GetMaxPlayers()

proto external int ServerInfo.GetMaxPlayers ( )

Returns count of max players that can be connected to the server.

Note
This should not be used to block user from attempting join the server because he might have reserved slot or space in some join queue.

◆ GetModCount()

proto external int ServerInfo.GetModCount ( )

Returns count of how many mods is server using.

Note
Can be used in ServerBrowser to determine if server is modded or not before requesting more detailed data about the server.

◆ GetName()

proto external string ServerInfo.GetName ( )

Returns name of this server.

◆ GetPassword()

proto external string ServerInfo.GetPassword ( )

Returns currently set password for joining the server.

Note
Servers from ServerCatalogueApi will always have this return "" by default. Can be used to get currently configured password on server side via ServerLobbyApi.

◆ GetPlayerCount()

proto external int ServerInfo.GetPlayerCount ( )

Returns count of currently connected players on the server.

Note
This should not be used to block user from attempting join the server because he might have reserved slot or space in some join queue.

◆ GetSecondsSinceLastJoin()

proto external int ServerInfo.GetSecondsSinceLastJoin ( )

Returns how long ago user last joined this server in seconds.

◆ GetServerType()

proto external EServerType ServerInfo.GetServerType ( )

Returns type of the server which specifies how it was hosted.

◆ IsCrossPlatform()

proto external bool ServerInfo.IsCrossPlatform ( )

Returns true if server supports my and at least one more platform.

◆ IsFavorite()

proto external bool ServerInfo.IsFavorite ( )

Returns true if client has this server marked as favorite.

◆ IsJoinable()

proto external bool ServerInfo.IsJoinable ( )

Returns true if server is in state in which clients can join it.

Note
If server is joinable is determined by the backend. Server might not be joinable because it stopped communicating with the backend due to crash or other issues,

◆ IsMyPlatformSupported()

proto external bool ServerInfo.IsMyPlatformSupported ( )

Returns true if platform of the client is supported by the server.

◆ IsOnline()

proto external bool ServerInfo.IsOnline ( )

Returns true if server is indicated as currently online (running)

◆ IsPasswordProtected()

proto external bool ServerInfo.IsPasswordProtected ( )

Returns true if server requires password for further requests to more detailed info about the server or to request join to the server.

◆ IsVisible()

proto external bool ServerInfo.IsVisible ( )

Returns true if server is configured to be visible in ServerCatalogue.

Note
All servers provided by ServerCatalogueApi should theoretically return as true. Can be useful on server-side ServerLobbyApi when changing live configuration of the server to show to admins current visibility in ServerCatalogueApi.

◆ RequestDetails()

proto external void ServerInfo.RequestDetails ( notnull BackendCallback callback)

Will request full details about the server which are not automatically provided when browsing in the catalogue.

It is not necessary to perform before joining the server since it will always be performed automatically to ensure that client can actually join or to show possible warnings before join.

Warning
This request should be sent only on specific user actions like opening some details dialog. Passworded servers also require to set valid password before providing details.
Note
API Codes to handle:

◆ RequestJoin()

proto external void ServerInfo.RequestJoin ( notnull BackendCallback callback,
func onDetails = null )

Will request join to the server which will assign slot for player and provide authentication tokens for encrypted communication with the server.

This method will also set both JoiningServer and LastServer to this in ServerCatalogueApi.

Parameters
onDetailsis optional function which will be invoked when full server details are received and can be used to make final validations before join. Delete of BackendCallback provided to the request will stop join process.
Exceptions
VME- If server is not joinable - IsJoinable() returns false.
Note
API Codes to handle:
ref BackendCallback myCallback;
ServerInfo serverToJoin;
// simple join with no checks
void Join()
{
serverToJoin.RequestJoin(myCallback); // if callback invokes OnSuccess begin GameTransition to the server.
}
// join with additional validations
void JoinWithValidation()
{
serverToJoin.RequestJoin(myCallback, ValidationMethod); // if callback invokes OnSuccess begin GameTransition to the server.
}
// do some desired validation like there is blocked player on the server
void ValidationMethod()
{
//...
if (blockedPlayerConnected)
{
myCallback = null; // stop joining by deleting the callback
// schedule some UI dialog or any means to inform that join was interrupted
}
// finishing without delete of callback will continue join
}
Object used as callback structure in which you will receive results of Backend requests exposed via S...
Definition BackendCallback.c:72
proto external void RequestJoin(notnull BackendCallback callback, func onDetails=null)
Will request join to the server which will assign slot for player and provide authentication tokens f...

◆ SetFavorite()

proto external void ServerInfo.SetFavorite ( notnull BackendCallback callback,
bool isFavorite )

Will request change for favorite mark state for this server.

Exceptions
VME- if set to state which is already set is attempted IsFavorite() == isFavorite

◆ SetPassword()

proto external void ServerInfo.SetPassword ( string password)

Sets password for this server.

When used for server obtained by ServerCatalogue it will serve for client authentication.


The documentation for this interface was generated from the following file: