Endstar LUA API Documentation
Loading...
Searching...
No Matches
Game Class Reference

Allows you to access information about the current session including players, level, and game info. More...

Public Member Functions

 Game ()
 
int GetPlayerCount ()
 How many players are currently connected?
 
Context GetPlayerByIndex (int playerIndex)
 Get a player by index. This starts at 0, and will have no gaps. Easy to use with GetPlayerCount.
 
Context GetPlayerBySlot (int playerSlot)
 Returns the player's context currently in the requested slot. Note that if players have left there may be gaps in the slots, and that slots start at 1. The slot number is the same number you see displayed with the player name + hearts.
 
Context[] GetPlayers ()
 Get all the currently connected player's contexts!
 
string GetGameTitle ()
 
string GetGameDescription ()
 
string GetLevelName ()
 Gets the name of the currently loaded level.
 
string GetLevelDescription ()
 Gets the description of the currently loaded level.
 
int GetMinPlayerCount ()
 Gets the minimum number of players required to play this game. Currently unused, but will eventually be searchable and enforceable.
 
int GetMaxPlayerCount ()
 Gets the maximum number of players allowed to play this game. Currently unused, but will eventually be searchable and enforceable.
 
void Teleport (Context instigator, Context teleportTarget, UnityEngine.Vector3 position, float rotation, int teleportType)
 Teleport a context to a position.
 
void Teleport (Context instigator, Context teleportTarget, UnityEngine.Vector3 position, float rotation, int teleportType, bool snapPlayerCamera)
 Teleport a context to a position.
 
void Teleport (Context instigator, Context teleportTarget, UnityEngine.Vector3 position, int teleportType)
 Teleport a context to a position.
 
void Teleport (Context instigator, Context teleportTarget, CellReference cellReference, int teleportType)
 Teleport a context to a cell.
 
void Teleport (Context instigator, Context teleportTarget, CellReference cellReference, int teleportType, bool snapPlayerCamera)
 Teleport a context to a cell.
 

Public Attributes

LuaInterfaceEvent OnPlayerCountChanged = new()
 Subscribe to this to get updates when the number of players changes! Broadcasts the game's context and current player count.
 
LuaInterfaceEvent OnPlayerLeft = new()
 Subscribe to this to get updates when a player leaves! Broadcasts the leaving player's context.
 
LuaInterfaceEvent OnPlayerJoined = new()
 Subscribe to this to get updates when a player leaves! Broadcasts the newly joined player's context.
 

Detailed Description

Allows you to access information about the current session including players, level, and game info.

Constructor & Destructor Documentation

◆ Game()

Game ( )

Member Function Documentation

◆ GetGameDescription()

string GetGameDescription ( )

◆ GetGameTitle()

string GetGameTitle ( )

◆ GetLevelDescription()

string GetLevelDescription ( )

Gets the description of the currently loaded level.

Returns

◆ GetLevelName()

string GetLevelName ( )

Gets the name of the currently loaded level.

Returns

◆ GetMaxPlayerCount()

int GetMaxPlayerCount ( )

Gets the maximum number of players allowed to play this game. Currently unused, but will eventually be searchable and enforceable.

Returns

◆ GetMinPlayerCount()

int GetMinPlayerCount ( )

Gets the minimum number of players required to play this game. Currently unused, but will eventually be searchable and enforceable.

Returns

◆ GetPlayerByIndex()

Context GetPlayerByIndex ( int playerIndex)

Get a player by index. This starts at 0, and will have no gaps. Easy to use with GetPlayerCount.

Parameters
playerIndex
Returns
Nil if invalid index

◆ GetPlayerBySlot()

Context GetPlayerBySlot ( int playerSlot)

Returns the player's context currently in the requested slot. Note that if players have left there may be gaps in the slots, and that slots start at 1. The slot number is the same number you see displayed with the player name + hearts.

Parameters
playerSlot
Returns

◆ GetPlayerCount()

int GetPlayerCount ( )

How many players are currently connected?

Returns

◆ GetPlayers()

Context[] GetPlayers ( )

Get all the currently connected player's contexts!

Returns

◆ Teleport() [1/5]

void Teleport ( Context instigator,
Context teleportTarget,
CellReference cellReference,
int teleportType )

Teleport a context to a cell.

Parameters
instigatorThe source context of this change
teleportTargetThe context to teleport
cellReferenceThe Cell Reference to teleport to
teleportTypeThe type of teleport as TeleportType

◆ Teleport() [2/5]

void Teleport ( Context instigator,
Context teleportTarget,
CellReference cellReference,
int teleportType,
bool snapPlayerCamera )

Teleport a context to a cell.

Parameters
instigatorThe source context of this change
teleportTargetThe context to teleport
cellReferenceThe Cell Reference to teleport to
snapPlayerCameraShould the teleported player's camera be set to teleport rotation?
teleportTypeThe type of teleport as TeleportType

◆ Teleport() [3/5]

void Teleport ( Context instigator,
Context teleportTarget,
UnityEngine.Vector3 position,
float rotation,
int teleportType )

Teleport a context to a position.

Parameters
instigatorThe source context of this change
teleportTargetThe context to teleport
positionThe position to teleport to
rotationThe rotation to teleport to (0-360)
teleportTypeThe type of teleport as TeleportType

◆ Teleport() [4/5]

void Teleport ( Context instigator,
Context teleportTarget,
UnityEngine.Vector3 position,
float rotation,
int teleportType,
bool snapPlayerCamera )

Teleport a context to a position.

Parameters
instigatorThe source context of this change
teleportTargetThe context to teleport
positionThe position to teleport to
rotationThe rotation to teleport to (0-360)
snapPlayerCameraShould the teleported player's camera be set to teleport rotation?
teleportTypeThe type of teleport as TeleportType

◆ Teleport() [5/5]

void Teleport ( Context instigator,
Context teleportTarget,
UnityEngine.Vector3 position,
int teleportType )

Teleport a context to a position.

Parameters
instigatorThe source context of this change
teleportTargetThe context to teleport
positionThe position to teleport to
teleportTypeThe type of teleport as TeleportType

Member Data Documentation

◆ OnPlayerCountChanged

LuaInterfaceEvent OnPlayerCountChanged = new()

Subscribe to this to get updates when the number of players changes! Broadcasts the game's context and current player count.

◆ OnPlayerJoined

LuaInterfaceEvent OnPlayerJoined = new()

Subscribe to this to get updates when a player leaves! Broadcasts the newly joined player's context.

◆ OnPlayerLeft

LuaInterfaceEvent OnPlayerLeft = new()

Subscribe to this to get updates when a player leaves! Broadcasts the leaving player's context.