Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SCR_RespawnSystemComponent Interface Reference

Scripted implementation that handles spawning and respawning of players. More...

Inheritance diagram for SCR_RespawnSystemComponent:
[legend]

Public Member Functions

SCR_BaseSpawnPointRequestResultInfo GetSpawnPointRequestResultInfo (SCR_SpawnRequestComponent requestComponent, SCR_ESpawnResult response, SCR_SpawnData data)
 
RplComponent GetRplComponent ()
 Access to replication component.
 
GenericEntity CustomRespawn (int playerId, string prefab, vector position, vector rotation=vector.Zero)
 
bool CanSetLoadout (int playerId, int loadoutIndex)
 
void DoSetPlayerLoadout (int playerId, int loadoutIndex)
 
bool CanSetFaction (int playerId, int factionIndex)
 
bool CanSetSpawnPoint (int playerId, RplId spawnPointId)
 
void DoSetPlayerSpawnPoint (int playerId, RplId spawnPointIdentity)
 
int GetFactionPlayerCount (Faction faction)
 
int GetLoadoutPlayerCount (SCR_BasePlayerLoadout loadout)
 
void SetPlayerLoadout (int playerId, int loadoutIndex)
 
void SetPlayerFaction (int playerId, int factionIndex)
 
Faction GetFactionByIndex (int factionIndex)
 
int GetFactionIndex (Faction faction)
 
Faction GetPlayerFaction (int playerId)
 Try to get player faction from PlayerRespawnInfo If faction index is within valid bounds, return Faction otherwise null.
 
SCR_BasePlayerLoadout GetLoadoutByIndex (int loadoutIndex)
 
SCR_BasePlayerLoadout GetPlayerLoadout (int playerId)
 
int GetLoadoutIndex (SCR_BasePlayerLoadout loadout)
 
void ServerSetEnableRespawn (bool enableSpawning)
 Set respawn enabled Server only.
 
bool IsRespawnEnabled ()
 
bool IsFactionChangeAllowed ()
 
ScriptInvoker GetOnRespawnEnabledChanged ()
 
bool CanRequestSpawn_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, out SCR_ESpawnResult result=SCR_ESpawnResult.SPAWN_NOT_ALLOWED)
 Authority only: Whenever a SCR_SpawnHandlerComponent receives a request from SCR_SpawnRequestComponent that needs to verify whether a player can spawn in addition to the SCR_SpawnHandlerComponent logic (per-case logic), this method is called to allow handling logic on a global scale.
 
bool PreparePlayerEntity_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
 Authority only: During the spawn process (after validation pass), the SCR_SpawnHandlerComponent can opt to prepare spawned entity.
 
void OnPlayerEntityChange_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, IEntity previousEntity, IEntity newEntity, SCR_SpawnData data)
 Authority only: During the spawn process the SCR_SpawnHandlerComponent can opt to handle changes of previous (and next) controlled (or newly spawned) entity for the given player.
 
void OnSpawnPlayerEntityFailure_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, IEntity entity, SCR_SpawnData data, SCR_ESpawnResult reason)
 Authority only: Whenever a request to spawn is denied by the authority, this callback is raised.
 
void OnPlayerSpawnFinalize_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
 Authority only: Whenever a SCR_SpawnHandlerComponent processes a spawn request and finished the finalization stage (awaits finalization, passes control to client) this method is called.
 
void OnPlayerRegistered_S (int playerId)
 
void OnPlayerDisconnected_S (int playerId, KickCauseCode cause, int timeout)
 
void OnPlayerKilled_S (int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
 
void OnPlayerDeleted_S (int playerId)
 
float GetDeployMenuOpenDelay_ms ()
 
bool CanOpenDeployMenu ()
 
SCR_SpawnLogic GetSpawnLogic ()
 
override void OnInit (IEntity owner)
 Called during EOnInit.
 
void ~SCR_RespawnSystemComponent ()
 
- Public Member Functions inherited from RespawnSystemComponent
proto external GenericEntity DoSpawn (string prefab, vector position, vector rotation="0 0 0")
 call to create actual entity from given prefab at given position
 
void OnInit (IEntity owner)
 Called during EOnInit.
 
GenericEntity RequestSpawn (int playerId)
 Called when some player controller requests respawn.
 
- Public Member Functions inherited from GameComponent
bool OnTicksOnRemoteProxy ()
 

Static Public Member Functions

static SCR_RespawnSystemComponent GetInstance ()
 
static Faction GetLocalPlayerFaction (IEntity player=null)
 
static MenuBase OpenRespawnMenu ()
 UI management.
 
static void CloseRespawnMenu ()
 Close all menus operated by Respawn System.
 
static bool IsRespawnMenuOpened ()
 Simple getter for other.
 
static void ToggleRespawnMenu ()
 Close all menus operated by Respawn System.
 

Protected Member Functions

override GenericEntity RequestSpawn (int playerId)
 Called when some player controller requests respawn.
 
void SetEnableRespawnBroadcast (bool enableSpawning)
 
override bool OnRplSave (ScriptBitWriter w)
 Serialize server network data for JIP clients.
 
override bool OnRplLoad (ScriptBitReader r)
 Deserialize data received from server on JIP.
 
bool OnRplSave (ScriptBitWriter w)
 Serialize server network data for JIP clients.
 
bool OnRplLoad (ScriptBitReader r)
 Deserialize data received from server on JIP.
 

Protected Attributes

ref SCR_SpawnLogic m_SpawnLogic
 
bool m_bEnableRespawn
 
float m_fDeployMenuOpenDelay
 
ResourceName m_sSpawnPointRequestResultInfoHolder
 
ref SCR_SpawnPointRequestResultInfoConfig m_SpawnPointRequestResultInfoHolder
 
SCR_BaseGameMode m_pGameMode
 
RplComponent m_pRplComponent
 
RplComponent m_RplComponent
 Parent entity's rpl component.
 
ref SimplePreload m_Preload
 
ref ScriptInvoker Event_OnRespawnEnabledChanged
 

Detailed Description

Scripted implementation that handles spawning and respawning of players.

Should be attached to a GameMode entity.

Constructor & Destructor Documentation

◆ ~SCR_RespawnSystemComponent()

void SCR_RespawnSystemComponent.~SCR_RespawnSystemComponent ( )

Member Function Documentation

◆ CanOpenDeployMenu()

bool SCR_RespawnSystemComponent.CanOpenDeployMenu ( )
Returns

◆ CanRequestSpawn_S()

bool SCR_RespawnSystemComponent.CanRequestSpawn_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnHandlerComponent  handlerComponent,
SCR_SpawnData  data,
out SCR_ESpawnResult  result = SCR_ESpawnResult::SPAWN_NOT_ALLOWED 
)

Authority only: Whenever a SCR_SpawnHandlerComponent receives a request from SCR_SpawnRequestComponent that needs to verify whether a player can spawn in addition to the SCR_SpawnHandlerComponent logic (per-case logic), this method is called to allow handling logic on a global scale.

Parameters
[in]requestComponentThe player request component (instigator).
[in]handlerComponentThe handler that passes the event to this manager.
[in]dataThe data passed from the request
[out]resultReason why respawn is disabled. Note that if returns true the reason will always be OK
Returns
true If request is allowed, false otherwise.

◆ CanSetFaction()

bool SCR_RespawnSystemComponent.CanSetFaction ( int  playerId,
int  factionIndex 
)

◆ CanSetLoadout()

bool SCR_RespawnSystemComponent.CanSetLoadout ( int  playerId,
int  loadoutIndex 
)

◆ CanSetSpawnPoint()

bool SCR_RespawnSystemComponent.CanSetSpawnPoint ( int  playerId,
RplId  spawnPointId 
)

◆ CloseRespawnMenu()

static void SCR_RespawnSystemComponent.CloseRespawnMenu ( )
static

Close all menus operated by Respawn System.

◆ CustomRespawn()

GenericEntity SCR_RespawnSystemComponent.CustomRespawn ( int  playerId,
string  prefab,
vector  position,
vector  rotation = vector.Zero 
)

◆ DoSetPlayerLoadout()

void SCR_RespawnSystemComponent.DoSetPlayerLoadout ( int  playerId,
int  loadoutIndex 
)

◆ DoSetPlayerSpawnPoint()

void SCR_RespawnSystemComponent.DoSetPlayerSpawnPoint ( int  playerId,
RplId  spawnPointIdentity 
)

◆ GetDeployMenuOpenDelay_ms()

float SCR_RespawnSystemComponent.GetDeployMenuOpenDelay_ms ( )
Returns

◆ GetFactionByIndex()

Faction SCR_RespawnSystemComponent.GetFactionByIndex ( int  factionIndex)

◆ GetFactionIndex()

int SCR_RespawnSystemComponent.GetFactionIndex ( Faction  faction)

◆ GetFactionPlayerCount()

int SCR_RespawnSystemComponent.GetFactionPlayerCount ( Faction  faction)

◆ GetInstance()

static SCR_RespawnSystemComponent SCR_RespawnSystemComponent.GetInstance ( )
static
Returns
an instance of RespawnSystemComponent

◆ GetLoadoutByIndex()

SCR_BasePlayerLoadout SCR_RespawnSystemComponent.GetLoadoutByIndex ( int  loadoutIndex)

◆ GetLoadoutIndex()

int SCR_RespawnSystemComponent.GetLoadoutIndex ( SCR_BasePlayerLoadout  loadout)

◆ GetLoadoutPlayerCount()

int SCR_RespawnSystemComponent.GetLoadoutPlayerCount ( SCR_BasePlayerLoadout  loadout)
Parameters
[in]loadout
Returns

◆ GetLocalPlayerFaction()

static Faction SCR_RespawnSystemComponent.GetLocalPlayerFaction ( IEntity  player = null)
static
Returns
either a valid Faction of local player character or null

◆ GetOnRespawnEnabledChanged()

ScriptInvoker SCR_RespawnSystemComponent.GetOnRespawnEnabledChanged ( )
Returns
script invoker which is called when server enables or disables respawn

◆ GetPlayerFaction()

Faction SCR_RespawnSystemComponent.GetPlayerFaction ( int  playerId)

Try to get player faction from PlayerRespawnInfo If faction index is within valid bounds, return Faction otherwise null.

◆ GetPlayerLoadout()

SCR_BasePlayerLoadout SCR_RespawnSystemComponent.GetPlayerLoadout ( int  playerId)

◆ GetRplComponent()

RplComponent SCR_RespawnSystemComponent.GetRplComponent ( )

Access to replication component.

◆ GetSpawnLogic()

SCR_SpawnLogic SCR_RespawnSystemComponent.GetSpawnLogic ( )
Returns

◆ GetSpawnPointRequestResultInfo()

SCR_BaseSpawnPointRequestResultInfo SCR_RespawnSystemComponent.GetSpawnPointRequestResultInfo ( SCR_SpawnRequestComponent  requestComponent,
SCR_ESpawnResult  response,
SCR_SpawnData  data 
)
Parameters
[in]requestComponent
[in]response
[in]data
Returns

◆ IsFactionChangeAllowed()

bool SCR_RespawnSystemComponent.IsFactionChangeAllowed ( )
Returns
true if faction change is allowed by the game mode, false otherwise.

◆ IsRespawnEnabled()

bool SCR_RespawnSystemComponent.IsRespawnEnabled ( )
Returns
true if respawn is enabled, false otherwise

◆ IsRespawnMenuOpened()

static bool SCR_RespawnSystemComponent.IsRespawnMenuOpened ( )
static

Simple getter for other.

◆ OnInit()

override void SCR_RespawnSystemComponent.OnInit ( IEntity  owner)

Called during EOnInit.

Parameters
ownerEntity this component is attached to.

Implements RespawnSystemComponent.

◆ OnPlayerDeleted_S()

void SCR_RespawnSystemComponent.OnPlayerDeleted_S ( int  playerId)
Parameters
[in]playerId

◆ OnPlayerDisconnected_S()

void SCR_RespawnSystemComponent.OnPlayerDisconnected_S ( int  playerId,
KickCauseCode  cause,
int  timeout 
)
Parameters
[in]playerId
[in]cause
[in]timeout

◆ OnPlayerEntityChange_S()

void SCR_RespawnSystemComponent.OnPlayerEntityChange_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnHandlerComponent  handlerComponent,
IEntity  previousEntity,
IEntity  newEntity,
SCR_SpawnData  data 
)

Authority only: During the spawn process the SCR_SpawnHandlerComponent can opt to handle changes of previous (and next) controlled (or newly spawned) entity for the given player.

Such process additionally raises this method, which can handle entity changes on a global scale. (E.g. game mode logic).

Parameters
[in]requestComponentInstigator of the request.
[in]handlerComponentHandler that processed the request.
[in]previousEntityPreviously controlled entity. (May be null)
[in]newEntityEntity to be controlled.
[in]dataThe payload of the request.

◆ OnPlayerKilled_S()

void SCR_RespawnSystemComponent.OnPlayerKilled_S ( int  playerId,
IEntity  playerEntity,
IEntity  killerEntity,
notnull Instigator  killer 
)
Parameters
[in]playerId
[in]playerEntity
[in]killerEntity
[in]killer

◆ OnPlayerRegistered_S()

void SCR_RespawnSystemComponent.OnPlayerRegistered_S ( int  playerId)
Parameters
[in]playerId

◆ OnPlayerSpawnFinalize_S()

void SCR_RespawnSystemComponent.OnPlayerSpawnFinalize_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnHandlerComponent  handlerComponent,
SCR_SpawnData  data,
IEntity  entity 
)

Authority only: Whenever a SCR_SpawnHandlerComponent processes a spawn request and finished the finalization stage (awaits finalization, passes control to client) this method is called.

This is the final step in the respawn process and after this point the owner of SCR_SpawnRequestComponent is spawned.

Parameters
[in]requestComponentInstigator of the request.
[in]handlerComponentHandler that processed the request.
[in]dataThe payload of the request.
[in]entitySpawned (or generally assigned) entity.

◆ OnRplLoad()

override bool SCR_RespawnSystemComponent.OnRplLoad ( ScriptBitReader  r)
protected

Deserialize data received from server on JIP.

Parameters
rBit reader instance

Implements RespawnSystemComponent.

◆ OnRplSave()

override bool SCR_RespawnSystemComponent.OnRplSave ( ScriptBitWriter  w)
protected

Serialize server network data for JIP clients.

Parameters
wBit writer instance

Implements RespawnSystemComponent.

◆ OnSpawnPlayerEntityFailure_S()

void SCR_RespawnSystemComponent.OnSpawnPlayerEntityFailure_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnHandlerComponent  handlerComponent,
IEntity  entity,
SCR_SpawnData  data,
SCR_ESpawnResult  reason 
)

Authority only: Whenever a request to spawn is denied by the authority, this callback is raised.

◆ OpenRespawnMenu()

static MenuBase SCR_RespawnSystemComponent.OpenRespawnMenu ( )
static

UI management.

◆ PreparePlayerEntity_S()

bool SCR_RespawnSystemComponent.PreparePlayerEntity_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnHandlerComponent  handlerComponent,
SCR_SpawnData  data,
IEntity  entity 
)

Authority only: During the spawn process (after validation pass), the SCR_SpawnHandlerComponent can opt to prepare spawned entity.

This process first happens on affiliated SCR_SpawnHandlerComponent and if it succeeds, it additionally raises this method, which can prepare entity on a global scale. (E.g. game mode logic) Preparation can still fail (e.g. desire to seat a character, but an error occurs) and by returning false the sender is informed of such failure and can respond accordingly.

Parameters
[in]requestComponentInstigator of the request.
[in]handlerComponentHandler that processed the request.
[in]dataThe payload of the request.
[in]entitySpawned (or generally assigned) entity to be prepared.
Returns
true on success (continue to next step), fail on failure (terminate spawn process).

◆ RequestSpawn()

override GenericEntity SCR_RespawnSystemComponent.RequestSpawn ( int  playerId)
protected

Called when some player controller requests respawn.

Implements RespawnSystemComponent.

◆ ServerSetEnableRespawn()

void SCR_RespawnSystemComponent.ServerSetEnableRespawn ( bool  enableSpawning)

Set respawn enabled Server only.

Parameters
[in]enableSpawningset respawn enabled or not

◆ SetEnableRespawnBroadcast()

void SCR_RespawnSystemComponent.SetEnableRespawnBroadcast ( bool  enableSpawning)
protected
Parameters
[in]enableSpawning

◆ SetPlayerFaction()

void SCR_RespawnSystemComponent.SetPlayerFaction ( int  playerId,
int  factionIndex 
)

◆ SetPlayerLoadout()

void SCR_RespawnSystemComponent.SetPlayerLoadout ( int  playerId,
int  loadoutIndex 
)

◆ ToggleRespawnMenu()

static void SCR_RespawnSystemComponent.ToggleRespawnMenu ( )
static

Close all menus operated by Respawn System.

Member Data Documentation

◆ Event_OnRespawnEnabledChanged

ref ScriptInvoker SCR_RespawnSystemComponent.Event_OnRespawnEnabledChanged
protected

◆ m_bEnableRespawn

bool SCR_RespawnSystemComponent.m_bEnableRespawn
protected

◆ m_fDeployMenuOpenDelay

float SCR_RespawnSystemComponent.m_fDeployMenuOpenDelay
protected

◆ m_pGameMode

SCR_BaseGameMode SCR_RespawnSystemComponent.m_pGameMode
protected

◆ m_Preload

ref SimplePreload SCR_RespawnSystemComponent.m_Preload
protected

◆ m_pRplComponent

RplComponent SCR_RespawnSystemComponent.m_pRplComponent
protected

◆ m_RplComponent

RplComponent SCR_RespawnSystemComponent.m_RplComponent
protected

Parent entity's rpl component.

◆ m_SpawnLogic

ref SCR_SpawnLogic SCR_RespawnSystemComponent.m_SpawnLogic
protected

◆ m_SpawnPointRequestResultInfoHolder

ref SCR_SpawnPointRequestResultInfoConfig SCR_RespawnSystemComponent.m_SpawnPointRequestResultInfoHolder
protected

◆ m_sSpawnPointRequestResultInfoHolder

ResourceName SCR_RespawnSystemComponent.m_sSpawnPointRequestResultInfoHolder
protected

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