Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FreeSpawnRequestComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Respawn/PlayerController")]
3 {
4 }
5 
6 class SCR_FreeSpawnRequestComponent : SCR_SpawnRequestComponent
7 {
8  //------------------------------------------------------------------------------------------------
9  override typename GetHandlerType()
10  {
11  return SCR_FreeSpawnHandlerComponent;
12  }
13 
14  //------------------------------------------------------------------------------------------------
15  override typename GetDataType()
16  {
17  return SCR_FreeSpawnData;
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 
28  // We can construct whatever we want here on client
29  Rpc(Rpc_CanRequestRespawn_S, data.GetPosition(), data.GetAngles(), data.GetPrefab());
30  return true;
31  }
32 
33  //------------------------------------------------------------------------------------------------
34  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
35  private void Rpc_CanRequestRespawn_S(vector position, vector angles, ResourceName prefab)
36  {
37  #ifdef _ENABLE_RESPAWN_LOGS
38  Print(string.Format("%1::Rpc_CanRequestRespawn_S(playerId: %2, pos: %3, ang: %4, pref: %5)", Type().ToString(),
40  position,
41  angles,
42  prefab), LogLevel.NORMAL);
43  #endif
44 
45  SCR_FreeSpawnData data = new SCR_FreeSpawnData(prefab, position, angles);
47  }
48 
49  //------------------------------------------------------------------------------------------------
53  protected override bool DoRequestRespawn(SCR_SpawnData data)
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 
60  // We can construct whatever we want here on client
61  Rpc(Rpc_RequestRespawn_S, data.GetPosition(), data.GetAngles(), data.GetPrefab());
62  return true;
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  [RplRpc(RplChannel.Reliable, RplRcver.Server)]
67  private void Rpc_RequestRespawn_S(vector position, vector angles, ResourceName prefab)
68  {
69  #ifdef _ENABLE_RESPAWN_LOGS
70  Print(string.Format("%1::Rpc_RequestRespawn_S(playerId: %2, pos: %3, ang: %4, pref: %5)", Type().ToString(),
72  position,
73  angles,
74  prefab), LogLevel.NORMAL);
75  #endif
76 
77  SCR_FreeSpawnData data = new SCR_FreeSpawnData(prefab, position, angles);
79  }
80 
81  #ifdef ENABLE_DIAG
82  //------------------------------------------------------------------------------------------------
83  override SCR_BaseRespawnDiag CreateDiag()
84  {
85  return new SCR_FreeRespawnDiag();
86  }
87  #endif
88 }
89 
90 #ifdef ENABLE_DIAG
91 class SCR_FreeRespawnDiag : SCR_RespawnDiag<SCR_FreeSpawnRequestComponent>
92 {
93  protected string m_Prefab = "{7A9EE19AB67B298B}Prefabs/Characters/Factions/INDFOR/FIA/Character_FIA_base.et";
94  protected string m_Position = "0 0.1 2";
95  protected string m_Angles = "0 180 0";
96 
97  //------------------------------------------------------------------------------------------------
98  override void DrawContent()
99  {
100  super.DrawContent();
101  DbgUI.InputText("Prefab: ", m_Prefab);
102  DbgUI.InputText("Position: ", m_Position);
103  }
104 
105  //------------------------------------------------------------------------------------------------
106  protected override SCR_SpawnData CreateData()
107  {
108  vector position = m_Position.ToVector();
109  vector angles = m_Angles.ToVector();
110  return new SCR_FreeSpawnData(m_Prefab, position, angles);
111  }
112 }
113 #endif
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
SCR_FreeSpawnRequestComponentClass
Definition: SCR_FreeSpawnRequestComponent.c:2
m_Position
private vector m_Position
Definition: UnitDisplayComponent.c:17
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
GetHandlerType
SCR_FreeSpawnRequestComponentClass SCR_SpawnRequestComponentClass GetHandlerType()
Definition: SCR_FreeSpawnRequestComponent.c:9
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
Rpc_RequestRespawn_S
private void Rpc_RequestRespawn_S(vector position, vector angles, ResourceName prefab)
Definition: SCR_FreeSpawnRequestComponent.c:67
Rpc_CanRequestRespawn_S
private void Rpc_CanRequestRespawn_S(vector position, vector angles, ResourceName prefab)
Definition: SCR_FreeSpawnRequestComponent.c:35
SCR_SpawnData
Definition: SCR_SpawnData.c:9
DoCanRequestRespawn
override bool DoCanRequestRespawn(SCR_SpawnData data)
Definition: SCR_FreeSpawnRequestComponent.c:21
DoRequestRespawn
protected override bool DoRequestRespawn(SCR_SpawnData data)
Definition: SCR_FreeSpawnRequestComponent.c:53
SCR_FreeSpawnData
Definition: SCR_FreeSpawnData.c:2
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
GetDataType
override GetDataType()
Definition: SCR_FreeSpawnRequestComponent.c:15
m_Prefab
ResourceName m_Prefab
Definition: ForestGeneratorObjects.c:48
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
GetPlayerId
proto external int GetPlayerId()
Definition: SCR_SpawnRequestComponent.c:39
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180