Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PossessSpawnRequestComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Respawn/PlayerController")]
3 {
4 }
5 
6 class SCR_PossessSpawnRequestComponent : SCR_SpawnRequestComponent
7 {
8  //------------------------------------------------------------------------------------------------
9  override typename GetHandlerType()
10  {
11  return SCR_PossessSpawnHandlerComponent;
12  }
13 
14  //------------------------------------------------------------------------------------------------
15  override typename GetDataType()
16  {
17  return SCR_PossessSpawnData;
18  }
19 
20  //------------------------------------------------------------------------------------------------
21  protected override bool DoCanRequestRespawn(SCR_SpawnData data)
22  {
23  #ifdef _ENABLE_RESPAWN_LOGS
24  Print(string.Format("%1::DoCanRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
25  GetPlayerController().GetPlayerId(), data), LogLevel.NORMAL);
26  #endif
27 
29  if (!possessData)
30  return false;
31 
32  Rpc(Rpc_CanRequestRespawn_S, possessData.GetRplId());
33  return true;
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
38  private void Rpc_CanRequestRespawn_S(RplId entityRplId)
39  {
40  #ifdef _ENABLE_RESPAWN_LOGS
41  Print(string.Format("%1::Rpc_CanRequestRespawn_S(playerId: %2, entityRplId: %3)", Type().ToString(),
43  entityRplId), LogLevel.NORMAL);
44  #endif
45 
46  SCR_PossessSpawnData data = SCR_PossessSpawnData.FromRplId(entityRplId);
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  protected override bool DoRequestRespawn(SCR_SpawnData data)
52  {
53  #ifdef _ENABLE_RESPAWN_LOGS
54  Print(string.Format("%1::DoRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
55  GetPlayerController().GetPlayerId(), data), LogLevel.NORMAL);
56  #endif
57 
59  if (!possessData)
60  return false;
61 
62  Rpc(Rpc_RequestRespawn_S, possessData.GetRplId());
63  return true;
64  }
65 
66  //------------------------------------------------------------------------------------------------
67  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
68  private void Rpc_RequestRespawn_S(RplId entityRplId)
69  {
70  #ifdef _ENABLE_RESPAWN_LOGS
71  Print(string.Format("%1::Rpc_RequestRespawn_S(playerId: %2, entityRplId: %3)", Type().ToString(),
73  entityRplId), LogLevel.NORMAL);
74  #endif
75 
76  SCR_PossessSpawnData possessData = SCR_PossessSpawnData.FromRplId(entityRplId);
77  ProcessRequest_S(possessData);
78  }
79 
80  #ifdef ENABLE_DIAG
81  //------------------------------------------------------------------------------------------------
82  override SCR_BaseRespawnDiag CreateDiag()
83  {
84  return new SCR_PossessRespawnDiag();
85  }
86  #endif
87 }
88 
89 #ifdef ENABLE_DIAG
90 class SCR_PossessRespawnDiag : SCR_RespawnDiag<SCR_PossessSpawnRequestComponent>
91 {
92  protected int m_RplId;
93 
94  //------------------------------------------------------------------------------------------------
95  override void DrawContent()
96  {
97  super.DrawContent();
98  DbgUI.InputInt("Entity RplId: ", m_RplId);
99  }
100 
101  //------------------------------------------------------------------------------------------------
102  protected override SCR_SpawnData CreateData()
103  {
104  return SCR_PossessSpawnData.FromRplId(m_RplId);
105  }
106 }
107 #endif
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
ProcessRequest_S
protected void ProcessRequest_S(SCR_SpawnData data)
Definition: SCR_SpawnRequestComponent.c:341
ProcessCanRequest_S
protected void ProcessCanRequest_S(SCR_SpawnData data)
Definition: SCR_SpawnRequestComponent.c:208
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
SCR_SpawnRequestComponentClass
Definition: SCR_SpawnRequestComponent.c:1
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
SCR_SpawnData
Definition: SCR_SpawnData.c:9
SCR_PossessSpawnRequestComponentClass
Definition: SCR_PossessSpawnRequestComponent.c:2
DoRequestRespawn
protected override bool DoRequestRespawn(SCR_SpawnData data)
Definition: SCR_PossessSpawnRequestComponent.c:51
Rpc_RequestRespawn_S
private void Rpc_RequestRespawn_S(RplId entityRplId)
Definition: SCR_PossessSpawnRequestComponent.c:68
GetHandlerType
SCR_PossessSpawnRequestComponentClass SCR_SpawnRequestComponentClass GetHandlerType()
Definition: SCR_PossessSpawnRequestComponent.c:9
Rpc_CanRequestRespawn_S
private void Rpc_CanRequestRespawn_S(RplId entityRplId)
Definition: SCR_PossessSpawnRequestComponent.c:38
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
SCR_PossessSpawnData
Definition: SCR_PossessSpawnData.c:2
GetDataType
override GetDataType()
Definition: SCR_PossessSpawnRequestComponent.c:15
DoCanRequestRespawn
protected override bool DoCanRequestRespawn(SCR_SpawnData data)
Definition: SCR_PossessSpawnRequestComponent.c:21
GetPlayerId
proto external int GetPlayerId()
Definition: SCR_SpawnRequestComponent.c:39
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180