Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SpawnHandlerComponent.c File Reference

Go to the source code of this file.

Data Structures

class  SCR_SpawnHandlerComponentClass
 

Functions

protected SCR_RespawnSystemComponent GetRespawnSystemComponent ()
 
protected override void OnPostInit (IEntity owner)
 Editable Mine. More...
 
SCR_ESpawnResult CanHandleRequest_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data)
 
SCR_ESpawnResult HandleRequest_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, out IEntity spawnedEntity)
 
void OnFinalizeBegin_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, IEntity entity)
 Called when the finalisation process begins. More...
 
bool CanFinalize_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, IEntity entity)
 
SCR_ESpawnResult FinalizeRequest_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, IEntity entity)
 
void OnFinalizeDone_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, IEntity entity)
 
protected bool ValidateData_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data)
 
bool CanRequestSpawn_S (SCR_SpawnRequestComponent requestComponent, SCR_SpawnData data, out SCR_ESpawnResult result)
 
protected SCR_ESpawnResult SpawnEntity_S (SCR_SpawnRequestComponent requestComponent, notnull SCR_SpawnData data, out IEntity spawnedEntity)
 
protected bool ValidatePrefab_S (ResourceName resourceName)
 
protected bool PrepareEntity_S (SCR_SpawnRequestComponent requestComponent, IEntity entity, SCR_SpawnData data)
 
protected bool AssignEntity_S (SCR_SpawnRequestComponent requestComponent, IEntity entity, SCR_SpawnData data)
 
protected void HandleSpawnEntityFailure_S (SCR_SpawnRequestComponent requestComponent, IEntity entity, SCR_SpawnData data, SCR_ESpawnResult reason)
 
protected bool ShouldDeleteEntityOnSpawnFailure_S (SCR_SpawnRequestComponent requestComponent, IEntity entity, SCR_SpawnData data, SCR_ESpawnResult reason)
 
protected void HandleEntityChange_S (SCR_SpawnRequestComponent requestComponent, IEntity previousEntity, IEntity newEntity, SCR_SpawnData data)
 

Variables

SCR_SpawnHandlerComponentClass m_RespawnSystemComponent
 
protected bool m_bDestroyPreviousControlledEntity
 
protected bool m_bDeletePreviousControlledEntity
 

Function Documentation

◆ AssignEntity_S()

protected bool AssignEntity_S ( SCR_SpawnRequestComponent  requestComponent,
IEntity  entity,
SCR_SpawnData  data 
)

Assign the entity ownership and set is as the controlled entity of provided player.

Parameters
[in]requestComponent
[in]entity
[in]data
Returns

Definition at line 320 of file SCR_SpawnHandlerComponent.c.

◆ CanFinalize_S()

bool CanFinalize_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data,
IEntity  entity 
)

Called periodically to ask whether finalization can be finished.

Parameters
[in]requestComponent
[in]data
[in]entity
Returns
True to finalize request, resulting in FinalizeRequest_S call, false to await further.

Definition at line 133 of file SCR_SpawnHandlerComponent.c.

◆ CanHandleRequest_S()

SCR_ESpawnResult CanHandleRequest_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data 
)

Can a player be spawned with provided data?

Parameters
[in]requestComponentInstigator of this request
[in]dataRequest/ask data

Definition at line 46 of file SCR_SpawnHandlerComponent.c.

◆ CanRequestSpawn_S()

bool CanRequestSpawn_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data,
out SCR_ESpawnResult  result 
)

Can a player spawn, based on the provided data?

Handle game logic, ask game mode, respawn timers -> anything relevant for proper evaluation.

Parameters
[in]requestComponent
[in]data
[out]result
Returns
true if spawn is possible, false otherwise.

Definition at line 190 of file SCR_SpawnHandlerComponent.c.

◆ FinalizeRequest_S()

SCR_ESpawnResult FinalizeRequest_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data,
IEntity  entity 
)

Finalise request - validate resources, try to spawn, prepare and pass ownership to player.

Parameters
[in]requestComponent
[in]data
[in]entity
Returns

Definition at line 144 of file SCR_SpawnHandlerComponent.c.

◆ GetRespawnSystemComponent()

protected SCR_RespawnSystemComponent GetRespawnSystemComponent ( )
Returns
parent handler manager component.

Definition at line 19 of file SCR_SpawnHandlerComponent.c.

◆ HandleEntityChange_S()

protected void HandleEntityChange_S ( SCR_SpawnRequestComponent  requestComponent,
IEntity  previousEntity,
IEntity  newEntity,
SCR_SpawnData  data 
)

Called after new entity is assigned to the player.

Parameters
[in]requestComponent
[in]previousEntityLast controlled entity or null if none.
[in]newEntityNew controlled entity.
[in]data

Definition at line 384 of file SCR_SpawnHandlerComponent.c.

◆ HandleRequest_S()

SCR_ESpawnResult HandleRequest_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data,
out IEntity  spawnedEntity 
)

Handle request - validate resources, try to spawn, prepare and pass ownership to player.

Parameters
[in]requestComponent
[in]data
[out]spawnedEntity
Returns

Definition at line 82 of file SCR_SpawnHandlerComponent.c.

◆ HandleSpawnEntityFailure_S()

protected void HandleSpawnEntityFailure_S ( SCR_SpawnRequestComponent  requestComponent,
IEntity  entity,
SCR_SpawnData  data,
SCR_ESpawnResult  reason 
)

In cases where an entity is spawned, it might be desirable to dispose of it if it e.g. cannot be prepared, or assigned to the target player. Such cases can be handled by overriding this method. By default, the entity is deleted.

Parameters
[in]requestComponent
[in]entityThe entity that should be spawned, but could not be given over (prepared, assigned, ..)
[in]data
[in]reason

Definition at line 352 of file SCR_SpawnHandlerComponent.c.

◆ OnFinalizeBegin_S()

void OnFinalizeBegin_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data,
IEntity  entity 
)

Called when the finalisation process begins.

Definition at line 121 of file SCR_SpawnHandlerComponent.c.

◆ OnFinalizeDone_S()

void OnFinalizeDone_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data,
IEntity  entity 
)

Request finalized (player spawned).

Parameters
[in]requestComponent
[in]data
[in]entity

Definition at line 104 of file SCR_PossessSpawnHandlerComponent.c.

◆ PrepareEntity_S()

protected bool PrepareEntity_S ( SCR_SpawnRequestComponent  requestComponent,
IEntity  entity,
SCR_SpawnData  data 
)

Prepare an entity on the server side prior to passing ownership. For example in this case character can have items added, can be seated in vehicle, etc.

Parameters
[in]requestComponent
[in]entity
[in]data
Returns

Definition at line 302 of file SCR_SpawnHandlerComponent.c.

◆ ShouldDeleteEntityOnSpawnFailure_S()

protected bool ShouldDeleteEntityOnSpawnFailure_S ( SCR_SpawnRequestComponent  requestComponent,
IEntity  entity,
SCR_SpawnData  data,
SCR_ESpawnResult  reason 
)

Check whether spawned entity should be deleted if the spawn process failed.

Parameters
[in]requestComponent
[in]entity
[in]data
[in]reason
Returns

Definition at line 373 of file SCR_SpawnHandlerComponent.c.

◆ SpawnEntity_S()

protected SCR_ESpawnResult SpawnEntity_S ( SCR_SpawnRequestComponent  requestComponent,
notnull SCR_SpawnData  data,
out IEntity  spawnedEntity 
)
  1. Validate prefab on server
  2. Validate input data on server
  3. Spawn entity on server
  4. Prepare entity on server (e.g. seat in vehicle) On success next step is to Finalise.
    Parameters
    [in]requestComponent
    [in]data
    [out]spawnedEntity
    Returns

Definition at line 211 of file SCR_SpawnHandlerComponent.c.

◆ ValidateData_S()

protected bool ValidateData_S ( SCR_SpawnRequestComponent  requestComponent,
SCR_SpawnData  data 
)

Verifies provided data.

Parameters
[in]requestComponent
[in]data
Returns

Definition at line 174 of file SCR_SpawnHandlerComponent.c.

◆ ValidatePrefab_S()

protected bool ValidatePrefab_S ( ResourceName  resourceName)

Verifies provided prefab.

Parameters
[in]resourceName
Returns
true if provided prefab is a valid and has a controller component.

Definition at line 271 of file SCR_SpawnHandlerComponent.c.

Variable Documentation

◆ m_bDeletePreviousControlledEntity

protected bool m_bDeletePreviousControlledEntity

Definition at line 28 of file SCR_SpawnHandlerComponent.c.

◆ m_bDestroyPreviousControlledEntity

protected bool m_bDestroyPreviousControlledEntity

Definition at line 25 of file SCR_SpawnHandlerComponent.c.

◆ m_RespawnSystemComponent

SCR_SpawnHandlerComponentClass m_RespawnSystemComponent

SCR_SpawnRequestComponent <-> SCR_SpawnHandlerComponent

SCR_SpawnRequestComponent allows communication between client and the authority, SCR_SpawnHandlerComponent handles the requests on authority as desired.

The handler is the authority component of the respawn process which handles client (or authority-issued) request to respawn from a specific player controller and ensures that the spawning process is handled and streamlined. The process is further streamlined via the usage of a unified parent manager, the SCR_RespawnSystemComponent.