Arma Reforger Script API
|
Scripted implementation that handles spawning and respawning of players. More...
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 | IsPauseMenuRespawnEnabled () |
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 |
bool | m_bEnablePauseMenuRespawn |
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 |
Scripted implementation that handles spawning and respawning of players.
Should be attached to a GameMode entity.
void SCR_RespawnSystemComponent.~SCR_RespawnSystemComponent | ( | ) |
bool SCR_RespawnSystemComponent.CanOpenDeployMenu | ( | ) |
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.
[in] | requestComponent | The player request component (instigator). |
[in] | handlerComponent | The handler that passes the event to this manager. |
[in] | data | The data passed from the request |
[out] | result | Reason why respawn is disabled. Note that if returns true the reason will always be OK |
bool SCR_RespawnSystemComponent.CanSetFaction | ( | int | playerId, |
int | factionIndex | ||
) |
bool SCR_RespawnSystemComponent.CanSetLoadout | ( | int | playerId, |
int | loadoutIndex | ||
) |
bool SCR_RespawnSystemComponent.CanSetSpawnPoint | ( | int | playerId, |
RplId | spawnPointId | ||
) |
|
static |
Close all menus operated by Respawn System.
GenericEntity SCR_RespawnSystemComponent.CustomRespawn | ( | int | playerId, |
string | prefab, | ||
vector | position, | ||
vector | rotation = vector.Zero |
||
) |
void SCR_RespawnSystemComponent.DoSetPlayerLoadout | ( | int | playerId, |
int | loadoutIndex | ||
) |
void SCR_RespawnSystemComponent.DoSetPlayerSpawnPoint | ( | int | playerId, |
RplId | spawnPointIdentity | ||
) |
float SCR_RespawnSystemComponent.GetDeployMenuOpenDelay_ms | ( | ) |
Faction SCR_RespawnSystemComponent.GetFactionByIndex | ( | int | factionIndex | ) |
int SCR_RespawnSystemComponent.GetFactionIndex | ( | Faction | faction | ) |
int SCR_RespawnSystemComponent.GetFactionPlayerCount | ( | Faction | faction | ) |
|
static |
SCR_BasePlayerLoadout SCR_RespawnSystemComponent.GetLoadoutByIndex | ( | int | loadoutIndex | ) |
int SCR_RespawnSystemComponent.GetLoadoutIndex | ( | SCR_BasePlayerLoadout | loadout | ) |
int SCR_RespawnSystemComponent.GetLoadoutPlayerCount | ( | SCR_BasePlayerLoadout | loadout | ) |
[in] | loadout |
|
static |
ScriptInvoker SCR_RespawnSystemComponent.GetOnRespawnEnabledChanged | ( | ) |
Faction SCR_RespawnSystemComponent.GetPlayerFaction | ( | int | playerId | ) |
Try to get player faction from PlayerRespawnInfo If faction index is within valid bounds, return Faction otherwise null.
SCR_BasePlayerLoadout SCR_RespawnSystemComponent.GetPlayerLoadout | ( | int | playerId | ) |
RplComponent SCR_RespawnSystemComponent.GetRplComponent | ( | ) |
Access to replication component.
SCR_SpawnLogic SCR_RespawnSystemComponent.GetSpawnLogic | ( | ) |
SCR_BaseSpawnPointRequestResultInfo SCR_RespawnSystemComponent.GetSpawnPointRequestResultInfo | ( | SCR_SpawnRequestComponent | requestComponent, |
SCR_ESpawnResult | response, | ||
SCR_SpawnData | data | ||
) |
[in] | requestComponent | |
[in] | response | |
[in] | data |
bool SCR_RespawnSystemComponent.IsFactionChangeAllowed | ( | ) |
bool SCR_RespawnSystemComponent.IsPauseMenuRespawnEnabled | ( | ) |
bool SCR_RespawnSystemComponent.IsRespawnEnabled | ( | ) |
|
static |
Simple getter for other.
override void SCR_RespawnSystemComponent.OnInit | ( | IEntity | owner | ) |
Called during EOnInit.
owner | Entity this component is attached to. |
Implements RespawnSystemComponent.
void SCR_RespawnSystemComponent.OnPlayerDeleted_S | ( | int | playerId | ) |
[in] | playerId |
void SCR_RespawnSystemComponent.OnPlayerDisconnected_S | ( | int | playerId, |
KickCauseCode | cause, | ||
int | timeout | ||
) |
[in] | playerId | |
[in] | cause | |
[in] | timeout |
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).
[in] | requestComponent | Instigator of the request. |
[in] | handlerComponent | Handler that processed the request. |
[in] | previousEntity | Previously controlled entity. (May be null) |
[in] | newEntity | Entity to be controlled. |
[in] | data | The payload of the request. |
void SCR_RespawnSystemComponent.OnPlayerKilled_S | ( | int | playerId, |
IEntity | playerEntity, | ||
IEntity | killerEntity, | ||
notnull Instigator | killer | ||
) |
[in] | playerId | |
[in] | playerEntity | |
[in] | killerEntity | |
[in] | killer |
void SCR_RespawnSystemComponent.OnPlayerRegistered_S | ( | int | playerId | ) |
[in] | playerId |
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.
[in] | requestComponent | Instigator of the request. |
[in] | handlerComponent | Handler that processed the request. |
[in] | data | The payload of the request. |
[in] | entity | Spawned (or generally assigned) entity. |
|
protected |
Deserialize data received from server on JIP.
r | Bit reader instance |
Implements RespawnSystemComponent.
|
protected |
Serialize server network data for JIP clients.
w | Bit writer instance |
Implements RespawnSystemComponent.
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.
|
static |
UI management.
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.
[in] | requestComponent | Instigator of the request. |
[in] | handlerComponent | Handler that processed the request. |
[in] | data | The payload of the request. |
[in] | entity | Spawned (or generally assigned) entity to be prepared. |
|
protected |
Called when some player controller requests respawn.
Implements RespawnSystemComponent.
void SCR_RespawnSystemComponent.ServerSetEnableRespawn | ( | bool | enableSpawning | ) |
Set respawn enabled Server only.
[in] | enableSpawning | set respawn enabled or not |
|
protected |
[in] | enableSpawning |
void SCR_RespawnSystemComponent.SetPlayerFaction | ( | int | playerId, |
int | factionIndex | ||
) |
void SCR_RespawnSystemComponent.SetPlayerLoadout | ( | int | playerId, |
int | loadoutIndex | ||
) |
|
static |
Close all menus operated by Respawn System.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Parent entity's rpl component.
|
protected |
|
protected |
|
protected |