Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SpawnPointSpawnRequestComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Respawn/PlayerController")]
3 {
4 }
5 
6 class SCR_SpawnPointRespawnRequestComponent : SCR_SpawnRequestComponent
7 {
8  //------------------------------------------------------------------------------------------------
9  override typename GetHandlerType()
10  {
11  return SCR_SpawnPointSpawnHandlerComponent;
12  }
13 
14  //------------------------------------------------------------------------------------------------
15  override typename GetDataType()
16  {
18  }
19 
20  //------------------------------------------------------------------------------------------------
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 (!spawnPointData)
30  return false;
31 
32  Rpc(Rpc_CanRequestRespawn_S, spawnPointData.GetRplId(), spawnPointData.GetPrefab());
33  return true;
34  }
35 
36  //------------------------------------------------------------------------------------------------
37  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
38  private void Rpc_CanRequestRespawn_S(int spawnPointId, ResourceName prefab)
39  {
40  #ifdef _ENABLE_RESPAWN_LOGS
41  Print(string.Format("%1::Rpc_CanRequestRespawn_S(playerId: %2, spawnPointId: %3, pref: %4)", Type().ToString(),
43  spawnPointId,
44  prefab), LogLevel.NORMAL);
45  #endif
46 
47  // Prepare data for handler
48  SCR_SpawnPointSpawnData data = new SCR_SpawnPointSpawnData(prefab, spawnPointId);
50  }
51 
52  //------------------------------------------------------------------------------------------------
54  {
55  #ifdef _ENABLE_RESPAWN_LOGS
56  Print(string.Format("%1::DoRequestRespawn(playerId: %2, data: %3)", Type().ToString(),
57  GetPlayerController().GetPlayerId(), data), LogLevel.NORMAL);
58  #endif
59 
61  if (!spawnPointData)
62  return false;
63 
64  Rpc(Rpc_RequestRespawn_S, spawnPointData.GetRplId(), spawnPointData.GetPrefab());
65  return true;
66  }
67 
68  //------------------------------------------------------------------------------------------------
69  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
70  private void Rpc_RequestRespawn_S(int spawnPointId, ResourceName prefab)
71  {
72  #ifdef _ENABLE_RESPAWN_LOGS
73  Print(string.Format("%1::Rpc_RequestRespawn_S(playerId: %2, spawnPointId: %3, pref: %4)", Type().ToString(),
75  spawnPointId,
76  prefab), LogLevel.NORMAL);
77  #endif
78 
79  // Prepare data for handler
80  SCR_SpawnPointSpawnData data = new SCR_SpawnPointSpawnData(prefab, spawnPointId);
82  }
83 
84  #ifdef ENABLE_DIAG
85  //------------------------------------------------------------------------------------------------
86  override SCR_BaseRespawnDiag CreateDiag()
87  {
88  return new SCR_SpawnPointRespawnDiag();
89  }
90  #endif
91 }
92 
93 #ifdef ENABLE_DIAG
94 class SCR_SpawnPointRespawnDiag : SCR_RespawnDiag<SCR_SpawnPointRespawnRequestComponent>
95 {
96  protected string m_Prefab = "{7A9EE19AB67B298B}Prefabs/Characters/Factions/INDFOR/FIA/Character_FIA_base.et";
97  protected RplId m_RplId;
98 
99  override void DrawContent()
100  {
101  super.DrawContent();
102  DbgUI.InputText("Prefab: ", m_Prefab);
103  int rplId;
104  DbgUI.InputInt("RplId: ", m_RplId);
105 
106  DbgUI.Spacer(32);
107  DbgUI.Text("======== UTILITY ========");
108  int index;
109  DbgUI.InputInt("Index2Id: ", index);
110  SCR_SpawnPoint point = SCR_SpawnPoint.GetSpawnPointByIndex(index);
111  if (point)
112  {
113  string strRplId = point.GetRplId().ToString();
114  DbgUI.Text(string.Format("Point index: %1\n\tRplId: %2\n\tFaction: %3\n\tType: %4",
115  index, strRplId, point.GetFactionKey(), point.Type().ToString()));
116 
117  SCR_PlayerSpawnPoint psp = SCR_PlayerSpawnPoint.Cast(point);
118  if (psp)
119  {
120  int pid = psp.GetPlayerID();
121  string pnam = GetGame().GetPlayerManager().GetPlayerName(pid);
122  DbgUI.Text(string.Format(" playerId: %1\n playerName: %2", pid, pnam));
123  }
124 
125  DbgUI.Text(string.Format("IsActive: %1", point.IsSpawnPointActive()));
126 
127  if (DbgUI.Button("Copy RplId to clipboard"))
128  System.ExportToClipboard(strRplId);
129  }
130  else
131  {
132  DbgUI.Text(string.Format("No spawn point at index: %1", index));
133  }
134  }
135 
136  //------------------------------------------------------------------------------------------------
137  protected override SCR_SpawnData CreateData()
138  {
139  return new SCR_SpawnPointSpawnData(m_Prefab, m_RplId);
140  }
141 }
142 #endif
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
SCR_SpawnPointRespawnRequestComponentClass
Definition: SCR_SpawnPointSpawnRequestComponent.c:2
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
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
RplRpc
SCR_AchievementsHandlerClass ScriptComponentClass RplRpc(RplChannel.Reliable, RplRcver.Owner)] void UnlockOnClient(AchievementId achievement)
Definition: SCR_AchievementsHandler.c:11
SCR_SpawnPoint
Spawn point entity defines positions on which players can possibly spawn.
Definition: SCR_SpawnPoint.c:27
Rpc_RequestRespawn_S
private void Rpc_RequestRespawn_S(int spawnPointId, ResourceName prefab)
Definition: SCR_SpawnPointSpawnRequestComponent.c:70
SCR_SpawnRequestComponentClass
Definition: SCR_SpawnRequestComponent.c:1
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
SCR_SpawnData
Definition: SCR_SpawnData.c:9
DoCanRequestRespawn
override bool DoCanRequestRespawn(SCR_SpawnData data)
Definition: SCR_SpawnPointSpawnRequestComponent.c:21
SCR_SpawnPointSpawnData
Definition: SCR_SpawnPointSpawnData.c:2
GetDataType
override GetDataType()
Definition: SCR_SpawnPointSpawnRequestComponent.c:15
DoRequestRespawn
override bool DoRequestRespawn(SCR_SpawnData data)
Definition: SCR_SpawnPointSpawnRequestComponent.c:53
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
Rpc_CanRequestRespawn_S
private void Rpc_CanRequestRespawn_S(int spawnPointId, ResourceName prefab)
Definition: SCR_SpawnPointSpawnRequestComponent.c:38
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
m_Prefab
ResourceName m_Prefab
Definition: ForestGeneratorObjects.c:48
GetHandlerType
SCR_SpawnPointRespawnRequestComponentClass SCR_SpawnRequestComponentClass GetHandlerType()
Definition: SCR_SpawnPointSpawnRequestComponent.c:9
GetPlayerId
proto external int GetPlayerId()
Definition: SCR_SpawnRequestComponent.c:39
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180